# HG changeset patch # User Bernhard Urban # Date 1380526338 -7200 # Node ID 463f51256c86ce1511ec05ea292226ccdcd06a78 # Parent e1a1264cb0a79638ff0e38d512de5adb6ab0368b 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 11: nop ... verified_entry: 20: ret ic_miss_call: 21: jmp 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 11: jeq 16: nop ... verified_entry: 20: ret diff -r e1a1264cb0a7 -r 463f51256c86 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- 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)); - } } }