use of org.graalvm.compiler.nodes.FrameState in project graal by oracle.
the class BasicArrayCopyNode method computeStateDuring.
@Override
public void computeStateDuring(FrameState currentStateAfter) {
FrameState newStateDuring = currentStateAfter.duplicateModifiedDuringCall(getBci(), asNode().getStackKind());
setStateDuring(newStateDuring);
}
use of org.graalvm.compiler.nodes.FrameState in project graal by oracle.
the class BytecodeParser method genNewObjectArray.
private void genNewObjectArray(int cpi) {
JavaType type = lookupType(cpi, ANEWARRAY);
if (!(type instanceof ResolvedJavaType)) {
ValueNode length = frameState.pop(JavaKind.Int);
handleUnresolvedNewObjectArray(type, length);
return;
}
ResolvedJavaType resolvedType = (ResolvedJavaType) type;
ClassInitializationPlugin classInitializationPlugin = this.graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedType.getArrayClass())) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInitializationPlugin.apply(this, resolvedType.getArrayClass(), stateBefore);
}
ValueNode length = frameState.pop(JavaKind.Int);
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleNewArray(this, resolvedType, length)) {
return;
}
}
frameState.push(JavaKind.Object, append(createNewArray(resolvedType, length, true)));
}
use of org.graalvm.compiler.nodes.FrameState in project graal by oracle.
the class BytecodeParser method genIf.
protected void genIf(LogicNode conditionInput, BciBlock trueBlockInput, BciBlock falseBlockInput, double probabilityInput) {
BciBlock trueBlock = trueBlockInput;
BciBlock falseBlock = falseBlockInput;
LogicNode condition = conditionInput;
double probability = probabilityInput;
FrameState stateBefore = null;
ProfilingPlugin profilingPlugin = this.graphBuilderConfig.getPlugins().getProfilingPlugin();
if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
}
// Remove a logic negation node.
if (condition instanceof LogicNegationNode) {
LogicNegationNode logicNegationNode = (LogicNegationNode) condition;
BciBlock tmpBlock = trueBlock;
trueBlock = falseBlock;
falseBlock = tmpBlock;
probability = 1 - probability;
condition = logicNegationNode.getValue();
}
if (condition instanceof LogicConstantNode) {
genConstantTargetIf(trueBlock, falseBlock, condition);
} else {
if (condition.graph() == null) {
condition = genUnique(condition);
}
if (isNeverExecutedCode(probability)) {
append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, true));
if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
profilingPlugin.profileGoto(this, method, bci(), falseBlock.startBci, stateBefore);
}
appendGoto(falseBlock);
return;
} else if (isNeverExecutedCode(1 - probability)) {
append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, false));
if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
profilingPlugin.profileGoto(this, method, bci(), trueBlock.startBci, stateBefore);
}
appendGoto(trueBlock);
return;
}
if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
profilingPlugin.profileIf(this, method, bci(), condition, trueBlock.startBci, falseBlock.startBci, stateBefore);
}
int oldBci = stream.currentBCI();
int trueBlockInt = checkPositiveIntConstantPushed(trueBlock);
if (trueBlockInt != -1) {
int falseBlockInt = checkPositiveIntConstantPushed(falseBlock);
if (falseBlockInt != -1) {
if (tryGenConditionalForIf(trueBlock, falseBlock, condition, oldBci, trueBlockInt, falseBlockInt)) {
return;
}
}
}
this.controlFlowSplit = true;
FixedNode trueSuccessor = createTarget(trueBlock, frameState, false, false);
FixedNode falseSuccessor = createTarget(falseBlock, frameState, false, true);
ValueNode ifNode = genIfNode(condition, trueSuccessor, falseSuccessor, probability);
postProcessIfNode(ifNode);
append(ifNode);
}
}
use of org.graalvm.compiler.nodes.FrameState in project graal by oracle.
the class BytecodeParser method genGoto.
protected void genGoto() {
ProfilingPlugin profilingPlugin = this.graphBuilderConfig.getPlugins().getProfilingPlugin();
if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
int targetBci = currentBlock.getSuccessor(0).startBci;
profilingPlugin.profileGoto(this, method, bci(), targetBci, stateBefore);
}
appendGoto(currentBlock.getSuccessor(0));
assert currentBlock.numNormalSuccessors() == 1;
}
use of org.graalvm.compiler.nodes.FrameState in project graal by oracle.
the class BytecodeParser method bailout.
@Override
public BailoutException bailout(String string) {
FrameState currentFrameState = createFrameState(bci(), null);
StackTraceElement[] elements = GraphUtil.approxSourceStackTraceElement(currentFrameState);
BailoutException bailout = new PermanentBailoutException(string);
throw GraphUtil.createBailoutException(string, bailout, elements);
}
Aggregations