# HG changeset patch # User Lukas Stadler # Date 1349443047 -7200 # Node ID ea845fd3c82037bdaee8957ce3f34e0af9edc1b0 # Parent 2dfab5607b3d81b9ac7f28f0c878aad1f9024124 add hashCode fast path for System.identityHashCode diff -r 2dfab5607b3d -r ea845fd3c820 src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Oct 05 13:44:26 2012 +0200 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Oct 05 15:17:27 2012 +0200 @@ -1970,14 +1970,20 @@ int vep_offset = ((intptr_t)__ pc()) - start; #ifdef GRAAL - if (InlineObjectHash && method->intrinsic_id() == vmIntrinsics::_hashCode) { + if (InlineObjectHash && (method->intrinsic_id() == vmIntrinsics::_hashCode || method->intrinsic_id() == vmIntrinsics::_identityHashCode)) { // Object.hashCode can pull the hashCode from the header word // instead of doing a full VM transition once it's been computed. // Since hashCode is usually polymorphic at call sites we can't do // this optimization at the call site without a lot of work. Label slowCase; + Label nullCase; Register result = rax; + if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) { + __ cmpptr(receiver, 0); + __ jcc(Assembler::equal, nullCase); + } + __ movptr(result, Address(receiver, oopDesc::mark_offset_in_bytes())); // check if locked @@ -1997,6 +2003,12 @@ __ jcc (Assembler::zero, slowCase); __ ret(0); + if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) { + __ bind(nullCase); + __ movl(result, 0); + __ ret(0); + } + __ bind (slowCase); } #endif // GRAAL