changeset 3023:79165996a12d

Fixed an issue with bci=-1 in the framestate of a merged unwind.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 20 Jun 2011 12:07:16 +0200
parents 49fae83f066e
children abcc480f3bd5 94f3ffcc5c2a 5f417a4a944a
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.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/phases/GraphBuilderPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java src/share/vm/runtime/deoptimization.cpp src/share/vm/runtime/deoptimization.hpp
diffstat 8 files changed, 18 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Sat Jun 18 21:44:57 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Mon Jun 20 12:07:16 2011 +0200
@@ -38,7 +38,7 @@
 
     // inlining settings
     public static boolean Inline                             = true;
-    public static boolean StoreResultGraph                   = ____;
+    public static boolean CacheGraphs                        = ____;
     public static boolean InlineWithTypeCheck                = ____;
     public static int     MaximumInstructionCount            = 37000;
     public static float   MaximumInlineRatio                 = 0.90f;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java	Sat Jun 18 21:44:57 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java	Mon Jun 20 12:07:16 2011 +0200
@@ -118,6 +118,7 @@
             schedule.apply(graph);
         } catch (Throwable t) {
             // nothing to do here...
+            t.printStackTrace();
         }
 
         stream.println("  <nodes>");
@@ -236,9 +237,6 @@
                 }
                 if (node instanceof Merge) {
                     Merge merge = (Merge) node;
-                    if (merge.stateAfter() != null) {
-                        nodes.add(merge.stateAfter());
-                    }
                     for (Node usage : merge.usages()) {
                         if (usage instanceof Phi || usage instanceof LoopCounter) {
                             nodes.add(usage);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java	Sat Jun 18 21:44:57 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java	Mon Jun 20 12:07:16 2011 +0200
@@ -94,10 +94,6 @@
             //printGraph("After Ininling", compilation.graph);
         }
 
-        if (GraalOptions.Time) {
-            GraalTimers.COMPUTE_LINEAR_SCAN_ORDER.start();
-        }
-
         Graph graph = compilation.graph;
 
         if (GraalOptions.OptCanonicalizer) {
@@ -149,6 +145,11 @@
         assert startBlock != null;
         assert startBlock.blockPredecessors().size() == 0;
 
+
+        if (GraalOptions.Time) {
+            GraalTimers.COMPUTE_LINEAR_SCAN_ORDER.start();
+        }
+
         ComputeLinearScanOrder clso = new ComputeLinearScanOrder(lirBlocks.size(), startBlock);
         orderedBlocks = clso.linearScanOrder();
         this.compilation.stats.loopCount = clso.numLoops();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java	Sat Jun 18 21:44:57 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java	Mon Jun 20 12:07:16 2011 +0200
@@ -39,7 +39,6 @@
         InvalidateReprofile,            // invalidate the nmethod, reset IC, maybe recompile
         InvalidateRecompile,            // invalidate the nmethod, recompile (probably)
         InvalidateStopCompiling,        // invalidate the nmethod and do not compile
-        RethrowExceptionInInterpreter,
     }
 
     private String message;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Sat Jun 18 21:44:57 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Mon Jun 20 12:07:16 2011 +0200
@@ -86,7 +86,7 @@
     private Value methodSynchronizedObject;
     private CiExceptionHandler unwindHandler;
 
-    private Block unwindBlock;
+    private ExceptionBlock unwindBlock;
     private Block returnBlock;
 
     private boolean storeResultGraph;
@@ -126,7 +126,7 @@
 
         this.constantPool = runtime.getConstantPool(method);
         this.createUnwind = createUnwind;
-        this.storeResultGraph = GraalOptions.StoreResultGraph;
+        this.storeResultGraph = GraalOptions.CacheGraphs;
     }
 
     @Override
@@ -236,11 +236,12 @@
         return block;
     }
 
-    private Block unwindBlock() {
+    private Block unwindBlock(int bci) {
         if (unwindBlock == null) {
-            unwindBlock = new Block();
-            unwindBlock.startBci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
-            unwindBlock.endBci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
+            unwindBlock = new ExceptionBlock();
+            unwindBlock.startBci = -1;
+            unwindBlock.endBci = -1;
+            unwindBlock.deoptBci = bci;
             unwindBlock.blockID = nextBlockNumber();
             addToWorkList(unwindBlock);
         }
@@ -417,7 +418,7 @@
                 assert isCatchAll(firstHandler);
                 int handlerBCI = firstHandler.handlerBCI();
                 if (handlerBCI == Instruction.SYNCHRONIZATION_ENTRY_BCI) {
-                    dispatchBlock = unwindBlock();
+                    dispatchBlock = unwindBlock(bci);
                 } else {
                     dispatchBlock = blockFromBci[handlerBCI];
                 }
@@ -718,7 +719,7 @@
         } else {
             frameState.clearStack();
             frameState.apush(exception);
-            appendGoto(createTarget(unwindBlock(), frameState));
+            appendGoto(createTarget(unwindBlock(bci), frameState));
         }
     }
 
@@ -1287,17 +1288,15 @@
         } else {
             assert frameState.stackSize() == 1 : frameState;
 
-            Block nextBlock = block.next == null ? unwindBlock() : block.next;
+            Block nextBlock = block.next == null ? unwindBlock(block.deoptBci) : block.next;
             if (block.handler.catchType().isResolved()) {
                 FixedNode catchSuccessor = createTarget(blockFromBci[block.handler.handlerBCI()], frameState);
                 FixedNode nextDispatch = createTarget(nextBlock, frameState);
                 append(new ExceptionDispatch(frameState.stackAt(0), catchSuccessor, nextDispatch, block.handler.catchType(), graph));
             } else {
-                Deoptimize deopt = new Deoptimize(DeoptAction.RethrowExceptionInInterpreter, graph);
+                Deoptimize deopt = new Deoptimize(DeoptAction.InvalidateRecompile, graph);
                 deopt.setMessage("unresolved " + block.handler.catchType().name());
                 append(deopt);
-//                FixedNode nextDispatch = createTarget(nextBlock, frameState);
-//                appendGoto(nextDispatch);
             }
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Sat Jun 18 21:44:57 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Mon Jun 20 12:07:16 2011 +0200
@@ -2087,9 +2087,6 @@
             case InvalidateStopCompiling:
                 code = 4;
                 break;
-            case RethrowExceptionInInterpreter:
-                code = 5;
-                break;
             default:
                 throw Util.shouldNotReachHere();
         }
--- a/src/share/vm/runtime/deoptimization.cpp	Sat Jun 18 21:44:57 2011 +0200
+++ b/src/share/vm/runtime/deoptimization.cpp	Mon Jun 20 12:07:16 2011 +0200
@@ -1417,7 +1417,6 @@
       reprofile = true;
       break;
     case Action_make_not_entrant:
-    case Action_rethrow_exception_in_interpreter:
       // Request immediate recompilation, and get rid of the old code.
       // Make them not entrant, so next time they are called they get
       // recompiled.  Unloaded classes are loaded now so recompile before next
--- a/src/share/vm/runtime/deoptimization.hpp	Sat Jun 18 21:44:57 2011 +0200
+++ b/src/share/vm/runtime/deoptimization.hpp	Mon Jun 20 12:07:16 2011 +0200
@@ -72,7 +72,6 @@
     Action_reinterpret,           // invalidate the nmethod, reset IC, maybe recompile
     Action_make_not_entrant,      // invalidate the nmethod, recompile (probably)
     Action_make_not_compilable,   // invalidate the nmethod and do not compile
-    Action_rethrow_exception_in_interpreter,
     Action_LIMIT
     // Note:  Keep this enum in sync. with _trap_action_name.
   };