use of org.graalvm.compiler.hotspot.nodes.profiling.ProfileBranchNode in project graal by oracle.
the class HotSpotProfilingPlugin method profileGoto.
@Override
public void profileGoto(GraphBuilderContext builder, ResolvedJavaMethod method, int bci, int targetBci, FrameState frameState) {
assert shouldProfile(builder, method);
OptionValues options = builder.getOptions();
if (Options.ProfileBackedges.getValue(options) && targetBci <= bci) {
ProfileNode p = builder.append(new ProfileBranchNode(method, backedgeNotifyFreqLog(options), backedgeProfilePobabilityLog(options), bci, targetBci));
p.setStateBefore(frameState);
}
}
use of org.graalvm.compiler.hotspot.nodes.profiling.ProfileBranchNode in project graal by oracle.
the class HotSpotProfilingPlugin method profileIf.
@Override
public void profileIf(GraphBuilderContext builder, ResolvedJavaMethod method, int bci, LogicNode condition, int trueBranchBci, int falseBranchBci, FrameState frameState) {
assert shouldProfile(builder, method);
OptionValues options = builder.getOptions();
if (Options.ProfileBackedges.getValue(options) && (falseBranchBci <= bci || trueBranchBci <= bci)) {
boolean negate = false;
int targetBci = trueBranchBci;
if (falseBranchBci <= bci) {
assert trueBranchBci > bci;
negate = true;
targetBci = falseBranchBci;
} else {
assert trueBranchBci <= bci && falseBranchBci > bci;
}
ValueNode trueValue = builder.append(ConstantNode.forBoolean(!negate));
ValueNode falseValue = builder.append(ConstantNode.forBoolean(negate));
ConditionalNode branchCondition = builder.append(new ConditionalNode(condition, trueValue, falseValue));
ProfileNode p = builder.append(new ProfileBranchNode(method, backedgeNotifyFreqLog(options), backedgeProfilePobabilityLog(options), branchCondition, bci, targetBci));
p.setStateBefore(frameState);
}
}
Aggregations