Search in sources :

Example 1 with ProfileBranchNode

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);
    }
}
Also used : ProfileBranchNode(org.graalvm.compiler.hotspot.nodes.profiling.ProfileBranchNode) OptionValues(org.graalvm.compiler.options.OptionValues) ProfileNode(org.graalvm.compiler.hotspot.nodes.profiling.ProfileNode)

Example 2 with ProfileBranchNode

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);
    }
}
Also used : ProfileBranchNode(org.graalvm.compiler.hotspot.nodes.profiling.ProfileBranchNode) ConditionalNode(org.graalvm.compiler.nodes.calc.ConditionalNode) OptionValues(org.graalvm.compiler.options.OptionValues) ProfileNode(org.graalvm.compiler.hotspot.nodes.profiling.ProfileNode) ValueNode(org.graalvm.compiler.nodes.ValueNode)

Aggregations

ProfileBranchNode (org.graalvm.compiler.hotspot.nodes.profiling.ProfileBranchNode)2 ProfileNode (org.graalvm.compiler.hotspot.nodes.profiling.ProfileNode)2 OptionValues (org.graalvm.compiler.options.OptionValues)2 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 ConditionalNode (org.graalvm.compiler.nodes.calc.ConditionalNode)1