Mercurial > hg > truffle
diff graal/GraalCompiler/src/com/sun/c1x/value/FrameStateBuilder.java @ 2616:3558ca7088c0
FrameState and Graphviz changes:
* removed popx, pushx methods from GraphBuilder
* FrameState subclass of Value
* added String shortName() to Node
* added GraphvizPrinter option to use short names
* small hack in GraphvizPrinter: omit FrameState->Local connections
* added GraalGraphviz to implicit classpatch (read from GRAAL env var)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 09 May 2011 17:00:25 +0200 |
parents | bd235cb4375a |
children | 8c02ca1e9eb1 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameStateBuilder.java Mon May 09 14:11:13 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameStateBuilder.java Mon May 09 17:00:25 2011 +0200 @@ -34,7 +34,7 @@ import static java.lang.reflect.Modifier.*; -public class FrameStateBuilder { +public class FrameStateBuilder implements FrameStateAccess { private final Graph graph; @@ -75,12 +75,16 @@ } public void initializeFrom(FrameState other) { - assert locals.length == other.localsSize; + assert locals.length == other.localsSize(); assert stack.length >= other.stackSize(); this.stackIndex = other.stackSize(); - System.arraycopy(other.values, 0, locals, 0, locals.length); - System.arraycopy(other.values, other.localsSize(), stack, 0, stackIndex); + for (int i = 0; i < other.localsSize(); i++) { + locals[i] = other.localAt(i); + } + for (int i = 0; i < other.stackSize(); i++) { + stack[i] = other.stackAt(i); + } locks.clear(); for (int i = 0; i < other.locksSize(); i++) { locks.add(other.lockAt(i)); @@ -88,7 +92,7 @@ } public FrameState create(int bci) { - return new FrameState(bci, locals, stack, stackIndex, locks); + return new FrameState(bci, locals, stack, stackIndex, locks, graph); } /** @@ -171,6 +175,12 @@ xpush(null); } + public void pushReturn(CiKind kind, Value x) { + if (kind != CiKind.Void) { + push(kind.stackKind(), x); + } + } + /** * Pops an instruction off the stack with the expected type. * @param kind the expected type @@ -265,6 +275,16 @@ return r; } + public CiKind peekKind() { + Value top = stackAt(stackSize() - 1); + if (top == null) { + top = stackAt(stackSize() - 2); + assert top != null; + assert top.kind.isDoubleWord(); + } + return top.kind; + } + /** * Truncates this stack to the specified size. * @param size the size to truncate to @@ -434,4 +454,21 @@ } + + @Override + public FrameState duplicate() { + return create(-1); + } + + @Override + public Value valueAt(int i) { + if (i < locals.length) { + return locals[i]; + } else if (i < locals.length + stackIndex) { + return stack[i - locals.length]; + } else { + return locks.get(i - locals.length - stack.length); + } + } + }