Mercurial > hg > graal-compiler
changeset 11825:463f51256c86
AMD64HotSpot: emit jump to IC miss handler directly instead of emitting it inside verfied_entry
for empty methods we emitted something like this if a inline cache is needed:
prefix:
00: < IC check >
...
0b: jne <ic_miss_call>
11: nop
...
verified_entry:
20: ret
ic_miss_call:
21: jmp <entry of runtime function>
when a method is deoptimized, HotSpot patches the verified_entry (0x20) with a
jump to a stub that handles call-sites that has been made non-entrant. since this jump
is 5 bytes long, it will overwrite ic_miss_call and blow up every caller that
calls this method via the unverified entry (prefix).
the fix is to emit the jump to the runtime function inside the unverfied entry:
prefix:
00: < IC check >
...
0b: je <verified_entry>
11: jeq <entry of runtime function>
16: nop
...
verified_entry:
20: ret
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Mon, 30 Sep 2013 09:32:18 +0200 |
parents | e1a1264cb0a7 |
children | 2d3d3d36ab3c |
files | graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java |
diffstat | 1 files changed, 5 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Sep 30 09:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Sep 30 09:32:18 2013 +0200 @@ -236,11 +236,10 @@ FrameMap frameMap = tasm.frameMap; RegisterConfig regConfig = frameMap.registerConfig; HotSpotVMConfig config = runtime().config; - Label unverifiedStub = installedCodeOwner == null || isStatic(installedCodeOwner.getModifiers()) ? null : new Label(); + Label verifiedStub = new Label(); // Emit the prefix - - if (unverifiedStub != null) { + if (installedCodeOwner != null && !isStatic(installedCodeOwner.getModifiers())) { tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY); CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{runtime().lookupJavaType(Object.class)}, target, false); Register inlineCacheKlass = rax; // see definition of IC_Klass in @@ -257,11 +256,13 @@ } else { asm.cmpq(inlineCacheKlass, src); } - asm.jcc(ConditionFlag.NotEqual, unverifiedStub); + asm.jcc(ConditionFlag.Equal, verifiedStub); + AMD64Call.directJmp(tasm, asm, runtime().lookupForeignCall(IC_MISS_HANDLER)); } asm.align(config.codeEntryAlignment); tasm.recordMark(Marks.MARK_OSR_ENTRY); + asm.bind(verifiedStub); tasm.recordMark(Marks.MARK_VERIFIED_ENTRY); // Emit code for the LIR @@ -278,10 +279,5 @@ // it has no calls that can cause such "return" entries assert !frameMap.accessesCallerFrame() : lirGen.getGraph(); } - - if (unverifiedStub != null) { - asm.bind(unverifiedStub); - AMD64Call.directJmp(tasm, asm, runtime().lookupForeignCall(IC_MISS_HANDLER)); - } } }