Unsafe.{get,put}-X-Unaligned; Efficient array comparison intrinsics

John Rose john.r.rose at oracle.com
Mon Mar 9 05:56:21 UTC 2015


On Mar 8, 2015, at 4:32 PM, David Holmes <david.holmes at oracle.com> wrote:
> 
> Yes it could but why should it be? You have a singleton instance with all instance methods, so cached state should be in an instance field not a static one.

No, the singleton instance is *not* currently used, so it would add new constraints on the optimizer to begin using fields from it.
Only the non-nullness of its reference is significant.  It has no state by design.
Put another way:  It is a uniquely simple empty singleton object.
To pass the unsafe access check, the JIT need only check that some non-null reference is available.
And JVM JITs are very good at exactly that check.

— John


More information about the core-libs-dev mailing list