54 @NodeInfo(cycles = CYCLES_1, size = SIZE_1)
55 public final class HubGetClassNode extends FloatingNode implements Lowerable, Canonicalizable, ConvertNode {
56 public static final NodeClass<HubGetClassNode> TYPE = NodeClass.create(HubGetClassNode.class);
57 @Input protected ValueNode hub;
58
59 public HubGetClassNode(@InjectedNodeParameter MetaAccessProvider metaAccess, ValueNode hub) {
60 super(TYPE, StampFactory.objectNonNull(TypeReference.createWithoutAssumptions(metaAccess.lookupJavaType(Class.class))));
61 this.hub = hub;
62 }
63
64 public ValueNode getHub() {
65 return hub;
66 }
67
68 @Override
69 public Node canonical(CanonicalizerTool tool) {
70 if (tool.allUsagesAvailable() && hasNoUsages()) {
71 return null;
72 } else {
73 MetaAccessProvider metaAccess = tool.getMetaAccess();
74 if (metaAccess != null && hub.isConstant() && !GraalOptions.ImmutableCode.getValue(graph().getOptions())) {
75 ResolvedJavaType exactType = tool.getConstantReflection().asJavaType(hub.asConstant());
76 if (exactType != null) {
77 return ConstantNode.forConstant(tool.getConstantReflection().asJavaClass(exactType), metaAccess);
78 }
79 }
80 return this;
81 }
82 }
83
84 @Override
85 public void lower(LoweringTool tool) {
86 tool.getLowerer().lower(this, tool);
87 }
88
89 @NodeIntrinsic
90 public static native Class<?> readClass(KlassPointer hub);
91
92 @Override
93 public ValueNode getValue() {
94 return hub;
|
54 @NodeInfo(cycles = CYCLES_1, size = SIZE_1)
55 public final class HubGetClassNode extends FloatingNode implements Lowerable, Canonicalizable, ConvertNode {
56 public static final NodeClass<HubGetClassNode> TYPE = NodeClass.create(HubGetClassNode.class);
57 @Input protected ValueNode hub;
58
59 public HubGetClassNode(@InjectedNodeParameter MetaAccessProvider metaAccess, ValueNode hub) {
60 super(TYPE, StampFactory.objectNonNull(TypeReference.createWithoutAssumptions(metaAccess.lookupJavaType(Class.class))));
61 this.hub = hub;
62 }
63
64 public ValueNode getHub() {
65 return hub;
66 }
67
68 @Override
69 public Node canonical(CanonicalizerTool tool) {
70 if (tool.allUsagesAvailable() && hasNoUsages()) {
71 return null;
72 } else {
73 MetaAccessProvider metaAccess = tool.getMetaAccess();
74 if (metaAccess != null && hub.isConstant() && !GraalOptions.ImmutableCode.getValue(tool.getOptions())) {
75 ResolvedJavaType exactType = tool.getConstantReflection().asJavaType(hub.asConstant());
76 if (exactType != null) {
77 return ConstantNode.forConstant(tool.getConstantReflection().asJavaClass(exactType), metaAccess);
78 }
79 }
80 return this;
81 }
82 }
83
84 @Override
85 public void lower(LoweringTool tool) {
86 tool.getLowerer().lower(this, tool);
87 }
88
89 @NodeIntrinsic
90 public static native Class<?> readClass(KlassPointer hub);
91
92 @Override
93 public ValueNode getValue() {
94 return hub;
|