hKash value in java objects

John Rose john.r.rose at oracle.com
Fri Dec 7 23:19:57 PST 2012


On Dec 7, 2012, at 9:39 PM, Xin Tong wrote:

> On Fri, Dec 7, 2012 at 11:38 PM, Krystal Mok <rednaxelafx at gmail.com> wrote:
>> Short answer is the identity hash code is calculated when:
>> 1. the hashCode() method is called the first time for this object, if
>> the type of this object doesn't override Object.hashCode();
>> 2. System.identityHashCode() is called the first time for this object.
>> 
> would not materialize the hashcode takes much code. why not materialize lazily ?

That's what Kris means, I think.

You can check the code; it's ObjectSynchronizer::FastHashCode in this file:
  http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/tip/src/share/vm/runtime/synchronizer.cpp

Enjoy,
— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20121207/518c7c1a/attachment.html 


More information about the hotspot-compiler-dev mailing list