RFR(S): 6378256: Performance problem with System.identityHashCode in client compiler
Tobias Hartmann
tobias.hartmann at oracle.com
Wed Dec 9 11:20:52 UTC 2015
Hi Rahul,
looks good to me (not a reviewer).
Best,
Tobias
On 09.12.2015 10:12, 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