# HG changeset patch # User Gilles Duboscq # Date 1368438289 -7200 # Node ID 2adfe940fd55ddc309c7ba3579aa90fa7e4cfdea # Parent 183d33c76419d2bf9b7f62f96c127c130332d885 Make PiNode a guarding node so that it can be used for guarded to guarding edges PiNode should work for non-object values diff -r 183d33c76419 -r 2adfe940fd55 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java --- 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