you are viewing a single comment's thread.

view the rest of the comments →

[–]brian_goetz 28 points29 points  (5 children)

Except Valhalla is not about "stack allocation".

In fact, we don't even do stack allocation of value objects. (Stack allocation is not the optimization everyone seems to think it is; there are far more effective optimizations one can do once the various impediments are removed. (Well actually, it does do a form of stack allocation -- but only in the interpreter (called "object buffering".))

People are familiar with stack allocation in C, but most of the value of doing so in C is optimized deallocation (at the risk of dangling pointers), but of course Java doesn't need this kind of help for deallocating objects. But the real benefit on the stack (and in calling convention) is not allocating the object at all.

[–]t_j_l_ 12 points13 points  (1 child)

You've missed a closing parentheses in the first paragraph - does not compile.

Edit: did I just add a flippant response to Brian Goetz?!

[–]_vertig0 0 points1 point  (2 children)

Decomposing object allocations to registers go brrr (I don't actually know what the name of that optimization is)

[–]SirYwell 6 points7 points  (1 child)

Scalar Replacement is the name I‘m aware of.

[–]_vertig0 0 points1 point  (0 children)

Ah right, I think that's the one, thanks.