Mercurial > hg > graal-jvmci-8
diff graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java @ 2824:244921d7cf50
Merge
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Mon, 30 May 2011 16:41:05 +0200 |
parents | ac4b086cbd72 2b8ef0a06391 |
children | 9ba6a8abe894 |
line wrap: on
line diff
--- 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<ExceptionHandler> 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<ExceptionHandler>(); } 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); } }