< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/PiNode.java

Print this page

        

*** 57,74 **** * A node that changes the type of its input, usually narrowing it. For example, a {@link PiNode} * refines the type of a receiver during type-guarded inlining to be the type tested by the guard. * * In contrast to a {@link GuardedValueNode}, a {@link PiNode} is useless as soon as the type of its * input is as narrow or narrower than the {@link PiNode}'s type. The {@link PiNode}, and therefore ! * also the scheduling restriction enforced by the anchor, will go away. */ @NodeInfo(cycles = CYCLES_0, size = SIZE_0) public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy { public static final NodeClass<PiNode> TYPE = NodeClass.create(PiNode.class); @Input ValueNode object; ! protected final Stamp piStamp; public ValueNode object() { return object; } --- 57,74 ---- * A node that changes the type of its input, usually narrowing it. For example, a {@link PiNode} * refines the type of a receiver during type-guarded inlining to be the type tested by the guard. * * In contrast to a {@link GuardedValueNode}, a {@link PiNode} is useless as soon as the type of its * input is as narrow or narrower than the {@link PiNode}'s type. The {@link PiNode}, and therefore ! * also the scheduling restriction enforced by the guard, will go away. */ @NodeInfo(cycles = CYCLES_0, size = SIZE_0) public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy { public static final NodeClass<PiNode> TYPE = NodeClass.create(PiNode.class); @Input ValueNode object; ! protected Stamp piStamp; public ValueNode object() { return object; }
*** 82,97 **** public PiNode(ValueNode object, Stamp stamp) { this(object, stamp, null); } ! public PiNode(ValueNode object, Stamp stamp, ValueNode anchor) { ! this(TYPE, object, stamp, (GuardingNode) anchor); } ! public PiNode(ValueNode object, ValueNode anchor) { ! this(object, AbstractPointerStamp.pointerNonNull(object.stamp()), anchor); } public PiNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { this(object, StampFactory.object(exactType ? TypeReference.createExactTrusted(toType) : TypeReference.createWithoutAssumptions(toType), nonNull || StampTool.isPointerNonNull(object.stamp()))); } --- 82,97 ---- public PiNode(ValueNode object, Stamp stamp) { this(object, stamp, null); } ! public PiNode(ValueNode object, Stamp stamp, ValueNode guard) { ! this(TYPE, object, stamp, (GuardingNode) guard); } ! public PiNode(ValueNode object, ValueNode guard) { ! this(object, AbstractPointerStamp.pointerNonNull(object.stamp()), guard); } public PiNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { this(object, StampFactory.object(exactType ? TypeReference.createExactTrusted(toType) : TypeReference.createWithoutAssumptions(toType), nonNull || StampTool.isPointerNonNull(object.stamp()))); }
*** 102,134 **** return value; } return new PiNode(object, stamp); } ! public static ValueNode create(ValueNode object, Stamp stamp, ValueNode anchor) { ! ValueNode value = canonical(object, stamp, (GuardingNode) anchor); if (value != null) { return value; } ! return new PiNode(object, stamp, anchor); } ! public static ValueNode create(ValueNode object, ValueNode anchor) { Stamp stamp = AbstractPointerStamp.pointerNonNull(object.stamp()); ! ValueNode value = canonical(object, stamp, (GuardingNode) anchor); if (value != null) { return value; } ! return new PiNode(object, stamp, anchor); } @SuppressWarnings("unused") ! public static boolean intrinsify(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode object, ValueNode anchor) { Stamp stamp = AbstractPointerStamp.pointerNonNull(object.stamp()); ! ValueNode value = canonical(object, stamp, (GuardingNode) anchor); if (value == null) { ! value = new PiNode(object, stamp, anchor); } b.push(JavaKind.Object, b.append(value)); return true; } --- 102,134 ---- return value; } return new PiNode(object, stamp); } ! public static ValueNode create(ValueNode object, Stamp stamp, ValueNode guard) { ! ValueNode value = canonical(object, stamp, (GuardingNode) guard); if (value != null) { return value; } ! return new PiNode(object, stamp, guard); } ! public static ValueNode create(ValueNode object, ValueNode guard) { Stamp stamp = AbstractPointerStamp.pointerNonNull(object.stamp()); ! ValueNode value = canonical(object, stamp, (GuardingNode) guard); if (value != null) { return value; } ! return new PiNode(object, stamp, guard); } @SuppressWarnings("unused") ! public static boolean intrinsify(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode object, ValueNode guard) { Stamp stamp = AbstractPointerStamp.pointerNonNull(object.stamp()); ! ValueNode value = canonical(object, stamp, (GuardingNode) guard); if (value == null) { ! value = new PiNode(object, stamp, guard); } b.push(JavaKind.Object, b.append(value)); return true; }
*** 145,154 **** --- 145,159 ---- public final Stamp piStamp() { return piStamp; } + public void strengthenPiStamp(Stamp newPiStamp) { + assert this.piStamp.join(newPiStamp).equals(newPiStamp) : "stamp can only improve"; + this.piStamp = newPiStamp; + } + @Override public void generate(NodeLIRBuilderTool generator) { if (generator.hasOperand(object)) { generator.setResult(this, generator.operand(object)); }
*** 254,274 **** @NodeIntrinsic(PiNode.Placeholder.class) public static native Object piCastToSnippetReplaceeStamp(Object object); /** * Changes the stamp of an object and ensures the newly stamped value is non-null and does not ! * float above a given anchor. */ @NodeIntrinsic ! public static native Object piCastNonNull(Object object, GuardingNode anchor); /** * Changes the stamp of an object and ensures the newly stamped value is non-null and does not ! * float above a given anchor. */ @NodeIntrinsic ! public static native Class<?> piCastNonNullClass(Class<?> type, GuardingNode anchor); /** * Changes the stamp of an object to represent a given type and to indicate that the object is * not null. */ --- 259,279 ---- @NodeIntrinsic(PiNode.Placeholder.class) public static native Object piCastToSnippetReplaceeStamp(Object object); /** * Changes the stamp of an object and ensures the newly stamped value is non-null and does not ! * float above a given guard. */ @NodeIntrinsic ! public static native Object piCastNonNull(Object object, GuardingNode guard); /** * Changes the stamp of an object and ensures the newly stamped value is non-null and does not ! * float above a given guard. */ @NodeIntrinsic ! public static native Class<?> piCastNonNullClass(Class<?> type, GuardingNode guard); /** * Changes the stamp of an object to represent a given type and to indicate that the object is * not null. */
< prev index next >