What happened to the "mutable struct" debate?

Vitaly Davidovich vitalyd at gmail.com
Fri Jan 23 05:00:49 UTC 2015


Brian,

Where did you hear this? :)

It's true that interior pointers slow down marking as you need to find the
beginning of the object, but it's pay-as-you-go in that you pay this cost
for interior pointers only.  To reduce # of such pointers, CLR allows such
pointers on-stack only (i.e. you cannot have interior pointers in objects
on the heap), so their number should be pretty small in typical code.  I
don't think this impacts much else, and I'd be very surprised if this is
one of the *major* reasons for the difference.  But, perhaps I'm missing
something, in which case, please do tell.

sent from my phone

sent from my phone
On Jan 22, 2015 11:40 PM, "Brian Goetz" <brian.goetz at oracle.com> wrote:

> If Brian & co could somehow be swayed to add them, I suspect this would
>> drag in the requirement that you should be able to pass them by reference.
>> Without that, they're of marginal utility since you can't avoid copying
>> costs.  Passing things by reference would be yet another entirely new
>> concept to java, and given some of the sentiment I've read on this list
>> thus far, this would comatose some people.
>>
>
> Very much so.  This is indeed Big Strike #1 against them; this is a new
> big complexity that Java (platform and developers) have not had to deal
> with.
>
> Which leads directly to Big Strike #2: passing mutable structs by
> reference leads to interior pointers (pointers into the middle of objects),
> which is a huge additional burden for the GC.  (I'm told this is one of the
> major reasons why .NET GC is so much slower than the JVM, because they have
> to deal with this additional requirement.)
>
>


More information about the valhalla-dev mailing list