Civilizer - let's civilize those primitive types !

Red IO redio.development at gmail.com
Fri Jan 13 09:20:19 UTC 2023


Thanks,
I didn't think about registers at all while underestimating the depth of
optimization the runtime can do. I wasn't expecting the vm to intelligently
manage registers at runtime.

But I doubt that value objects will be often only stored in registers since
their space is (on most platforms) pretty limited. You would need to strip
unused fields from the object which often will reduce the object to maybe
1-2 int or something, reducing it to nothing more than the arguments for
the next cpu cycle. But storing a larger object > ~200 bytes completely in
registers is impossible in the first place. And storing multiple value
objects simultaneously in registers is even more unlikely to happen.

This level of optimization really makes value objects feel like c structs
which shows how great the improvement from objects to value objects really
is. It's really only a grouping of local variables in 1 name. Which totally
makes sense for pure data carriers especially records.

Great regards
RedIODev

On Thu, Jan 12, 2023, 22:18 Brian Goetz <brian.goetz at oracle.com> wrote:

>
>
> > Everything has a memory address period.
>
> Despite emphasizing it with “period” as if it were obviously true, this
> statement is not correct.
>
> Value objects can be scalarized into their fields, and those fields can be
> hoisted into registers, and registers have no memory address.   There is no
> reason why a copy of the object need be placed in memory at all.  In fact,
> this is much of the raison d’être for Valhalla — to give the runtime
> permission to confidently make this optimization, by saying that an object
> need not live in a single — or even any — place in “memory".
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-dev/attachments/20230113/c651adea/attachment.htm>


More information about the valhalla-dev mailing list