RFR(S): 6378256: Performance problem with System.identityHashCode in client compiler

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Dec 10 23:38:37 UTC 2015


Also, doesn't -XX:DisableIntrinsic=_identityHashCode,_hashCode already 
solve the problem?

   diagnostic(ccstrlist, DisableIntrinsic, "", 
      \
          "do not expand intrinsics whose (internal) names appear here") 
     \


Best regards,
Vladimir Ivanov

On 12/11/15 12:03 AM, Christian Thalinger wrote:
>
>> On Dec 9, 2015, at 1:30 PM, Dean Long <dean.long at oracle.com> wrote:
>>
>> The new System.identityHashCode optimization can't be turned off on the command-line,
>> because InlineObjectHash only applies to Object.hashCode.  Does it matter?
>
> All these command line flags are a pain since they are all product flags.  Doesn’t Compiler Control provide a way to disable an intrinsic?
>
> Actually, InlineObjectHash is a develop flag so you can’t turn it off in a release build:
>
> src/share/vm/runtime/globals.hpp
> 806:  develop(bool, InlineObjectHash, true,                                     \
>
>>
>> dl
>>
>> On 12/9/2015 1:12 AM, Rahul Raghavan wrote:
>>> Hello,
>>>
>>> Please review the following patch for JDK-6378256.
>>>
>>> webrev: http://cr.openjdk.java.net/~thartmann/6378256/webrev.00/ .
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-6378256  .
>>> Performance problem with System.identityHashCode, compared to Object.hashCode, with client compiler (at least seven times slower).
>>> Issue reproducible for x86_32, SPARC (with -client / -XX:TieredStopAtLevel=1 , 2, 3 options).
>>>
>>> sample unit test:
>>>     public class Jdk6378256Test
>>>     {
>>>        public static void main(String[] args)
>>>        {
>>>           Object obj = new Object();
>>>           long time = System.nanoTime();
>>>           for(int i = 0 ; i < 1000000 ; i++)
>>>              System.identityHashCode(obj);  //compare to obj.hashCode();
>>>           System.out.println ("Result = " + (System.nanoTime() - time));
>>>        }
>>>     }
>>>
>>> Fix: Enabled the C1 optimization which was done only for Object.hashCode, now for System.identityHashCode() also.
>>> (looks in the header for the hashCode before calling into the VM).
>>> Unlike for Object.hashCode, System.identityHashCode is static method and gets object as argument instead of the receiver.
>>> So also added required additional null check for System.identityHashCode case.
>>>
>>> Testing:
>>>     - successful JPRT run (-testset hotspot).
>>>     - JTREG testing (hotspot/test, jdk/test - java/util, java/io, java/lang/System).
>>>         (with -client / -XX:TieredStopAtLevel=1 etc. options).
>>>     - Added 'noreg-perf' label for this performance bug.
>>>        Manual testing done and confirmed expected performance values for unit tests with fix.
>>>
>>> Thanks,
>>> Rahul
>>
>


More information about the hotspot-compiler-dev mailing list