changeset 21445:567fd5394b80

NodeLIRBuilder#getExactPhiKind: handle non-java constants.
author Josef Eisl <josef.eisl@jku.at>
date Thu, 21 May 2015 11:51:32 +0200
parents 0ad4c6aa8063
children 43462ed89797
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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<Value> values = new ArrayList<>(phi.valueCount());
+        // TODO (je): maybe turn this into generator-style instead of allocating an ArrayList.
+        ArrayList<LIRKind> 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;
     }