Mercurial > hg > truffle
changeset 6518:ea845fd3c820
add hashCode fast path for System.identityHashCode
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 05 Oct 2012 15:17:27 +0200 |
parents | 2dfab5607b3d |
children | feabae0d6bdc |
files | src/cpu/x86/vm/sharedRuntime_x86_64.cpp |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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