73 } 74 return new LoadHubNode(stamp, value); 75 } 76 77 public LoadHubNode(@InjectedNodeParameter StampProvider stampProvider, ValueNode value) { 78 this(hubStamp(stampProvider, value), value); 79 } 80 81 public LoadHubNode(Stamp stamp, ValueNode value) { 82 super(TYPE, stamp); 83 this.value = value; 84 } 85 86 @Override 87 public void lower(LoweringTool tool) { 88 tool.getLowerer().lower(this, tool); 89 } 90 91 @Override 92 public ValueNode canonical(CanonicalizerTool tool) { 93 if (!GeneratePIC.getValue()) { 94 MetaAccessProvider metaAccess = tool.getMetaAccess(); 95 ValueNode curValue = getValue(); 96 ValueNode newNode = findSynonym(curValue, stamp(), metaAccess, tool.getConstantReflection()); 97 if (newNode != null) { 98 return newNode; 99 } 100 } 101 return this; 102 } 103 104 public static ValueNode findSynonym(ValueNode curValue, Stamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { 105 if (!GeneratePIC.getValue()) { 106 TypeReference type = StampTool.typeReferenceOrNull(curValue); 107 if (type != null && type.isExact()) { 108 return ConstantNode.forConstant(stamp, constantReflection.asObjectHub(type.getType()), metaAccess); 109 } 110 } 111 return null; 112 } 113 114 @Override 115 public void virtualize(VirtualizerTool tool) { 116 if (!GeneratePIC.getValue()) { 117 ValueNode alias = tool.getAlias(getValue()); 118 TypeReference type = StampTool.typeReferenceOrNull(alias); 119 if (type != null && type.isExact()) { 120 tool.replaceWithValue(ConstantNode.forConstant(stamp(), tool.getConstantReflectionProvider().asObjectHub(type.getType()), tool.getMetaAccessProvider(), graph())); 121 } 122 } 123 } 124 } | 73 } 74 return new LoadHubNode(stamp, value); 75 } 76 77 public LoadHubNode(@InjectedNodeParameter StampProvider stampProvider, ValueNode value) { 78 this(hubStamp(stampProvider, value), value); 79 } 80 81 public LoadHubNode(Stamp stamp, ValueNode value) { 82 super(TYPE, stamp); 83 this.value = value; 84 } 85 86 @Override 87 public void lower(LoweringTool tool) { 88 tool.getLowerer().lower(this, tool); 89 } 90 91 @Override 92 public ValueNode canonical(CanonicalizerTool tool) { 93 if (!GeneratePIC.getValue(tool.getOptions())) { 94 MetaAccessProvider metaAccess = tool.getMetaAccess(); 95 ValueNode curValue = getValue(); 96 ValueNode newNode = findSynonym(curValue, stamp(), metaAccess, tool.getConstantReflection()); 97 if (newNode != null) { 98 return newNode; 99 } 100 } 101 return this; 102 } 103 104 public static ValueNode findSynonym(ValueNode curValue, Stamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { 105 if (!GeneratePIC.getValue(curValue.getOptions())) { 106 TypeReference type = StampTool.typeReferenceOrNull(curValue); 107 if (type != null && type.isExact()) { 108 return ConstantNode.forConstant(stamp, constantReflection.asObjectHub(type.getType()), metaAccess); 109 } 110 } 111 return null; 112 } 113 114 @Override 115 public void virtualize(VirtualizerTool tool) { 116 if (!GeneratePIC.getValue(tool.getOptions())) { 117 ValueNode alias = tool.getAlias(getValue()); 118 TypeReference type = StampTool.typeReferenceOrNull(alias); 119 if (type != null && type.isExact()) { 120 tool.replaceWithValue(ConstantNode.forConstant(stamp(), tool.getConstantReflectionProvider().asObjectHub(type.getType()), tool.getMetaAccessProvider(), graph())); 121 } 122 } 123 } 124 } |