50 public static final NodeClass<IdentityHashCodeNode> TYPE = NodeClass.create(IdentityHashCodeNode.class);
51
52 @Input ValueNode object;
53
54 public IdentityHashCodeNode(ValueNode object) {
55 super(TYPE, StampFactory.forInteger(32));
56 this.object = object;
57
58 }
59
60 @Override
61 public LocationIdentity getLocationIdentity() {
62 return HotSpotReplacementsUtil.MARK_WORD_LOCATION;
63 }
64
65 @Override
66 public Node canonical(CanonicalizerTool tool) {
67 if (object.isConstant()) {
68 assert object.stamp() instanceof AbstractObjectStamp;
69 JavaConstant c = (JavaConstant) object.asConstant();
70 if (ImmutableCode.getValue()) {
71 return this;
72 }
73 JavaConstant identityHashCode = null;
74 if (c.isNull()) {
75 identityHashCode = JavaConstant.forInt(0);
76 } else {
77 identityHashCode = JavaConstant.forInt(((HotSpotObjectConstant) c).getIdentityHashCode());
78 }
79
80 return new ConstantNode(identityHashCode, StampFactory.forConstant(identityHashCode));
81 }
82 return this;
83 }
84
85 @Override
86 public void lower(LoweringTool tool) {
87 tool.getLowerer().lower(this, tool);
88 }
89
90 @NodeIntrinsic
|
50 public static final NodeClass<IdentityHashCodeNode> TYPE = NodeClass.create(IdentityHashCodeNode.class);
51
52 @Input ValueNode object;
53
54 public IdentityHashCodeNode(ValueNode object) {
55 super(TYPE, StampFactory.forInteger(32));
56 this.object = object;
57
58 }
59
60 @Override
61 public LocationIdentity getLocationIdentity() {
62 return HotSpotReplacementsUtil.MARK_WORD_LOCATION;
63 }
64
65 @Override
66 public Node canonical(CanonicalizerTool tool) {
67 if (object.isConstant()) {
68 assert object.stamp() instanceof AbstractObjectStamp;
69 JavaConstant c = (JavaConstant) object.asConstant();
70 if (ImmutableCode.getValue(getOptions())) {
71 return this;
72 }
73 JavaConstant identityHashCode = null;
74 if (c.isNull()) {
75 identityHashCode = JavaConstant.forInt(0);
76 } else {
77 identityHashCode = JavaConstant.forInt(((HotSpotObjectConstant) c).getIdentityHashCode());
78 }
79
80 return new ConstantNode(identityHashCode, StampFactory.forConstant(identityHashCode));
81 }
82 return this;
83 }
84
85 @Override
86 public void lower(LoweringTool tool) {
87 tool.getLowerer().lower(this, tool);
88 }
89
90 @NodeIntrinsic
|