# HG changeset patch # User Thomas Wuerthinger # Date 1379354007 -7200 # Node ID 8e1e41cd2c7505865a0f78679ff2e5b5dc07fd30 # Parent 3967f9f306f8d3d495b16c3cda0b3fe65e1603f3 Common out code for frame state constructors. diff -r 3967f9f306f8 -r 8e1e41cd2c75 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Mon Sep 16 15:35:14 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Mon Sep 16 19:53:27 2013 +0200 @@ -103,7 +103,6 @@ public FrameState(ResolvedJavaMethod method, int bci, List values, int localsSize, int stackSize, boolean rethrowException, boolean duringCall, List virtualObjectMappings) { assert stackSize >= 0; - assert (bci >= 0 && method != null) || (bci < 0 && method == null && values.isEmpty()); this.method = method; this.bci = bci; this.localsSize = localsSize; @@ -125,29 +124,24 @@ } public FrameState(ResolvedJavaMethod method, int bci, ValueNode[] locals, List stack, ValueNode[] locks, boolean rethrowException, boolean duringCall) { - this.method = method; - this.bci = bci; - this.localsSize = locals.length; - this.stackSize = stack.size(); - final ValueNode[] newValues = new ValueNode[locals.length + stack.size() + locks.length]; - int pos = 0; + this(method, bci, createValues(locals, stack, locks), locals.length, stack.size(), rethrowException, duringCall, Collections. emptyList()); + } + + private static List createValues(ValueNode[] locals, List stack, ValueNode[] locks) { + List newValues = new ArrayList<>(locals.length + stack.size() + locks.length); for (ValueNode value : locals) { - newValues[pos++] = value; + newValues.add(value); + assert value == null || value.isAlive(); } for (ValueNode value : stack) { - newValues[pos++] = value; + newValues.add(value); + assert value == null || value.isAlive(); } for (ValueNode value : locks) { - newValues[pos++] = value; - } - for (ValueNode value : newValues) { + newValues.add(value); assert value == null || value.isAlive(); } - this.values = new NodeInputList<>(this, newValues); - this.virtualObjectMappings = new NodeInputList<>(this); - this.rethrowException = rethrowException; - this.duringCall = duringCall; - assert !rethrowException || stackSize == 1 : "must have exception on top of the stack"; + return newValues; } public NodeInputList values() {