# HG changeset patch # User Gilles Duboscq # Date 1306766465 -7200 # Node ID 244921d7cf50ab76cc81ac4626207ccefa845156 # Parent ac4b086cbd728373415e7322aae853c326f59470# Parent 2b8ef0a0639153c66327ec4503e62559e1559740 Merge diff -r ac4b086cbd72 -r 244921d7cf50 graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Mon May 30 16:35:08 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Mon May 30 16:41:05 2011 +0200 @@ -60,25 +60,6 @@ */ public static final int TRACELEVEL_STATE = 2; - /** - * An enumeration of flags describing scope attributes. - */ - public enum Flag { - /** - * Scope is protected by an exception handler. - * This attribute is inherited by nested scopes. - */ - HasHandler, - - /** - * Code in scope cannot contain safepoints. - * This attribute is inherited by nested scopes. - */ - NoSafepoints; - - public final int mask = 1 << ordinal(); - } - private final IR ir; private final C1XCompilation compilation; private final CiStatistics stats; @@ -98,11 +79,6 @@ } }); - /** - * Mask of {@link Flag} values. - */ - private int flags; - // Exception handler list private List exceptionHandlers; @@ -115,8 +91,6 @@ private final Graph graph; - private Merge unwindBlock; - /** * Creates a new, initialized, {@code GraphBuilder} instance for a given compilation. * @@ -147,10 +121,6 @@ log.println("Compiling " + compilation.method); } - if (rootMethod.noSafepoints()) { - flags |= Flag.NoSafepoints.mask; - } - // 2. compute the block map, setup exception handlers and get the entrypoint(s) BlockMap blockMap = compilation.getBlockMap(rootMethod); @@ -178,8 +148,6 @@ exceptionHandlers.add(h); } } - flags |= Flag.HasHandler.mask; - } // 1. create the start block @@ -298,8 +266,6 @@ FrameState existingState = ((StateSplit) first).stateBefore(); if (existingState == null) { -// assert first instanceof Merge ^ !target.isLoopHeader : "isLoopHeader: " + target.isLoopHeader; - // copy state because it is modified FrameState duplicate = newState.duplicate(bci); @@ -423,13 +389,12 @@ StateSplit entry = new Placeholder(graph); entry.setStateBefore(entryState); ExceptionObject exception = new ExceptionObject(graph); - entry.appendNext(exception); + entry.setNext(exception); FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, exception); Instruction successor = createTarget(dispatchBlock, stateWithException); Anchor end = new Anchor(successor, graph); - exception.appendNext(end); - + exception.setNext(end); if (x instanceof Invoke) { ((Invoke) x).setExceptionEdge(entry); } else { @@ -1044,15 +1009,11 @@ } private Value appendWithBCI(Instruction x) { - if (x.isAppended()) { - // the instruction has already been added - return x; - } + assert x.next() == null && x.predecessors().size() == 0 : "instruction should not have been appended yet"; + assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; + lastInstr.setNext(x); - assert x.next() == null : "instruction should not have been appended yet"; - assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; - - lastInstr = lastInstr.appendNext(x); + lastInstr = x; if (++stats.nodeCount >= C1XOptions.MaximumInstructionCount) { // bailout if we've exceeded the maximum inlining size throw new CiBailout("Method and/or inlining is too large"); @@ -1115,12 +1076,7 @@ assert lock != null; assert frameState.locksSize() > 0 && frameState.lockAt(frameState.locksSize() - 1) == lock; - if (lock instanceof Instruction) { - Instruction l = (Instruction) lock; - if (!l.isAppended()) { - lock = appendWithBCI(l); - } - } + // Exit the monitor and unwind the stack. genMonitorExit(lock); append(new Unwind(frameState.apop(), graph)); @@ -1211,13 +1167,7 @@ } private void appendGoto(Instruction target) { - //if (target instanceof BlockBegin && !((BlockBegin)target).isLoopHeader) { - // System.out.println("NOTOMITTED"); - //append(new Goto(target, graph)); - //} else { - // System.out.println("omitted"); - lastInstr.appendNext(target); - //} + lastInstr.setNext(target); } private void iterateBytecodesForBlock(Block block) { @@ -1526,7 +1476,6 @@ exceptionHandlers = new ArrayList(); } exceptionHandlers.add(handler); - flags |= Flag.HasHandler.mask; } /** @@ -1561,13 +1510,6 @@ * @return {@code true} if there are any exception handlers */ private boolean hasHandler() { - return (flags & Flag.HasHandler.mask) != 0; - } - - /** - * Checks whether this graph can contain safepoints. - */ - private boolean noSafepoints() { - return (flags & Flag.NoSafepoints.mask) != 0; + return Modifier.isSynchronized(compilation.method.accessFlags()) || (compilation.method.exceptionHandlers() != null && compilation.method.exceptionHandlers().length > 0); } } diff -r ac4b086cbd72 -r 244921d7cf50 graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java Mon May 30 16:35:08 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java Mon May 30 16:41:05 2011 +0200 @@ -66,7 +66,7 @@ return (Instruction) successors().get(super.successorCount() + SUCCESSOR_NEXT); } - private Node setNext(Instruction next) { + public Node setNext(Instruction next) { return successors().set(super.successorCount() + SUCCESSOR_NEXT, next); } @@ -77,8 +77,6 @@ public static final int SYNCHRONIZATION_ENTRY_BCI = -1; - private boolean isAppended = false; - /** * Constructs a new instruction with the specified value type. * @param kind the value type for this instruction @@ -90,30 +88,6 @@ C1XMetrics.HIRInstructions++; } - /** - * Checks whether this instruction has already been added to its basic block. - * @return {@code true} if this instruction has been added to the basic block containing it - */ - public final boolean isAppended() { - return isAppended; - } - - - /** - * Sets the next instruction for this instruction. Note that it is illegal to - * set the next field of a phi, block end, or local instruction. - * @param next the next instruction - * @param bci the bytecode index of the next instruction - * @return the new next instruction - */ - public final Instruction appendNext(Instruction next) { - setNext(next); - if (next != null) { - //assert !(this instanceof BlockEnd); - next.isAppended = true; - } - return next; - } /** * Gets the list of predecessors of this block. @@ -121,11 +95,7 @@ */ @SuppressWarnings({ "unchecked", "rawtypes" }) public List blockPredecessors() { - /*if (predecessors().size() == 1 && predecessors().get(0) == graph().start()) { - return Collections.EMPTY_LIST; - } else {)*/ - return (List) Collections.unmodifiableList(predecessors()); - //} + return (List) Collections.unmodifiableList(predecessors()); } /** @@ -133,12 +103,7 @@ * @return the number of predecessors */ public int numberOfPreds() { - // ignore the graph root - /*if (predecessors().size() == 1 && predecessors().get(0) == graph().start()) { - return 0; - } else {*/ - return predecessors().size(); - //} + return predecessors().size(); } public Instruction predAt(int j) { diff -r ac4b086cbd72 -r 244921d7cf50 rundacapo.sh --- a/rundacapo.sh Mon May 30 16:35:08 2011 +0200 +++ b/rundacapo.sh Mon May 30 16:41:05 2011 +0200 @@ -15,4 +15,4 @@ echo "DACAPO is not defined. It must point to a Dacapo benchmark directory." exit 1; fi -${JDK7}/bin/java -client -d64 -graal -XX:-C1XBailoutIsFatal -XX:+PrintCompilation -C1X:+QuietBailout -Xms1g -Xmx2g -esa -classpath ${DACAPO}/dacapo-9.12-bach.jar Harness $* +${JDK7}/bin/java -client -d64 -graal -XX:+C1XBailoutIsFatal -XX:+PrintCompilation -C1X:-QuietBailout -Xms1g -Xmx2g -esa -classpath ${DACAPO}/dacapo-9.12-bach.jar Harness $*