Reference pointers in compact value objects (primitive classes)

- liangchenblue at gmail.com
Tue Apr 25 13:38:20 UTC 2023


Hello,
I just wonder if nullable reference pointers can be part of compact
value objects.

For instance, in the Classfile API, there is StackMapGenerator.Type, a
record with (int type, ClassDesc reference, int bci). The default
state (0, null, 0) is valid and a desirable default (0 type means
top-type). If the ClassDesc field can be part of the compact
representation, then the whole structure can be optimized, which looks
promising to me.

Meanwhile, I have another question about nullable object
representation in value classes: Suppose we have
Optional<Optional<Optional<String>>>, what will the representation be?
How will we distinguish Optional.empty() with
Optional.of(Optional.empty())?

Thanks,
Chen Liang



More information about the valhalla-dev mailing list