> we want the JVM to be able to treat them as efficiently as primitives.
They want basically to solve the main Java design flaw with (almost) everything is a reference paradigm. C++ and Rust have had value-types from day one.
> 64 bits, including the null flag
So, this basically makes every value-object optional, adds extra overhead and makes code less safe to null pointer dereference errors.
> but a class with, say, two int fields or one double may not fit in an atomic write and end up as an ordinary object on the heap anyway
So, the whole optimization is applied only for very small structs with no more than two scalars (or so). Did it worth to spend 10+ years of development to achieve this?
They want basically to solve the main Java design flaw with (almost) everything is a reference paradigm. C++ and Rust have had value-types from day one.
> 64 bits, including the null flag
So, this basically makes every value-object optional, adds extra overhead and makes code less safe to null pointer dereference errors.
> but a class with, say, two int fields or one double may not fit in an atomic write and end up as an ordinary object on the heap anyway
So, the whole optimization is applied only for very small structs with no more than two scalars (or so). Did it worth to spend 10+ years of development to achieve this?