< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java
Print this page
*** 418,427 ****
--- 418,429 ----
import org.graalvm.compiler.nodes.java.NewInstanceNode;
import org.graalvm.compiler.nodes.java.NewMultiArrayNode;
import org.graalvm.compiler.nodes.java.RegisterFinalizerNode;
import org.graalvm.compiler.nodes.java.StoreFieldNode;
import org.graalvm.compiler.nodes.java.StoreIndexedNode;
+ import org.graalvm.compiler.nodes.spi.CoreProviders;
+ import org.graalvm.compiler.nodes.spi.Replacements;
import org.graalvm.compiler.nodes.spi.StampProvider;
import org.graalvm.compiler.nodes.type.StampTool;
import org.graalvm.compiler.nodes.util.GraphUtil;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.phases.OptimisticOptimizations;
*** 712,725 ****
this.graph = graph;
this.options = graph.getOptions();
this.debug = graph.getDebug();
this.graphBuilderConfig = graphBuilderInstance.graphBuilderConfig;
this.optimisticOpts = graphBuilderInstance.optimisticOpts;
! this.metaAccess = graphBuilderInstance.metaAccess;
! this.stampProvider = graphBuilderInstance.stampProvider;
! this.constantReflection = graphBuilderInstance.constantReflection;
! this.constantFieldProvider = graphBuilderInstance.constantFieldProvider;
this.stream = new BytecodeStream(code.getCode());
this.profilingInfo = graph.useProfilingInfo() ? code.getProfilingInfo() : null;
this.constantPool = code.getConstantPool();
this.intrinsicContext = intrinsicContext;
this.entryBCI = entryBCI;
--- 714,724 ----
this.graph = graph;
this.options = graph.getOptions();
this.debug = graph.getDebug();
this.graphBuilderConfig = graphBuilderInstance.graphBuilderConfig;
this.optimisticOpts = graphBuilderInstance.optimisticOpts;
! this.providers = graphBuilderInstance.providers;
this.stream = new BytecodeStream(code.getCode());
this.profilingInfo = graph.useProfilingInfo() ? code.getProfilingInfo() : null;
this.constantPool = code.getConstantPool();
this.intrinsicContext = intrinsicContext;
this.entryBCI = entryBCI;
*** 776,786 ****
return this.beforeUnwindNode;
}
@SuppressWarnings("try")
protected void buildRootMethod() {
! FrameStateBuilder startFrameState = new FrameStateBuilder(this, code, graph);
startFrameState.initializeForMethodStart(graph.getAssumptions(), graphBuilderConfig.eagerResolving() || intrinsicContext != null, graphBuilderConfig.getPlugins());
try (IntrinsicScope s = intrinsicContext != null ? new IntrinsicScope(this) : null) {
build(graph.start(), startFrameState);
}
--- 775,785 ----
return this.beforeUnwindNode;
}
@SuppressWarnings("try")
protected void buildRootMethod() {
! FrameStateBuilder startFrameState = new FrameStateBuilder(this, code, graph, graphBuilderConfig.retainLocalVariables());
startFrameState.initializeForMethodStart(graph.getAssumptions(), graphBuilderConfig.eagerResolving() || intrinsicContext != null, graphBuilderConfig.getPlugins());
try (IntrinsicScope s = intrinsicContext != null ? new IntrinsicScope(this) : null) {
build(graph.start(), startFrameState);
}
*** 1119,1129 ****
FrameStateBuilder dispatchState = frameState.copy();
dispatchState.clearStack();
AbstractBeginNode dispatchBegin;
if (exceptionObject == null) {
! ExceptionObjectNode newExceptionObject = graph.add(new ExceptionObjectNode(metaAccess));
dispatchBegin = newExceptionObject;
dispatchState.push(JavaKind.Object, dispatchBegin);
dispatchState.setRethrowException(true);
newExceptionObject.setStateAfter(dispatchState.create(bci, newExceptionObject));
} else {
--- 1118,1128 ----
FrameStateBuilder dispatchState = frameState.copy();
dispatchState.clearStack();
AbstractBeginNode dispatchBegin;
if (exceptionObject == null) {
! ExceptionObjectNode newExceptionObject = graph.add(new ExceptionObjectNode(getMetaAccess()));
dispatchBegin = newExceptionObject;
dispatchState.push(JavaKind.Object, dispatchBegin);
dispatchState.setRethrowException(true);
newExceptionObject.setStateAfter(dispatchState.create(bci, newExceptionObject));
} else {
*** 1164,1174 ****
FixedNode target = createTarget(dispatchBlock, dispatchState);
afterInstrumentation.setNext(target);
}
protected ValueNode genLoadIndexed(ValueNode array, ValueNode index, GuardingNode boundsCheck, JavaKind kind) {
! return LoadIndexedNode.create(graph.getAssumptions(), array, index, boundsCheck, kind, metaAccess, constantReflection);
}
protected void genStoreIndexed(ValueNode array, ValueNode index, GuardingNode boundsCheck, GuardingNode storeCheck, JavaKind kind, ValueNode value) {
add(new StoreIndexedNode(array, index, boundsCheck, storeCheck, kind, value));
}
--- 1163,1173 ----
FixedNode target = createTarget(dispatchBlock, dispatchState);
afterInstrumentation.setNext(target);
}
protected ValueNode genLoadIndexed(ValueNode array, ValueNode index, GuardingNode boundsCheck, JavaKind kind) {
! return LoadIndexedNode.create(graph.getAssumptions(), array, index, boundsCheck, kind, getMetaAccess(), getConstantReflection());
}
protected void genStoreIndexed(ValueNode array, ValueNode index, GuardingNode boundsCheck, GuardingNode storeCheck, JavaKind kind, ValueNode value) {
add(new StoreIndexedNode(array, index, boundsCheck, storeCheck, kind, value));
}
*** 1240,1250 ****
protected ValueNode genXor(ValueNode x, ValueNode y) {
return XorNode.create(x, y, NodeView.DEFAULT);
}
protected ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess) {
! return NormalizeCompareNode.create(x, y, isUnorderedLess, JavaKind.Int, constantReflection);
}
protected ValueNode genFloatConvert(FloatConvert op, ValueNode input) {
return FloatConvertNode.create(op, input, NodeView.DEFAULT);
}
--- 1239,1249 ----
protected ValueNode genXor(ValueNode x, ValueNode y) {
return XorNode.create(x, y, NodeView.DEFAULT);
}
protected ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess) {
! return NormalizeCompareNode.create(x, y, isUnorderedLess, JavaKind.Int, getConstantReflection());
}
protected ValueNode genFloatConvert(FloatConvert op, ValueNode input) {
return FloatConvertNode.create(op, input, NodeView.DEFAULT);
}
*** 1271,1289 ****
appendGoto(currentBlock.getSuccessor(0));
assert currentBlock.numNormalSuccessors() == 1;
}
protected LogicNode genObjectEquals(ValueNode x, ValueNode y) {
! return ObjectEqualsNode.create(constantReflection, metaAccess, options, x, y, NodeView.DEFAULT);
}
protected LogicNode genIntegerEquals(ValueNode x, ValueNode y) {
! return IntegerEqualsNode.create(constantReflection, metaAccess, options, null, x, y, NodeView.DEFAULT);
}
protected LogicNode genIntegerLessThan(ValueNode x, ValueNode y) {
! return IntegerLessThanNode.create(constantReflection, metaAccess, options, null, x, y, NodeView.DEFAULT);
}
protected ValueNode genUnique(ValueNode x) {
return graph.addOrUniqueWithInputs(x);
}
--- 1270,1288 ----
appendGoto(currentBlock.getSuccessor(0));
assert currentBlock.numNormalSuccessors() == 1;
}
protected LogicNode genObjectEquals(ValueNode x, ValueNode y) {
! return ObjectEqualsNode.create(getConstantReflection(), getMetaAccess(), options, x, y, NodeView.DEFAULT);
}
protected LogicNode genIntegerEquals(ValueNode x, ValueNode y) {
! return IntegerEqualsNode.create(getConstantReflection(), getMetaAccess(), options, null, x, y, NodeView.DEFAULT);
}
protected LogicNode genIntegerLessThan(ValueNode x, ValueNode y) {
! return IntegerLessThanNode.create(getConstantReflection(), getMetaAccess(), options, null, x, y, NodeView.DEFAULT);
}
protected ValueNode genUnique(ValueNode x) {
return graph.addOrUniqueWithInputs(x);
}
*** 1370,1408 ****
protected GuardingNode maybeEmitExplicitBoundsCheck(ValueNode receiver, ValueNode index) {
if (!needsExplicitBoundsCheckException(receiver, index)) {
return null;
}
ValueNode length = append(genArrayLength(receiver));
! LogicNode condition = genUnique(IntegerBelowNode.create(constantReflection, metaAccess, options, null, index, length, NodeView.DEFAULT));
return emitBytecodeExceptionCheck(condition, true, BytecodeExceptionKind.OUT_OF_BOUNDS, index, length);
}
protected GuardingNode maybeEmitExplicitStoreCheck(ValueNode array, JavaKind elementKind, ValueNode value) {
if (elementKind != JavaKind.Object || StampTool.isPointerAlwaysNull(value) || !needsExplicitStoreCheckException(array, value)) {
return null;
}
! ValueNode arrayClass = genUnique(LoadHubNode.create(array, stampProvider, metaAccess, constantReflection));
! ValueNode componentHub = append(LoadArrayComponentHubNode.create(arrayClass, stampProvider, metaAccess, constantReflection));
LogicNode condition = genUnique(InstanceOfDynamicNode.create(graph.getAssumptions(), getConstantReflection(), componentHub, value, true));
return emitBytecodeExceptionCheck(condition, true, BytecodeExceptionKind.ARRAY_STORE, value);
}
protected GuardingNode maybeEmitExplicitDivisionByZeroCheck(ValueNode y) {
if (!((IntegerStamp) y.stamp(NodeView.DEFAULT)).contains(0) || !needsExplicitDivisionByZeroException(y)) {
return null;
}
ConstantNode zero = ConstantNode.defaultForKind(y.getStackKind(), graph);
! LogicNode condition = genUnique(IntegerEqualsNode.create(constantReflection, metaAccess, options, null, y, zero, NodeView.DEFAULT));
return emitBytecodeExceptionCheck(condition, false, BytecodeExceptionKind.DIVISION_BY_ZERO);
}
private AbstractBeginNode emitBytecodeExceptionCheck(LogicNode condition, boolean passingOnTrue, BytecodeExceptionKind exceptionKind, ValueNode... arguments) {
if (passingOnTrue ? condition.isTautology() : condition.isContradiction()) {
return null;
}
! BytecodeExceptionNode exception = graph.add(new BytecodeExceptionNode(metaAccess, exceptionKind, arguments));
AbstractBeginNode passingSuccessor = graph.add(new BeginNode());
FixedNode trueSuccessor = passingOnTrue ? passingSuccessor : exception;
FixedNode falseSuccessor = passingOnTrue ? exception : passingSuccessor;
append(new IfNode(condition, trueSuccessor, falseSuccessor, passingOnTrue ? LUDICROUSLY_FAST_PATH_PROBABILITY : LUDICROUSLY_SLOW_PATH_PROBABILITY));
--- 1369,1407 ----
protected GuardingNode maybeEmitExplicitBoundsCheck(ValueNode receiver, ValueNode index) {
if (!needsExplicitBoundsCheckException(receiver, index)) {
return null;
}
ValueNode length = append(genArrayLength(receiver));
! LogicNode condition = genUnique(IntegerBelowNode.create(getConstantReflection(), getMetaAccess(), options, null, index, length, NodeView.DEFAULT));
return emitBytecodeExceptionCheck(condition, true, BytecodeExceptionKind.OUT_OF_BOUNDS, index, length);
}
protected GuardingNode maybeEmitExplicitStoreCheck(ValueNode array, JavaKind elementKind, ValueNode value) {
if (elementKind != JavaKind.Object || StampTool.isPointerAlwaysNull(value) || !needsExplicitStoreCheckException(array, value)) {
return null;
}
! ValueNode arrayClass = genUnique(LoadHubNode.create(array, getStampProvider(), getMetaAccess(), getConstantReflection()));
! ValueNode componentHub = append(LoadArrayComponentHubNode.create(arrayClass, getStampProvider(), getMetaAccess(), getConstantReflection()));
LogicNode condition = genUnique(InstanceOfDynamicNode.create(graph.getAssumptions(), getConstantReflection(), componentHub, value, true));
return emitBytecodeExceptionCheck(condition, true, BytecodeExceptionKind.ARRAY_STORE, value);
}
protected GuardingNode maybeEmitExplicitDivisionByZeroCheck(ValueNode y) {
if (!((IntegerStamp) y.stamp(NodeView.DEFAULT)).contains(0) || !needsExplicitDivisionByZeroException(y)) {
return null;
}
ConstantNode zero = ConstantNode.defaultForKind(y.getStackKind(), graph);
! LogicNode condition = genUnique(IntegerEqualsNode.create(getConstantReflection(), getMetaAccess(), options, null, y, zero, NodeView.DEFAULT));
return emitBytecodeExceptionCheck(condition, false, BytecodeExceptionKind.DIVISION_BY_ZERO);
}
private AbstractBeginNode emitBytecodeExceptionCheck(LogicNode condition, boolean passingOnTrue, BytecodeExceptionKind exceptionKind, ValueNode... arguments) {
if (passingOnTrue ? condition.isTautology() : condition.isContradiction()) {
return null;
}
! BytecodeExceptionNode exception = graph.add(new BytecodeExceptionNode(getMetaAccess(), exceptionKind, arguments));
AbstractBeginNode passingSuccessor = graph.add(new BeginNode());
FixedNode trueSuccessor = passingOnTrue ? passingSuccessor : exception;
FixedNode falseSuccessor = passingOnTrue ? exception : passingSuccessor;
append(new IfNode(condition, trueSuccessor, falseSuccessor, passingOnTrue ? LUDICROUSLY_FAST_PATH_PROBABILITY : LUDICROUSLY_SLOW_PATH_PROBABILITY));
*** 1414,1424 ****
return passingSuccessor;
}
protected ValueNode genArrayLength(ValueNode x) {
! return ArrayLengthNode.create(x, constantReflection);
}
protected void genStoreField(ValueNode receiver, ResolvedJavaField field, ValueNode value) {
StoreFieldNode storeFieldNode = new StoreFieldNode(receiver, field, maskSubWordValue(value, field.getJavaKind()));
append(storeFieldNode);
--- 1413,1423 ----
return passingSuccessor;
}
protected ValueNode genArrayLength(ValueNode x) {
! return ArrayLengthNode.create(x, getConstantReflection());
}
protected void genStoreField(ValueNode receiver, ResolvedJavaField field, ValueNode value) {
StoreFieldNode storeFieldNode = new StoreFieldNode(receiver, field, maskSubWordValue(value, field.getJavaKind()));
append(storeFieldNode);
*** 1565,1575 ****
// Will perform runtime type checks and static initialization
FrameState stateBefore = createCurrentFrameState();
appendixNode = invokeDynamicPlugin.genAppendixNode(this, cpi, opcode, appendix, stateBefore);
} else {
! appendixNode = ConstantNode.forConstant(appendix, metaAccess, graph);
}
frameState.push(JavaKind.Object, appendixNode);
} else if (GeneratePIC.getValue(options)) {
--- 1564,1574 ----
// Will perform runtime type checks and static initialization
FrameState stateBefore = createCurrentFrameState();
appendixNode = invokeDynamicPlugin.genAppendixNode(this, cpi, opcode, appendix, stateBefore);
} else {
! appendixNode = ConstantNode.forConstant(appendix, getMetaAccess(), graph);
}
frameState.push(JavaKind.Object, appendixNode);
} else if (GeneratePIC.getValue(options)) {
*** 1627,1640 ****
protected final Bytecode code;
protected final BytecodeProvider bytecodeProvider;
protected final ProfilingInfo profilingInfo;
protected final OptimisticOptimizations optimisticOpts;
protected final ConstantPool constantPool;
! protected final MetaAccessProvider metaAccess;
! private final ConstantReflectionProvider constantReflection;
! private final ConstantFieldProvider constantFieldProvider;
! private final StampProvider stampProvider;
protected final IntrinsicContext intrinsicContext;
@Override
public InvokeKind getInvokeKind() {
return currentInvoke == null ? null : currentInvoke.kind;
--- 1626,1636 ----
protected final Bytecode code;
protected final BytecodeProvider bytecodeProvider;
protected final ProfilingInfo profilingInfo;
protected final OptimisticOptimizations optimisticOpts;
protected final ConstantPool constantPool;
! protected final CoreProviders providers;
protected final IntrinsicContext intrinsicContext;
@Override
public InvokeKind getInvokeKind() {
return currentInvoke == null ? null : currentInvoke.kind;
*** 1952,1962 ****
this.nodeCount = graph.getNodeCount();
this.mark = graph.getMark();
}
String error(String format, Object... a) {
! return String.format(format, a) + String.format("%n\tplugin at %s", plugin.getApplySourceLocation(metaAccess));
}
boolean check(boolean pluginResult) {
if (pluginResult) {
/*
--- 1948,1958 ----
this.nodeCount = graph.getNodeCount();
this.mark = graph.getMark();
}
String error(String format, Object... a) {
! return String.format(format, a) + String.format("%n\tplugin at %s", plugin.getApplySourceLocation(getMetaAccess()));
}
boolean check(boolean pluginResult) {
if (pluginResult) {
/*
*** 2037,2051 ****
if (resolvedMethod == null || resolvedMethod.equals(targetMethod)) {
assert resolvedMethod == null || targetMethod.getDeclaringClass().isAssignableFrom(resolvedMethod.getDeclaringClass());
Mark mark = graph.getMark();
FixedWithNextNode currentLastInstr = lastInstr;
ValueNode nonNullReceiver = pluginReceiver.get();
! Stamp methodStamp = stampProvider.createMethodStamp();
! LoadHubNode hub = graph.unique(new LoadHubNode(stampProvider, nonNullReceiver));
LoadMethodNode actual = append(new LoadMethodNode(methodStamp, targetMethod, receiverType, method.getDeclaringClass(), hub));
ConstantNode expected = graph.unique(ConstantNode.forConstant(methodStamp, targetMethod.getEncoding(), getMetaAccess()));
! LogicNode compare = graph.addOrUniqueWithInputs(CompareNode.createCompareNode(constantReflection, metaAccess, options, null, CanonicalCondition.EQ, actual, expected, NodeView.DEFAULT));
JavaTypeProfile profile = null;
if (profilingInfo != null && this.optimisticOpts.useTypeCheckHints(getOptions())) {
profile = profilingInfo.getTypeProfile(bci());
if (profile != null) {
--- 2033,2048 ----
if (resolvedMethod == null || resolvedMethod.equals(targetMethod)) {
assert resolvedMethod == null || targetMethod.getDeclaringClass().isAssignableFrom(resolvedMethod.getDeclaringClass());
Mark mark = graph.getMark();
FixedWithNextNode currentLastInstr = lastInstr;
ValueNode nonNullReceiver = pluginReceiver.get();
! Stamp methodStamp = getStampProvider().createMethodStamp();
! LoadHubNode hub = graph.unique(new LoadHubNode(getStampProvider(), nonNullReceiver));
LoadMethodNode actual = append(new LoadMethodNode(methodStamp, targetMethod, receiverType, method.getDeclaringClass(), hub));
ConstantNode expected = graph.unique(ConstantNode.forConstant(methodStamp, targetMethod.getEncoding(), getMetaAccess()));
! LogicNode compare = graph.addOrUniqueWithInputs(
! CompareNode.createCompareNode(getConstantReflection(), getMetaAccess(), options, null, CanonicalCondition.EQ, actual, expected, NodeView.DEFAULT));
JavaTypeProfile profile = null;
if (profilingInfo != null && this.optimisticOpts.useTypeCheckHints(getOptions())) {
profile = profilingInfo.getTypeProfile(bci());
if (profile != null) {
*** 2319,2329 ****
if (scope != null) {
graph.getInliningLog().addDecision(scope.getInvoke(), false, "GraphBuilderPhase", null, null, "native method");
}
return false;
}
! if (canInlinePartialIntrinsicExit() && InlinePartialIntrinsicExitDuringParsing.getValue(options) && !IS_BUILDING_NATIVE_IMAGE) {
// Otherwise inline the original method. Any frame state created
// during the inlining will exclude frame(s) in the
// intrinsic method (see FrameStateBuilder.create(int bci)).
notifyBeforeInline(inlinedMethod);
printInlining(targetMethod, inlinedMethod, true, "partial intrinsic exit (bytecode parsing)");
--- 2316,2326 ----
if (scope != null) {
graph.getInliningLog().addDecision(scope.getInvoke(), false, "GraphBuilderPhase", null, null, "native method");
}
return false;
}
! if (canInlinePartialIntrinsicExit()) {
// Otherwise inline the original method. Any frame state created
// during the inlining will exclude frame(s) in the
// intrinsic method (see FrameStateBuilder.create(int bci)).
notifyBeforeInline(inlinedMethod);
printInlining(targetMethod, inlinedMethod, true, "partial intrinsic exit (bytecode parsing)");
*** 2382,2392 ****
/**
* Determines if a partial intrinsic exit (i.e., a call to the original method within an
* intrinsic) can be inlined.
*/
protected boolean canInlinePartialIntrinsicExit() {
! return true;
}
private void printInlining(ResolvedJavaMethod targetMethod, ResolvedJavaMethod inlinedMethod, boolean success, String msg) {
if (success) {
if (TraceInlineDuringParsing.getValue(options) || TraceParserPlugins.getValue(options)) {
--- 2379,2389 ----
/**
* Determines if a partial intrinsic exit (i.e., a call to the original method within an
* intrinsic) can be inlined.
*/
protected boolean canInlinePartialIntrinsicExit() {
! return InlinePartialIntrinsicExitDuringParsing.getValue(options) && !IS_BUILDING_NATIVE_IMAGE && method.getAnnotation(Snippet.class) == null;
}
private void printInlining(ResolvedJavaMethod targetMethod, ResolvedJavaMethod inlinedMethod, boolean success, String msg) {
if (success) {
if (TraceInlineDuringParsing.getValue(options) || TraceParserPlugins.getValue(options)) {
*** 2444,2454 ****
FixedWithNextNode calleeBeforeUnwindNode = null;
ValueNode calleeUnwindValue = null;
try (IntrinsicScope s = calleeIntrinsicContext != null && !parsingIntrinsic() ? new IntrinsicScope(this, targetMethod.getSignature().toParameterKinds(!targetMethod.isStatic()), args) : null) {
BytecodeParser parser = graphBuilderInstance.createBytecodeParser(graph, this, targetMethod, INVOCATION_ENTRY_BCI, calleeIntrinsicContext);
! FrameStateBuilder startFrameState = new FrameStateBuilder(parser, parser.code, graph);
if (!targetMethod.isStatic()) {
args[0] = nullCheckedValue(args[0]);
}
startFrameState.initializeFromArgumentsArray(args);
parser.build(this.lastInstr, startFrameState);
--- 2441,2451 ----
FixedWithNextNode calleeBeforeUnwindNode = null;
ValueNode calleeUnwindValue = null;
try (IntrinsicScope s = calleeIntrinsicContext != null && !parsingIntrinsic() ? new IntrinsicScope(this, targetMethod.getSignature().toParameterKinds(!targetMethod.isStatic()), args) : null) {
BytecodeParser parser = graphBuilderInstance.createBytecodeParser(graph, this, targetMethod, INVOCATION_ENTRY_BCI, calleeIntrinsicContext);
! FrameStateBuilder startFrameState = new FrameStateBuilder(parser, parser.code, graph, graphBuilderConfig.retainLocalVariables());
if (!targetMethod.isStatic()) {
args[0] = nullCheckedValue(args[0]);
}
startFrameState.initializeFromArgumentsArray(args);
parser.build(this.lastInstr, startFrameState);
*** 2677,2687 ****
BciBlock successor = currentBlock.getRetSuccessor();
ValueNode local = frameState.loadLocal(localIndex, JavaKind.Object);
JsrScope scope = currentBlock.getJsrScope();
int retAddress = scope.nextReturnAddress();
ConstantNode returnBciNode = getJsrConstant(retAddress);
! LogicNode guard = IntegerEqualsNode.create(constantReflection, metaAccess, options, null, local, returnBciNode, NodeView.DEFAULT);
guard = graph.addOrUniqueWithInputs(guard);
append(new FixedGuardNode(guard, JavaSubroutineMismatch, InvalidateReprofile));
if (!successor.getJsrScope().equals(scope.pop())) {
throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)");
}
--- 2674,2684 ----
BciBlock successor = currentBlock.getRetSuccessor();
ValueNode local = frameState.loadLocal(localIndex, JavaKind.Object);
JsrScope scope = currentBlock.getJsrScope();
int retAddress = scope.nextReturnAddress();
ConstantNode returnBciNode = getJsrConstant(retAddress);
! LogicNode guard = IntegerEqualsNode.create(getConstantReflection(), getMetaAccess(), options, null, local, returnBciNode, NodeView.DEFAULT);
guard = graph.addOrUniqueWithInputs(guard);
append(new FixedGuardNode(guard, JavaSubroutineMismatch, InvalidateReprofile));
if (!successor.getJsrScope().equals(scope.pop())) {
throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)");
}
*** 2729,2739 ****
return probability;
}
protected ConstantNode appendConstant(JavaConstant constant) {
assert constant != null;
! return ConstantNode.forConstant(constant, metaAccess, graph);
}
@Override
public <T extends ValueNode> T append(T v) {
assert !graph.trackNodeSourcePosition() || graph.currentNodeSourcePosition() != null || currentBlock == blockMap.getUnwindBlock() || currentBlock instanceof ExceptionDispatchBlock;
--- 2726,2736 ----
return probability;
}
protected ConstantNode appendConstant(JavaConstant constant) {
assert constant != null;
! return ConstantNode.forConstant(constant, getMetaAccess(), graph);
}
@Override
public <T extends ValueNode> T append(T v) {
assert !graph.trackNodeSourcePosition() || graph.currentNodeSourcePosition() != null || currentBlock == blockMap.getUnwindBlock() || currentBlock instanceof ExceptionDispatchBlock;
*** 3600,3615 ****
return currentBC == Bytecodes.IRETURN;
}
@Override
public StampProvider getStampProvider() {
! return stampProvider;
}
@Override
public MetaAccessProvider getMetaAccess() {
! return metaAccess;
}
@Override
public void push(JavaKind slotKind, ValueNode value) {
assert value.isAlive();
--- 3597,3617 ----
return currentBC == Bytecodes.IRETURN;
}
@Override
public StampProvider getStampProvider() {
! return providers.getStampProvider();
}
@Override
public MetaAccessProvider getMetaAccess() {
! return providers.getMetaAccess();
! }
!
! @Override
! public Replacements getReplacements() {
! return providers.getReplacements();
}
@Override
public void push(JavaKind slotKind, ValueNode value) {
assert value.isAlive();
*** 3621,3636 ****
return frameState.pop(slotKind);
}
@Override
public ConstantReflectionProvider getConstantReflection() {
! return constantReflection;
}
@Override
public ConstantFieldProvider getConstantFieldProvider() {
! return constantFieldProvider;
}
/**
* Gets the graph being processed by this builder.
*/
--- 3623,3638 ----
return frameState.pop(slotKind);
}
@Override
public ConstantReflectionProvider getConstantReflection() {
! return providers.getConstantReflection();
}
@Override
public ConstantFieldProvider getConstantFieldProvider() {
! return providers.getConstantFieldProvider();
}
/**
* Gets the graph being processed by this builder.
*/
*** 3751,3761 ****
}
}
private JavaKind refineComponentType(ValueNode array, JavaKind kind) {
if (kind == JavaKind.Byte) {
! JavaType type = array.stamp(NodeView.DEFAULT).javaType(metaAccess);
if (type.isArray()) {
JavaType componentType = type.getComponentType();
if (componentType != null) {
JavaKind refinedKind = componentType.getJavaKind();
assert refinedKind == JavaKind.Byte || refinedKind == JavaKind.Boolean;
--- 3753,3763 ----
}
}
private JavaKind refineComponentType(ValueNode array, JavaKind kind) {
if (kind == JavaKind.Byte) {
! JavaType type = array.stamp(NodeView.DEFAULT).javaType(getMetaAccess());
if (type.isArray()) {
JavaType componentType = type.getComponentType();
if (componentType != null) {
JavaKind refinedKind = componentType.getJavaKind();
assert refinedKind == JavaKind.Byte || refinedKind == JavaKind.Boolean;
*** 4306,4316 ****
throw new IllegalArgumentException("unknown array type code: " + code);
}
}
private void genNewPrimitiveArray(int typeCode) {
! ResolvedJavaType elementType = metaAccess.lookupJavaType(arrayTypeCodeToClass(typeCode));
ValueNode length = frameState.pop(JavaKind.Int);
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleNewArray(this, elementType, length)) {
return;
--- 4308,4318 ----
throw new IllegalArgumentException("unknown array type code: " + code);
}
}
private void genNewPrimitiveArray(int typeCode) {
! ResolvedJavaType elementType = getMetaAccess().lookupJavaType(arrayTypeCodeToClass(typeCode));
ValueNode length = frameState.pop(JavaKind.Int);
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleNewArray(this, elementType, length)) {
return;
*** 4490,4500 ****
return false;
}
@Override
public AbstractBeginNode genExplicitExceptionEdge(BytecodeExceptionKind exceptionKind) {
! BytecodeExceptionNode exceptionNode = graph.add(new BytecodeExceptionNode(metaAccess, exceptionKind));
exceptionNode.setStateAfter(createFrameState(bci(), exceptionNode));
AbstractBeginNode exceptionDispatch = handleException(exceptionNode, bci(), false);
exceptionNode.setNext(exceptionDispatch);
return BeginNode.begin(exceptionNode);
}
--- 4492,4502 ----
return false;
}
@Override
public AbstractBeginNode genExplicitExceptionEdge(BytecodeExceptionKind exceptionKind) {
! BytecodeExceptionNode exceptionNode = graph.add(new BytecodeExceptionNode(getMetaAccess(), exceptionKind));
exceptionNode.setStateAfter(createFrameState(bci(), exceptionNode));
AbstractBeginNode exceptionDispatch = handleException(exceptionNode, bci(), false);
exceptionNode.setNext(exceptionDispatch);
return BeginNode.begin(exceptionNode);
}
*** 5111,5115 ****
--- 5113,5118 ----
static String nSpaces(int n) {
return n == 0 ? "" : format("%" + n + "s", "");
}
}
+
< prev index next >