# HG changeset patch # User Lukas Stadler # Date 1349437466 -7200 # Node ID 2dfab5607b3d81b9ac7f28f0c878aad1f9024124 # Parent 174805dea3fc9b1c7ca914f53d08fef1104f18b5 fix hashCode changes: port to x64 diff -r 174805dea3fc -r 2dfab5607b3d src/cpu/x86/vm/sharedRuntime_x86_32.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Fri Oct 05 10:54:06 2012 +0200 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Fri Oct 05 13:44:26 2012 +0200 @@ -1746,7 +1746,7 @@ __ ret(0); __ bind (slowCase); } -#endif // COMPILER1 +#endif // COMPILER1 || GRAAL // The instruction at the verified entry point must be 5 bytes or longer // because it can be patched on the fly by make_non_entrant. The stack bang diff -r 174805dea3fc -r 2dfab5607b3d src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Oct 05 10:54:06 2012 +0200 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Oct 05 13:44:26 2012 +0200 @@ -1969,6 +1969,38 @@ int vep_offset = ((intptr_t)__ pc()) - start; +#ifdef GRAAL + if (InlineObjectHash && method->intrinsic_id() == vmIntrinsics::_hashCode) { + // 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; + Register result = rax; + + __ movptr(result, Address(receiver, oopDesc::mark_offset_in_bytes())); + + // check if locked + __ testptr(result, markOopDesc::unlocked_value); + __ jcc (Assembler::zero, slowCase); + + if (UseBiasedLocking) { + // Check if biased and fall through to runtime if so + __ testptr(result, markOopDesc::biased_lock_bit_in_place); + __ jcc (Assembler::notZero, slowCase); + } + + // get hash + __ shrptr(result, markOopDesc::hash_shift); + __ andptr(result, markOopDesc::hash_mask); + // test if hashCode exists + __ jcc (Assembler::zero, slowCase); + __ ret(0); + + __ bind (slowCase); + } +#endif // GRAAL + // The instruction at the verified entry point must be 5 bytes or longer // because it can be patched on the fly by make_non_entrant. The stack bang // instruction fits that requirement.