src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IsNullNode.java
equal
deleted
inserted
replaced
39 import org.graalvm.compiler.nodes.ValueNode; |
39 import org.graalvm.compiler.nodes.ValueNode; |
40 import org.graalvm.compiler.nodes.spi.LIRLowerable; |
40 import org.graalvm.compiler.nodes.spi.LIRLowerable; |
41 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; |
41 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; |
42 import org.graalvm.compiler.nodes.spi.Virtualizable; |
42 import org.graalvm.compiler.nodes.spi.Virtualizable; |
43 import org.graalvm.compiler.nodes.spi.VirtualizerTool; |
43 import org.graalvm.compiler.nodes.spi.VirtualizerTool; |
|
44 import org.graalvm.compiler.nodes.type.NarrowOopStamp; |
44 import org.graalvm.compiler.nodes.type.StampTool; |
45 import org.graalvm.compiler.nodes.type.StampTool; |
45 |
46 |
46 import jdk.vm.ci.meta.JavaConstant; |
47 import jdk.vm.ci.meta.JavaConstant; |
47 import jdk.vm.ci.meta.TriState; |
48 import jdk.vm.ci.meta.TriState; |
48 |
49 |
65 assert object != null; |
66 assert object != null; |
66 } |
67 } |
67 |
68 |
68 public IsNullNode(ValueNode object) { |
69 public IsNullNode(ValueNode object) { |
69 this(object, JavaConstant.NULL_POINTER); |
70 this(object, JavaConstant.NULL_POINTER); |
|
71 assertNonNarrow(object); |
70 } |
72 } |
71 |
73 |
72 public JavaConstant nullConstant() { |
74 public JavaConstant nullConstant() { |
73 return nullConstant; |
75 return nullConstant; |
74 } |
76 } |
75 |
77 |
76 public static LogicNode create(ValueNode forValue) { |
78 public static LogicNode create(ValueNode forValue) { |
|
79 assertNonNarrow(forValue); |
77 return canonicalized(null, forValue, JavaConstant.NULL_POINTER); |
80 return canonicalized(null, forValue, JavaConstant.NULL_POINTER); |
|
81 } |
|
82 |
|
83 public static LogicNode create(ValueNode forValue, JavaConstant nullConstant) { |
|
84 assert nullConstant.isNull() : "Null constant is not null: " + nullConstant; |
|
85 return canonicalized(null, forValue, nullConstant); |
|
86 } |
|
87 |
|
88 private static void assertNonNarrow(ValueNode object) { |
|
89 assert !(object.stamp(NodeView.DEFAULT) instanceof NarrowOopStamp) : "Value to compare against null is a NarrowOop" + object; |
78 } |
90 } |
79 |
91 |
80 @Override |
92 @Override |
81 public void generate(NodeLIRBuilderTool gen) { |
93 public void generate(NodeLIRBuilderTool gen) { |
82 // Nothing to do. |
94 // Nothing to do. |