changeset 2935:9b8f30608e62

deoptimization action (invalidate, reprofile, ...) more debug properties and assertions
author Lukas Stadler <lukas.stadler@jku.at>
date Fri, 10 Jun 2011 15:01:14 +0200
parents 1e13559b112d
children 3fa0e12d524a
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Value.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java graal/hotspot/hotspot Default.launch src/cpu/x86/vm/c1_globals_x86.hpp src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/share/vm/oops/methodOop.cpp
diffstat 15 files changed, 139 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Fri Jun 10 15:01:14 2011 +0200
@@ -38,6 +38,7 @@
 import com.oracle.max.graal.compiler.globalstub.*;
 import com.oracle.max.graal.compiler.graph.*;
 import com.oracle.max.graal.compiler.ir.*;
+import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.compiler.value.*;
@@ -207,8 +208,10 @@
     public static class DeoptimizationStub {
         public final Label label = new Label();
         public final LIRDebugInfo info;
+        public final DeoptAction action;
 
-        public DeoptimizationStub(FrameState state) {
+        public DeoptimizationStub(DeoptAction action, FrameState state) {
+            this.action = action;
             info = new LIRDebugInfo(state);
         }
     }
@@ -395,7 +398,7 @@
             deoptimizationStubs = new ArrayList<DeoptimizationStub>();
         }
 
-        DeoptimizationStub stub = new DeoptimizationStub(state);
+        DeoptimizationStub stub = new DeoptimizationStub(DeoptAction.InvalidateReprofile, state);
         deoptimizationStubs.add(stub);
         throw new RuntimeException();
         //lir.branch(x.condition.negate(), stub.label, stub.info);
@@ -947,7 +950,8 @@
 
     @Override
     public void visitDeoptimize(Deoptimize deoptimize) {
-        DeoptimizationStub stub = new DeoptimizationStub(lastState);
+        assert lastState != null : "deoptimize always needs a state";
+        DeoptimizationStub stub = new DeoptimizationStub(deoptimize.action(), lastState);
         addDeoptimizationStub(stub);
         lir.branch(Condition.TRUE, stub.label, stub.info);
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java	Fri Jun 10 15:01:14 2011 +0200
@@ -31,10 +31,20 @@
     private static final int INPUT_COUNT = 0;
     private static final int SUCCESSOR_COUNT = 0;
 
-    private String message;
+    public static enum DeoptAction {
+        None,                           // just interpret, do not invalidate nmethod
+        Recompile,                      // recompile the nmethod; need not invalidate
+        InvalidateReprofile,            // invalidate the nmethod, reset IC, maybe recompile
+        InvalidateRecompile,            // invalidate the nmethod, recompile (probably)
+        InvalidateStopCompiling,        // invalidate the nmethod and do not compile
+    }
 
-    public Deoptimize(Graph graph) {
+    private String message;
+    private final DeoptAction action;
+
+    public Deoptimize(DeoptAction action, Graph graph) {
         super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+        this.action = action;
     }
 
     public void setMessage(String message) {
@@ -45,6 +55,10 @@
         return message;
     }
 
+    public DeoptAction action() {
+        return action;
+    }
+
     @Override
     public void accept(ValueVisitor v) {
         v.visitDeoptimize(this);
@@ -62,7 +76,7 @@
 
     @Override
     public Node copy(Graph into) {
-        Deoptimize x = new Deoptimize(into);
+        Deoptimize x = new Deoptimize(action, into);
         x.setMessage(message);
         return x;
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Value.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Value.java	Fri Jun 10 15:01:14 2011 +0200
@@ -205,6 +205,4 @@
         properties.put("operand", operand == null ? "null" : operand.toString());
         return properties;
     }
-
-
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Fri Jun 10 15:01:14 2011 +0200
@@ -34,6 +34,7 @@
 import com.oracle.max.graal.compiler.graph.BlockMap.*;
 import com.oracle.max.graal.compiler.graph.BlockMap.Block;
 import com.oracle.max.graal.compiler.ir.*;
+import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.compiler.value.*;
@@ -82,7 +83,7 @@
     private int nextBlockNumber;
 
     private Value methodSynchronizedObject;
-    private CiExceptionHandler syncHandler;
+    private CiExceptionHandler unwindHandler;
 
     private Block unwindBlock;
     private Block returnBlock;
@@ -172,13 +173,13 @@
             finishStartBlock(startBlock);
 
             // 4A.3 setup an exception handler to unlock the root method synchronized object
-            syncHandler = new CiExceptionHandler(0, method.code().length, Instruction.SYNCHRONIZATION_ENTRY_BCI, 0, null);
+            unwindHandler = new CiExceptionHandler(0, method.code().length, Instruction.SYNCHRONIZATION_ENTRY_BCI, 0, null);
         } else {
             // 4B.1 simply finish the start block
             finishStartBlock(startBlock);
 
             if (createUnwind) {
-                syncHandler = new CiExceptionHandler(0, method.code().length, Instruction.SYNCHRONIZATION_ENTRY_BCI, 0, null);
+                unwindHandler = new CiExceptionHandler(0, method.code().length, Instruction.SYNCHRONIZATION_ENTRY_BCI, 0, null);
             }
         }
 
@@ -381,7 +382,7 @@
         }
 
         if (firstHandler == null) {
-            firstHandler = syncHandler;
+            firstHandler = unwindHandler;
         }
 
         if (firstHandler != null) {
@@ -436,7 +437,7 @@
             // this is a load of class constant which might be unresolved
             RiType riType = (RiType) con;
             if (!riType.isResolved()) {
-                append(new Deoptimize(graph));
+                append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
                 frameState.push(CiKind.Object, append(Constant.forObject(null, graph)));
             } else {
                 frameState.push(CiKind.Object, append(new Constant(riType.getEncoding(Representation.JavaClass), graph)));
@@ -737,7 +738,7 @@
             NewInstance n = new NewInstance(type, cpi, constantPool, graph);
             frameState.apush(append(n));
         } else {
-            append(new Deoptimize(graph));
+            append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
             frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
         }
     }
@@ -756,7 +757,7 @@
             NewArray n = new NewObjectArray(type, length, graph);
             frameState.apush(append(n));
         } else {
-            append(new Deoptimize(graph));
+            append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
             frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
         }
 
@@ -773,7 +774,7 @@
             NewArray n = new NewMultiArray(type, dims, cpi, constantPool, graph);
             frameState.apush(append(n));
         } else {
-            append(new Deoptimize(graph));
+            append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
             frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
         }
     }
@@ -785,7 +786,7 @@
             LoadField load = new LoadField(receiver, field, graph);
             appendOptimizedLoadField(kind, load);
         } else {
-            append(new Deoptimize(graph));
+            append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
             frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph)));
         }
     }
@@ -797,7 +798,7 @@
             StoreField store = new StoreField(receiver, field, value, graph);
             appendOptimizedStoreField(store);
         } else {
-            append(new Deoptimize(graph));
+            append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
         }
     }
 
@@ -817,7 +818,7 @@
                 LoadField load = new LoadField(container, field, graph);
                 appendOptimizedLoadField(kind, load);
             } else {
-                append(new Deoptimize(graph));
+                append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
                 frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph)));
             }
         }
@@ -831,7 +832,7 @@
             StoreField store = new StoreField(container, field, value, graph);
             appendOptimizedStoreField(store);
         } else {
-            append(new Deoptimize(graph));
+            append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
         }
     }
 
@@ -839,7 +840,7 @@
         if (initialized) {
             return appendConstant(holder.getEncoding(representation));
         } else {
-            append(new Deoptimize(graph));
+            append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
             return null;
         }
     }
@@ -1202,7 +1203,7 @@
 //        Merge x = new Merge(graph);
 //        x.setStateBefore(((StateSplit) block.firstInstruction).stateBefore());
 //        append(x);
-        append(new Deoptimize(graph));
+        append(new Deoptimize(DeoptAction.InvalidateReprofile, graph));
     }
 
     private void createUnwindBlock(Block block) {
@@ -1239,7 +1240,7 @@
                 Instruction nextDispatch = createTarget(nextBlock, frameState);
                 append(new ExceptionDispatch(frameState.stackAt(0), catchSuccessor, nextDispatch, block.handler.catchType(), graph));
             } else {
-                Deoptimize deopt = new Deoptimize(graph);
+                Deoptimize deopt = new Deoptimize(DeoptAction.InvalidateRecompile, graph);
                 deopt.setMessage("unresolved " + block.handler.catchType().name());
                 append(deopt);
                 Instruction nextDispatch = createTarget(nextBlock, frameState);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Fri Jun 10 15:01:14 2011 +0200
@@ -271,11 +271,17 @@
             Node returnDuplicate = duplicates.get(returnNode);
             returnDuplicate.inputs().clearAll();
 
+            Merge mergeAfter = new Merge(compilation.graph);
+
             assert returnDuplicate.predecessors().size() == 1;
             Node returnPred = returnDuplicate.predecessors().get(0);
             int index = returnDuplicate.predecessorsIndex().get(0);
-            returnPred.successors().setAndClear(index, invoke, 0);
+            mergeAfter.successors().setAndClear(0, invoke, 0);
+            returnPred.successors().set(index, mergeAfter);
+
             returnDuplicate.delete();
+
+            mergeAfter.setStateBefore(stateAfter);
         }
 
         if (exceptionEdge != null) {
@@ -304,8 +310,11 @@
         // adjust all frame states that were copied
         if (frameStates.size() > 0) {
             FrameState outerFrameState = stateAfter.duplicateModified(invoke.bci, invoke.kind);
-            for (Node frameState : frameStates) {
-                ((FrameState) duplicates.get(frameState)).setOuterFrameState(outerFrameState);
+            for (Node node : frameStates) {
+                FrameState frameState = (FrameState) duplicates.get(node);
+                if (!frameState.isDeleted()) {
+                    frameState.setOuterFrameState(outerFrameState);
+                }
             }
         }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Fri Jun 10 15:01:14 2011 +0200
@@ -2070,6 +2070,27 @@
     @Override
     public void emitDeoptizationStub(DeoptimizationStub stub) {
         masm.bind(stub.label);
+        int code;
+        switch(stub.action) {
+            case None:
+                code = 0;
+                break;
+            case Recompile:
+                code = 1;
+                break;
+            case InvalidateReprofile:
+                code = 2;
+                break;
+            case InvalidateRecompile:
+                code = 3;
+                break;
+            case InvalidateStopCompiling:
+                code = 4;
+                break;
+            default:
+                throw Util.shouldNotReachHere();
+        }
+        masm.movq(rscratch1, code);
         directCall(CiRuntimeCall.Deoptimize, stub.info);
         shouldNotReachHere();
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java	Fri Jun 10 15:01:14 2011 +0200
@@ -509,6 +509,29 @@
     }
 
     @Override
+    public Map<Object, Object> getDebugProperties() {
+        Map<Object, Object> properties = super.getDebugProperties();
+        properties.put("bci", bci);
+        properties.put("method", CiUtil.format("%H.%n(%p):%r", method, false));
+        StringBuilder str = new StringBuilder();
+        for (int i = 0; i < localsSize(); i++) {
+            str.append(i == 0 ? "" : ", ").append(localAt(i) == null ? "_" : localAt(i).id());
+        }
+        properties.put("locals", str.toString());
+        str = new StringBuilder();
+        for (int i = 0; i < stackSize(); i++) {
+            str.append(i == 0 ? "" : ", ").append(stackAt(i) == null ? "_" : stackAt(i).id());
+        }
+        properties.put("stack", str.toString());
+        str = new StringBuilder();
+        for (int i = 0; i < locksSize(); i++) {
+            str.append(i == 0 ? "" : ", ").append(lockAt(i) == null ? "_" : lockAt(i).id());
+        }
+        properties.put("locks", str.toString());
+        return properties;
+    }
+
+    @Override
     public Node copy(Graph into) {
         FrameState x = new FrameState(method, bci, localsSize, stackSize, locksSize, into);
         return x;
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java	Fri Jun 10 15:01:14 2011 +0200
@@ -143,6 +143,7 @@
         for (Node node : nodes) {
             if (node != null && !replacements.containsKey(node)) {
                 assert node.graph != this;
+                assert !node.isDeleted() : "trying to duplicate deleted node";
                 Node newNode = node.copy(this);
                 assert newNode.getClass() == node.getClass();
                 newNodes.put(node, newNode);
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java	Fri Jun 10 15:01:14 2011 +0200
@@ -130,7 +130,7 @@
 
     public void delete() {
         assert !isDeleted();
-        assert usages.size() == 0 && predecessors.size() == 0 : "id: " + id + ", usages: " + usages.size() + ", predecessors: " + predecessors().size();
+        assert checkDeletion();
         assert predecessorsIndex.size() == 0;
         for (int i = 0; i < inputs.size(); ++i) {
             inputs.set(i, Null);
@@ -145,6 +145,23 @@
         assert isDeleted();
     }
 
+    private boolean checkDeletion() {
+        if (usages.size() != 0 || predecessors.size() != 0) {
+            System.out.println(this.shortName() + ", id: " + id + ", usages: " + usages.size() + ", predecessors: " + predecessors().size());
+            System.out.println("usages:");
+            for (Node n : usages()) {
+                System.out.print(n.id() + " (" + n.shortName() + ") ");
+            }
+            System.out.println("\npreds:");
+            for (Node n : predecessors()) {
+                System.out.print(n.id() + " (" + n.shortName() + ") ");
+            }
+            System.out.println();
+            return false;
+        }
+        return true;
+    }
+
     public Node copy() {
         return copy(graph);
     }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java	Fri Jun 10 15:01:14 2011 +0200
@@ -53,6 +53,7 @@
 
     @Override
     public Node set(int index, Node node) {
+        assert !self().isDeleted() : "trying to set input/successor of deleted node: " + self().shortName();
         assert node == Node.Null || node.graph == self().graph : "node is from different graph: (this=" + self() + ") and (node=" + node + ")";
         assert node == Node.Null || node.id() != Node.DeletedID : "inserted node must not be deleted";
         Node old = nodes[index];
@@ -145,6 +146,7 @@
     }
 
     public void setAndClear(int index, Node clearedNode, int clearedIndex) {
+        assert !self().isDeleted() : "trying to setAndClear successor of deleted node: " + self().shortName();
         assert self().successors == this;
         Node value = clearedNode.successors.get(clearedIndex);
         assert value != Node.Null;
--- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java	Thu Jun 09 20:25:38 2011 +0200
+++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java	Fri Jun 10 15:01:14 2011 +0200
@@ -621,8 +621,8 @@
             asm.bindOutOfLine(slowPath);
             checkSubtype(asm, objHub, objHub, hub);
             asm.jneq(end, objHub, asm.o(null));
-            XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10);
-            asm.mov(scratch, object);
+            XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Word, AMD64.r10);
+            asm.mov(scratch, asm.createConstant(CiConstant.forWord(0)));
 
             asm.callRuntime(CiRuntimeCall.Deoptimize, null);
             asm.shouldNotReachHere();
@@ -711,6 +711,8 @@
             asm.pload(kind, result, array, index, config.getArrayOffset(kind), Scale.fromInt(elemSize), implicitNullException);
             if (is(BOUNDS_CHECK, flags)) {
                 asm.bindOutOfLine(failBoundsCheck);
+                XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Word, AMD64.r10);
+                asm.mov(scratch, asm.createConstant(CiConstant.forWord(0)));
                 asm.callRuntime(CiRuntimeCall.Deoptimize, null);
                 asm.shouldNotReachHere();
             }
@@ -902,8 +904,8 @@
                 asm.bindOutOfLine(slowStoreCheck);
                 checkSubtype(asm, temp, valueHub, compHub);
                 asm.jneq(store, temp, asm.w(0));
-                XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10);
-                asm.mov(scratch, valueHub);
+                XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Word, AMD64.r10);
+                asm.mov(scratch, asm.createConstant(CiConstant.forWord(0)));
                 asm.callRuntime(CiRuntimeCall.Deoptimize, null);
                 asm.jmp(store);
             }
@@ -986,6 +988,8 @@
             // -- out of line -------------------------------------------------------
             if (is(BOUNDS_CHECK, flags)) {
                 asm.bindOutOfLine(failBoundsCheck);
+                XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Word, AMD64.r10);
+                asm.mov(scratch, asm.createConstant(CiConstant.forWord(0)));
                 asm.callRuntime(CiRuntimeCall.Deoptimize, null);
                 asm.shouldNotReachHere();
             }
--- a/graal/hotspot/hotspot Default.launch	Thu Jun 09 20:25:38 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
-<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
-<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
-<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
-<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
-<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
-<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
-<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
-<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
-<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
-<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
-<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
-<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
-<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
-<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-client -XX:+UseC1X -XX:+PrintGC -Xms1g -Xmx1g -Xbootclasspath/p:${workspace_loc:hotspot}/../../../maxine/C1X/bin:${workspace_loc:hotspot}/../../../maxine/com.oracle.max.cri/bin:${workspace_loc:hotspot}/../../../maxine/com.oracle.max.base/bin:${workspace_loc:hotspot}/../../../maxine/com.oracle.max.asmdis/bin:${workspace_loc:hotspot}/../HotSpotVM/bin -classpath ${workspace_loc:hotspot}/../HotSpotTest/bin C1XTest"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="java"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="hotspot"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.solaris.base.945602881"/>
-<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/hotspot"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#10;"/>
-</launchConfiguration>
--- a/src/cpu/x86/vm/c1_globals_x86.hpp	Thu Jun 09 20:25:38 2011 +0200
+++ b/src/cpu/x86/vm/c1_globals_x86.hpp	Fri Jun 10 15:01:14 2011 +0200
@@ -40,7 +40,7 @@
 define_pd_global(bool, ProfileTraps,                 false);
 define_pd_global(bool, UseOnStackReplacement,        true );
 define_pd_global(bool, TieredCompilation,            false);
-define_pd_global(intx, CompileThreshold,             10000 );   // changed for GRAAL
+define_pd_global(intx, CompileThreshold,             5000 );   // changed for GRAAL
 define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     933  );
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu Jun 09 20:25:38 2011 +0200
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Jun 10 15:01:14 2011 +0200
@@ -140,6 +140,7 @@
   static int rax_offset_in_bytes(void)    { return BytesPerInt * rax_off; }
   static int rdx_offset_in_bytes(void)    { return BytesPerInt * rdx_off; }
   static int rbx_offset_in_bytes(void)    { return BytesPerInt * rbx_off; }
+  static int r10_offset_in_bytes(void)    { return BytesPerInt * r10_off; }
   static int xmm0_offset_in_bytes(void)   { return BytesPerInt * xmm0_off; }
   static int return_offset_in_bytes(void) { return BytesPerInt * return_off; }
 
@@ -2669,9 +2670,14 @@
   // fetch_unroll_info needs to call last_java_frame()
   __ set_last_Java_frame(noreg, noreg, NULL);
 
+
   //  __ movl(c_rarg1, (int32_t)Deoptimization::Unpack_reexecute);
   //  __ movl(r14, c_rarg1); // save into r14 for later call to unpack_frames
-  __ movl(c_rarg1, (int32_t)-1);
+
+  assert(r10 == rscratch1, "scratch register should be r10");
+  __ movptr(c_rarg1, Address(rsp, RegisterSaver::r10_offset_in_bytes()));
+  __ orq(c_rarg1, ~(int32_t)Deoptimization::make_trap_request(Deoptimization::Reason_unreached, Deoptimization::Action_none));
+  __ notq(c_rarg1);
   __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
   __ mov(c_rarg0, r15_thread);
   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
--- a/src/share/vm/oops/methodOop.cpp	Thu Jun 09 20:25:38 2011 +0200
+++ b/src/share/vm/oops/methodOop.cpp	Fri Jun 10 15:01:14 2011 +0200
@@ -206,6 +206,12 @@
 }
 
 address methodOopDesc::bcp_from(int bci) const {
+#ifdef ASSERT
+  if (!((is_native() && bci == 0)  || (!is_native() && 0 <= bci && bci < code_size()))) {
+    char buf[1024];
+    tty->print_cr("bci: %i, size: %i, method: %s", bci, code_size(), const_cast<methodOop>(this)->name_and_sig_as_C_string(buf, 1024));
+  }
+#endif // ASSERT
   assert((is_native() && bci == 0)  || (!is_native() && 0 <= bci && bci < code_size()), "illegal bci");
   address bcp = code_base() + bci;
   assert(is_native() && bcp == code_base() || contains(bcp), "bcp doesn't belong to this method");