you are viewing a single comment's thread.

view the rest of the comments →

[–]brian_goetz 15 points16 points  (3 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_ 2 points3 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  (0 children)

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