On 9/03/2015 3:56 PM, John Rose wrote:
On Mar 8, 2015, at 4:32 PM, David Holmes <david.hol...@oracle.com
<mailto:david.hol...@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.

No sure what you mean by it isn't used - code invokes instance methods on the unsafe instance all over the JDK ???

Only the non-nullness of its reference is significant.  It has no state
by design.

Given all existing methods are stateless I can't tell if this a statement of intent (ie it must never have state) or simply a statement of fact as all the methods are stateless. If it should in fact never have any state then that should be documented.

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.

So the reason to use a static field from an instance method is simply an artifact of the interaction of our JIT with this class?

David

— John

Reply via email to