# HG changeset patch # User Thomas Wuerthinger # Date 1309885600 -7200 # Node ID a08723c368c2f94705507da3a37b74a953d15be5 # Parent 5ca1332171c8e67aa458ca08ef3152106a9899c8 Fixed issue that caused deopt on every exception of a top-level method that would have needed to be unwinded. diff -r 5ca1332171c8 -r a08723c368c2 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Tue Jul 05 18:55:22 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Tue Jul 05 19:06:40 2011 +0200 @@ -76,18 +76,15 @@ // replacements.put(duplicate.start(), compilation.graph.start()); // compilation.graph.addDuplicate(duplicate.getNodes(), replacements); // } else { - new GraphBuilderPhase(compilation, compilation.method, false, false).apply(compilation.graph); + new GraphBuilderPhase(compilation, compilation.method, false).apply(compilation.graph); // } - //printGraph("After GraphBuilding", compilation.graph); if (GraalOptions.TestGraphDuplication) { new DuplicationPhase().apply(compilation.graph); - //printGraph("After Duplication", compilation.graph); } new DeadCodeEliminationPhase().apply(compilation.graph); - //printGraph("After DeadCodeElimination", compilation.graph); if (GraalOptions.Inline) { new InliningPhase(compilation, this, null).apply(compilation.graph); @@ -104,9 +101,8 @@ new LoopPhase().apply(graph); } - if (GraalOptions.EscapeAnalysis /*&& compilation.method.toString().contains("simplify")*/) { + if (GraalOptions.EscapeAnalysis) { new EscapeAnalysisPhase(compilation, this).apply(graph); - // new DeadCodeEliminationPhase().apply(graph); new CanonicalizerPhase().apply(graph); new DeadCodeEliminationPhase().apply(graph); } diff -r 5ca1332171c8 -r a08723c368c2 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Tue Jul 05 18:55:22 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Tue Jul 05 19:06:40 2011 +0200 @@ -106,8 +106,6 @@ private final Set blocksOnWorklist = new HashSet(); private final Set blocksVisited = new HashSet(); - private final boolean createUnwind; - public static final Map cachedGraphs = new WeakHashMap(); /** @@ -117,7 +115,7 @@ * @param ir the IR to build the graph into * @param graph */ - public GraphBuilderPhase(GraalCompilation compilation, RiMethod method, boolean createUnwind, boolean inline) { + public GraphBuilderPhase(GraalCompilation compilation, RiMethod method, boolean inline) { super(inline ? "BuildInlineGraph " + method.holder().name() + "." + method.name() + method.signature().asString() : "BuildGraph"); this.compilation = compilation; @@ -128,7 +126,6 @@ this.stream = new BytecodeStream(method.code()); this.constantPool = runtime.getConstantPool(method); - this.createUnwind = createUnwind; this.storeResultGraph = GraalOptions.CacheGraphs; } @@ -178,19 +175,11 @@ // 4A.1 add a monitor enter to the start block methodSynchronizedObject = synchronizedObject(frameState, method); genMonitorEnter(methodSynchronizedObject, FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI); - // 4A.2 finish the start block - finishStartBlock(startBlock); + } - // 4A.3 setup an exception handler to unlock the root method synchronized object - unwindHandler = new CiExceptionHandler(0, method.code().length, FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI, 0, null); - } else { - // 4B.1 simply finish the start block - finishStartBlock(startBlock); - - if (createUnwind) { - unwindHandler = new CiExceptionHandler(0, method.code().length, FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI, 0, null); - } - } + // 4B.1 simply finish the start block + finishStartBlock(startBlock); + unwindHandler = new CiExceptionHandler(0, method.code().length, FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI, 0, null); // 5. SKIPPED: look for intrinsics @@ -970,6 +959,9 @@ Invoke invoke = new Invoke(bci(), opcode, resultType.stackKind(), args, target, target.signature().returnType(method.holder()), graph); Value result = appendWithBCI(invoke); invoke.setExceptionEdge(handleException(null, bci())); + if (invoke.exceptionEdge() == null) { + TTY.println("no exception edge" + unwindHandler); + } frameState.pushReturn(resultType, result); } } diff -r 5ca1332171c8 -r a08723c368c2 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Tue Jul 05 18:55:22 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Tue Jul 05 19:06:40 2011 +0200 @@ -358,7 +358,7 @@ TTY.println("Building graph for %s, locals: %d, stack: %d", methodName(method, invoke), method.maxLocals(), method.maxStackSize()); } graph = new CompilerGraph(null); - new GraphBuilderPhase(compilation, method, true, true).apply(graph); + new GraphBuilderPhase(compilation, method, true).apply(graph); } invoke.inputs().clearAll();