use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class LoadVMThreadLocalNode method lower.
@Override
public void lower(LoweringTool tool) {
assert threadLocalInfo.offset >= 0;
ConstantNode offset = ConstantNode.forIntegerKind(FrameAccess.getWordKind(), threadLocalInfo.offset, holder.graph());
AddressNode address = graph().unique(new OffsetAddressNode(holder, offset));
FixedAccessNode read;
if (SubstrateOptions.MultiThreaded.getValue()) {
read = new CInterfaceReadNode(address, threadLocalInfo.locationIdentity, stamp(NodeView.DEFAULT), barrierType, threadLocalInfo.name);
} else {
read = new JavaReadNode(threadLocalInfo.storageKind, address, threadLocalInfo.locationIdentity, barrierType, true);
}
read = graph().add(read);
graph().replaceFixedWithFixed(this, read);
if (!SubstrateOptions.MultiThreaded.getValue()) {
tool.getLowerer().lower(read, tool);
}
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultHotSpotLoweringProvider method lowerHubGetClassNode.
private void lowerHubGetClassNode(HubGetClassNode n, LoweringTool tool) {
if (tool.getLoweringStage() == LoweringTool.StandardLoweringStage.HIGH_TIER) {
return;
}
ValueNode hub = n.getHub();
GraalHotSpotVMConfig vmConfig = runtime.getVMConfig();
StructuredGraph graph = n.graph();
assert !hub.isConstant() || GraalOptions.ImmutableCode.getValue(graph.getOptions());
AddressNode mirrorAddress = createOffsetAddress(graph, hub, vmConfig.classMirrorOffset);
FloatingReadNode read = graph.unique(new FloatingReadNode(mirrorAddress, CLASS_MIRROR_LOCATION, null, vmConfig.classMirrorIsHandle ? StampFactory.forKind(target.wordJavaKind) : n.stamp(NodeView.DEFAULT), null, BarrierType.NONE));
if (vmConfig.classMirrorIsHandle) {
AddressNode address = createOffsetAddress(graph, read, 0);
read = graph.unique(new FloatingReadNode(address, CLASS_MIRROR_HANDLE_LOCATION, null, n.stamp(NodeView.DEFAULT), null, BarrierType.NONE));
}
n.replaceAtUsagesAndDelete(read);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultHotSpotLoweringProvider method lowerInvoke.
private void lowerInvoke(Invoke invoke, LoweringTool tool, StructuredGraph graph) {
if (invoke.callTarget() instanceof MethodCallTargetNode) {
MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
NodeInputList<ValueNode> parameters = callTarget.arguments();
ValueNode receiver = parameters.size() <= 0 ? null : parameters.get(0);
if (!callTarget.isStatic() && receiver.stamp(NodeView.DEFAULT) instanceof ObjectStamp && !StampTool.isPointerNonNull(receiver)) {
ValueNode nonNullReceiver = createNullCheckedValue(receiver, invoke.asNode(), tool);
parameters.set(0, nonNullReceiver);
receiver = nonNullReceiver;
}
JavaType[] signature = callTarget.targetMethod().getSignature().toParameterTypes(callTarget.isStatic() ? null : callTarget.targetMethod().getDeclaringClass());
LoweredCallTargetNode loweredCallTarget = null;
OptionValues options = graph.getOptions();
if (InlineVTableStubs.getValue(options) && callTarget.invokeKind().isIndirect() && (AlwaysInlineVTableStubs.getValue(options) || invoke.isPolymorphic())) {
HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
ResolvedJavaType receiverType = invoke.getReceiverType();
if (hsMethod.isInVirtualMethodTable(receiverType)) {
JavaKind wordKind = runtime.getTarget().wordJavaKind;
ValueNode hub = createReadHub(graph, receiver, tool);
ReadNode metaspaceMethod = createReadVirtualMethod(graph, hub, hsMethod, receiverType);
// We use LocationNode.ANY_LOCATION for the reads that access the
// compiled code entry as HotSpot does not guarantee they are final
// values.
int methodCompiledEntryOffset = runtime.getVMConfig().methodCompiledEntryOffset;
AddressNode address = createOffsetAddress(graph, metaspaceMethod, methodCompiledEntryOffset);
ReadNode compiledEntry = graph.add(new ReadNode(address, any(), StampFactory.forKind(wordKind), BarrierType.NONE));
loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters.toArray(new ValueNode[parameters.size()]), callTarget.returnStamp(), signature, callTarget.targetMethod(), HotSpotCallingConventionType.JavaCall, callTarget.invokeKind()));
graph.addBeforeFixed(invoke.asNode(), metaspaceMethod);
graph.addAfterFixed(metaspaceMethod, compiledEntry);
}
}
if (loweredCallTarget == null) {
loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters.toArray(new ValueNode[parameters.size()]), callTarget.returnStamp(), signature, callTarget.targetMethod(), HotSpotCallingConventionType.JavaCall, callTarget.invokeKind()));
}
callTarget.replaceAndDelete(loweredCallTarget);
}
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultHotSpotLoweringProvider method lowerClassGetHubNode.
private void lowerClassGetHubNode(ClassGetHubNode n, LoweringTool tool) {
if (tool.getLoweringStage() == LoweringTool.StandardLoweringStage.HIGH_TIER) {
return;
}
StructuredGraph graph = n.graph();
assert !n.getValue().isConstant();
AddressNode address = createOffsetAddress(graph, n.getValue(), runtime.getVMConfig().klassOffset);
FloatingReadNode read = graph.unique(new FloatingReadNode(address, CLASS_KLASS_LOCATION, null, n.stamp(NodeView.DEFAULT), null, BarrierType.NONE));
n.replaceAtUsagesAndDelete(read);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultHotSpotLoweringProvider method lowerKlassLayoutHelperNode.
private void lowerKlassLayoutHelperNode(KlassLayoutHelperNode n, LoweringTool tool) {
if (tool.getLoweringStage() == LoweringTool.StandardLoweringStage.HIGH_TIER) {
return;
}
StructuredGraph graph = n.graph();
assert !n.getHub().isConstant();
AddressNode address = createOffsetAddress(graph, n.getHub(), runtime.getVMConfig().klassLayoutHelperOffset);
n.replaceAtUsagesAndDelete(graph.unique(new FloatingReadNode(address, KLASS_LAYOUT_HELPER_LOCATION, null, n.stamp(NodeView.DEFAULT), null, BarrierType.NONE)));
}
Aggregations