changeset 9451:3ccda80d466b

stack overflow check and deopt/exception handler entry points are omitted from compiled stubs
author Doug Simon <doug.simon@oracle.com>
date Tue, 30 Apr 2013 19:11:14 +0200
parents 147162b27799
children c1ba734c1ea0
files graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Tue Apr 30 08:17:55 2013 -0400
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Tue Apr 30 19:11:14 2013 +0200
@@ -100,13 +100,21 @@
 
     class HotSpotFrameContext implements FrameContext {
 
+        final boolean isStub;
+
+        HotSpotFrameContext(boolean isStub) {
+            this.isStub = isStub;
+        }
+
         @Override
         public void enter(TargetMethodAssembler tasm) {
             FrameMap frameMap = tasm.frameMap;
             int frameSize = frameMap.frameSize();
 
             AMD64MacroAssembler asm = (AMD64MacroAssembler) tasm.asm;
-            emitStackOverflowCheck(tasm, false);
+            if (!isStub) {
+                emitStackOverflowCheck(tasm, false);
+            }
             asm.decrementq(rsp, frameSize);
             if (GraalOptions.ZapStackOnMethodEntry) {
                 final int intSize = 4;
@@ -151,16 +159,16 @@
         LIR lir = gen.lir;
         boolean omitFrame = CanOmitFrame && !frameMap.frameNeedsAllocating() && !lir.hasArgInCallerFrame();
 
+        Stub stub = runtime().asStub(lirGen.method());
         AbstractAssembler masm = new AMD64MacroAssembler(target, frameMap.registerConfig);
-        HotSpotFrameContext frameContext = omitFrame ? null : new HotSpotFrameContext();
+        HotSpotFrameContext frameContext = omitFrame ? null : new HotSpotFrameContext(stub != null);
         TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime(), frameMap, masm, frameContext, compilationResult);
         tasm.setFrameSize(frameMap.frameSize());
         StackSlot deoptimizationRescueSlot = gen.deoptimizationRescueSlot;
-        if (deoptimizationRescueSlot != null) {
+        if (deoptimizationRescueSlot != null && stub == null) {
             tasm.compilationResult.setCustomStackAreaOffset(frameMap.offsetForStackSlot(deoptimizationRescueSlot));
         }
 
-        Stub stub = runtime().asStub(lirGen.method());
         if (stub != null) {
 
             final Set<Register> definedRegisters = gatherDefinedRegisters(lir);
@@ -239,8 +247,8 @@
         // Emit code for the LIR
         lirGen.lir.emitCode(tasm);
 
-        boolean frameOmitted = tasm.frameContext == null;
-        if (!frameOmitted) {
+        HotSpotFrameContext frameContext = (HotSpotFrameContext) tasm.frameContext;
+        if (frameContext != null && !frameContext.isStub) {
             tasm.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY);
             AMD64Call.directCall(tasm, asm, runtime().lookupRuntimeCall(EXCEPTION_HANDLER), null, false, null);
             tasm.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY);