< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java
Print this page
*** 369,378 ****
--- 369,379 ----
import org.graalvm.compiler.nodes.extended.BytecodeExceptionNode;
import org.graalvm.compiler.nodes.extended.IntegerSwitchNode;
import org.graalvm.compiler.nodes.extended.LoadHubNode;
import org.graalvm.compiler.nodes.extended.LoadMethodNode;
import org.graalvm.compiler.nodes.extended.MembarNode;
+ import org.graalvm.compiler.nodes.extended.StateSplitProxyNode;
import org.graalvm.compiler.nodes.extended.ValueAnchorNode;
import org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.BytecodeExceptionMode;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
*** 1234,1243 ****
--- 1235,1248 ----
return LoadFieldNode.createOverrideStamp(getConstantFieldProvider(), getConstantReflection(), getMetaAccess(), getOptions(),
stamp, receiver, field, false, false);
}
}
+ protected StateSplitProxyNode genVolatileFieldReadProxy(ValueNode fieldRead) {
+ return new StateSplitProxyNode(fieldRead);
+ }
+
protected ValueNode emitExplicitNullCheck(ValueNode receiver) {
if (StampTool.isPointerNonNull(receiver.stamp())) {
return receiver;
}
BytecodeExceptionNode exception = graph.add(new BytecodeExceptionNode(metaAccess, NullPointerException.class));
*** 1427,1437 ****
BytecodeParser intrinsicCallSiteParser = getNonIntrinsicAncestor();
boolean withExceptionEdge = intrinsicCallSiteParser == null ? !omitInvokeExceptionEdge(null) : !intrinsicCallSiteParser.omitInvokeExceptionEdge(null);
createNonInlinedInvoke(withExceptionEdge, bci(), callTarget, resultType);
}
! private Invoke appendInvoke(InvokeKind initialInvokeKind, ResolvedJavaMethod initialTargetMethod, ValueNode[] args) {
ResolvedJavaMethod targetMethod = initialTargetMethod;
InvokeKind invokeKind = initialInvokeKind;
if (initialInvokeKind.isIndirect()) {
ResolvedJavaType contextType = this.frameState.getMethod().getDeclaringClass();
ResolvedJavaMethod specialCallTarget = MethodCallTargetNode.findSpecialCallTarget(initialInvokeKind, args[0], initialTargetMethod, contextType);
--- 1432,1442 ----
BytecodeParser intrinsicCallSiteParser = getNonIntrinsicAncestor();
boolean withExceptionEdge = intrinsicCallSiteParser == null ? !omitInvokeExceptionEdge(null) : !intrinsicCallSiteParser.omitInvokeExceptionEdge(null);
createNonInlinedInvoke(withExceptionEdge, bci(), callTarget, resultType);
}
! protected Invoke appendInvoke(InvokeKind initialInvokeKind, ResolvedJavaMethod initialTargetMethod, ValueNode[] args) {
ResolvedJavaMethod targetMethod = initialTargetMethod;
InvokeKind invokeKind = initialInvokeKind;
if (initialInvokeKind.isIndirect()) {
ResolvedJavaType contextType = this.frameState.getMethod().getDeclaringClass();
ResolvedJavaMethod specialCallTarget = MethodCallTargetNode.findSpecialCallTarget(initialInvokeKind, args[0], initialTargetMethod, contextType);
*** 1674,1684 ****
final boolean needsNullCheck;
final int nodeCount;
final Mark mark;
InvocationPluginAssertions(InvocationPlugin plugin, ValueNode[] args, ResolvedJavaMethod targetMethod, JavaKind resultType) {
! guarantee(Assertions.ENABLED, "%s should only be loaded and instantiated if assertions are enabled", getClass().getSimpleName());
this.plugin = plugin;
this.targetMethod = targetMethod;
this.args = args;
this.resultType = resultType;
this.beforeStackSize = frameState.stackSize();
--- 1679,1689 ----
final boolean needsNullCheck;
final int nodeCount;
final Mark mark;
InvocationPluginAssertions(InvocationPlugin plugin, ValueNode[] args, ResolvedJavaMethod targetMethod, JavaKind resultType) {
! guarantee(Assertions.assertionsEnabled(), "%s should only be loaded and instantiated if assertions are enabled", getClass().getSimpleName());
this.plugin = plugin;
this.targetMethod = targetMethod;
this.args = args;
this.resultType = resultType;
this.beforeStackSize = frameState.stackSize();
*** 1906,1916 ****
} else if (intrinsicGuard.nonIntrinsicBranch == null) {
assert lastInstr instanceof FixedGuardNode;
}
}
! InvocationPluginAssertions assertions = Assertions.ENABLED ? new InvocationPluginAssertions(plugin, args, targetMethod, resultType) : null;
if (plugin.execute(this, targetMethod, pluginReceiver, args)) {
afterInvocationPluginExecution(true, assertions, intrinsicGuard, invokeKind, args, targetMethod, resultType, returnType);
return true;
} else {
afterInvocationPluginExecution(false, assertions, intrinsicGuard, invokeKind, args, targetMethod, resultType, returnType);
--- 1911,1921 ----
} else if (intrinsicGuard.nonIntrinsicBranch == null) {
assert lastInstr instanceof FixedGuardNode;
}
}
! InvocationPluginAssertions assertions = Assertions.assertionsEnabled() ? new InvocationPluginAssertions(plugin, args, targetMethod, resultType) : null;
if (plugin.execute(this, targetMethod, pluginReceiver, args)) {
afterInvocationPluginExecution(true, assertions, intrinsicGuard, invokeKind, args, targetMethod, resultType, returnType);
return true;
} else {
afterInvocationPluginExecution(false, assertions, intrinsicGuard, invokeKind, args, targetMethod, resultType, returnType);
*** 3786,3800 ****
if (plugin.handleLoadField(this, receiver, resolvedField)) {
return;
}
}
! frameState.push(resolvedField.getJavaKind(), append(genLoadField(receiver, resolvedField)));
if (resolvedField.getDeclaringClass().getName().equals("Ljava/lang/ref/Reference;") && resolvedField.getName().equals("referent")) {
LocationIdentity referentIdentity = new FieldLocationIdentity(resolvedField);
append(new MembarNode(0, referentIdentity));
}
}
/**
* @param receiver the receiver of an object based operation
* @param index the index of an array based operation that is to be tested for out of bounds.
--- 3791,3816 ----
if (plugin.handleLoadField(this, receiver, resolvedField)) {
return;
}
}
! ValueNode fieldRead = append(genLoadField(receiver, resolvedField));
!
if (resolvedField.getDeclaringClass().getName().equals("Ljava/lang/ref/Reference;") && resolvedField.getName().equals("referent")) {
LocationIdentity referentIdentity = new FieldLocationIdentity(resolvedField);
append(new MembarNode(0, referentIdentity));
}
+
+ JavaKind fieldKind = resolvedField.getJavaKind();
+
+ if (resolvedField.isVolatile() && fieldRead instanceof LoadFieldNode) {
+ StateSplitProxyNode readProxy = append(genVolatileFieldReadProxy(fieldRead));
+ frameState.push(fieldKind, readProxy);
+ readProxy.setStateAfter(frameState.create(stream.nextBCI(), readProxy));
+ } else {
+ frameState.push(fieldKind, fieldRead);
+ }
}
/**
* @param receiver the receiver of an object based operation
* @param index the index of an array based operation that is to be tested for out of bounds.
< prev index next >