# HG changeset patch # User Josef Eisl # Date 1432201892 -7200 # Node ID 567fd5394b8079cc4eb81c4868c5ba2f64e2472f # Parent 0ad4c6aa80638901ef6864f921037564436651ba NodeLIRBuilder#getExactPhiKind: handle non-java constants. diff -r 0ad4c6aa8063 -r 567fd5394b80 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Thu May 21 11:50:38 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Thu May 21 11:51:32 2015 +0200 @@ -195,17 +195,21 @@ } protected LIRKind getExactPhiKind(PhiNode phi) { - ArrayList values = new ArrayList<>(phi.valueCount()); + // TODO (je): maybe turn this into generator-style instead of allocating an ArrayList. + ArrayList values = new ArrayList<>(phi.valueCount()); for (int i = 0; i < phi.valueCount(); i++) { ValueNode node = phi.valueAt(i); Value value = node instanceof ConstantNode ? ((ConstantNode) node).asJavaConstant() : getOperand(node); if (value != null) { - values.add(value); + values.add(value.getLIRKind()); } else { - assert isPhiInputFromBackedge(phi, i) : String.format("Input %s to phi node %s is not yet available although it is not coming from a loop back edge", node, phi); + assert node instanceof ConstantNode || isPhiInputFromBackedge(phi, i) : String.format("Input %s to phi node %s is not yet available although it is not coming from a loop back edge", + node, phi); + // non-java constant -> get Kind from stamp. + values.add(getLIRGeneratorTool().getLIRKind(node.stamp())); } } - LIRKind derivedKind = LIRKind.merge(values.toArray(new Value[values.size()])); + LIRKind derivedKind = LIRKind.merge(values); assert verifyPHIKind(derivedKind, gen.getLIRKind(phi.stamp())); return derivedKind; }