Sharing the markword (aka Valhalla's markword use)
John Rose
john.r.rose at oracle.com
Mon Mar 11 19:49:46 UTC 2024
On 11 Mar 2024, at 7:23, Kennke, Roman wrote:
>> (Why not a fixed location, like offset=4? Because you might overflow the narrow-klass field’s encoding range, when loading a subclass of a class which already uses the desirable offset=4 slot for a regular instance field. You can get around this by using offset=-4, but that opens different cans of worms. Better to assume instance fields will compete for offsets with the injected full-klass field.)
>
> Ah I just carefully re-read this. You are right, this would be a problem, indeed. Very good point. I also like the joint-bit encoding. However, we’d have to ensure that the relevant mode bit-pattern (e.g. upper 8 bits zero) would not happen in normal encoding. Currently, I think this is in-fact a very common situation.
Yes, it would be common (1/2^N probability for N joint bits) unless there is a specific filter applied by whatever library is responsible for allocating those bit encodings. But if there is a single factory for those codes, the factory can be adjusted to skip the codes reserved by the joint-bit-encoding for other uses. If it’s a storage allocator, there will be (a very small bit of) fragmentation loss because of the unusable addresses.
More information about the lilliput-dev
mailing list