changeset 9647:2adfe940fd55

Make PiNode a guarding node so that it can be used for guarded to guarding edges PiNode should work for non-object values
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 13 May 2013 11:44:49 +0200
parents 183d33c76419
children 309181f26fc7
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Fri May 10 18:28:30 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Mon May 13 11:44:49 2013 +0200
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.nodes;
 
+import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
+import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
@@ -30,7 +32,7 @@
  * A node that changes the type of its input, usually narrowing it. For example, a PI node refines
  * the type of a receiver during type-guarded inlining to be the type tested by the guard.
  */
-public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, Node.IterableNodeType {
+public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, Node.IterableNodeType, GuardingNode {
 
     @Input private ValueNode object;
     @Input private FixedNode anchor;
@@ -52,12 +54,14 @@
 
     @Override
     public void generate(LIRGeneratorTool generator) {
-        generator.setResult(this, generator.operand(object));
+        if (object.kind() != Kind.Void && object.kind() != Kind.Illegal) {
+            generator.setResult(this, generator.operand(object));
+        }
     }
 
     @Override
     public boolean inferStamp() {
-        if (object().objectStamp().alwaysNull() && objectStamp().nonNull()) {
+        if (stamp() instanceof ObjectStamp && object().objectStamp().alwaysNull() && objectStamp().nonNull()) {
             // a null value flowing into a nonNull PiNode should be guarded by a type/isNull guard,
             // but the
             // compiler might see this situation before the branch is deleted