< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/profiling/ProbabilisticProfileSnippets.java

Print this page

        

*** 23,33 **** package org.graalvm.compiler.hotspot.replacements.profiling; import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG; ! import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.config; import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.SLOW_PATH_PROBABILITY; import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability; import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER; import org.graalvm.compiler.api.replacements.Snippet; --- 23,36 ---- package org.graalvm.compiler.hotspot.replacements.profiling; import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG; ! import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.backedgeCounterOffset; ! import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.invocationCounterIncrement; ! import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.invocationCounterOffset; ! import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.invocationCounterShift; import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.SLOW_PATH_PROBABILITY; import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability; import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER; import org.graalvm.compiler.api.replacements.Snippet;
*** 77,91 **** public static native void methodInvocationEvent(@ConstantNodeParameter ForeignCallDescriptor descriptor, MethodCountersPointer counters); @Snippet public static void profileMethodEntryWithProbability(MethodCountersPointer counters, int random, int step, int stepLog, @ConstantParameter int freqLog, @ConstantParameter int probLog) { if (probability(1.0 / (1 << probLog), shouldProfile(probLog, random))) { ! int counterValue = counters.readInt(config(INJECTED_VMCONFIG).invocationCounterOffset) + ((config(INJECTED_VMCONFIG).invocationCounterIncrement * step) << probLog); ! counters.writeInt(config(INJECTED_VMCONFIG).invocationCounterOffset, counterValue); if (freqLog >= 0) { int mask = notificationMask(freqLog, probLog, stepLog); ! if (probability(SLOW_PATH_PROBABILITY, (counterValue & (mask << config(INJECTED_VMCONFIG).invocationCounterShift)) == 0)) { methodInvocationEvent(HotSpotBackend.INVOCATION_EVENT, counters); } } } } --- 80,94 ---- public static native void methodInvocationEvent(@ConstantNodeParameter ForeignCallDescriptor descriptor, MethodCountersPointer counters); @Snippet public static void profileMethodEntryWithProbability(MethodCountersPointer counters, int random, int step, int stepLog, @ConstantParameter int freqLog, @ConstantParameter int probLog) { if (probability(1.0 / (1 << probLog), shouldProfile(probLog, random))) { ! int counterValue = counters.readInt(invocationCounterOffset(INJECTED_VMCONFIG)) + ((invocationCounterIncrement(INJECTED_VMCONFIG) * step) << probLog); ! counters.writeInt(invocationCounterOffset(INJECTED_VMCONFIG), counterValue); if (freqLog >= 0) { int mask = notificationMask(freqLog, probLog, stepLog); ! if (probability(SLOW_PATH_PROBABILITY, (counterValue & (mask << invocationCounterShift(INJECTED_VMCONFIG))) == 0)) { methodInvocationEvent(HotSpotBackend.INVOCATION_EVENT, counters); } } } }
*** 95,108 **** @Snippet public static void profileBackedgeWithProbability(MethodCountersPointer counters, int random, int step, int stepLog, @ConstantParameter int freqLog, @ConstantParameter int probLog, int bci, int targetBci) { if (probability(1.0 / (1 << probLog), shouldProfile(probLog, random))) { ! int counterValue = counters.readInt(config(INJECTED_VMCONFIG).backedgeCounterOffset) + ((config(INJECTED_VMCONFIG).invocationCounterIncrement * step) << probLog); ! counters.writeInt(config(INJECTED_VMCONFIG).backedgeCounterOffset, counterValue); int mask = notificationMask(freqLog, probLog, stepLog); ! if (probability(SLOW_PATH_PROBABILITY, (counterValue & (mask << config(INJECTED_VMCONFIG).invocationCounterShift)) == 0)) { methodBackedgeEvent(HotSpotBackend.BACKEDGE_EVENT, counters, bci, targetBci); } } } --- 98,111 ---- @Snippet public static void profileBackedgeWithProbability(MethodCountersPointer counters, int random, int step, int stepLog, @ConstantParameter int freqLog, @ConstantParameter int probLog, int bci, int targetBci) { if (probability(1.0 / (1 << probLog), shouldProfile(probLog, random))) { ! int counterValue = counters.readInt(backedgeCounterOffset(INJECTED_VMCONFIG)) + ((invocationCounterIncrement(INJECTED_VMCONFIG) * step) << probLog); ! counters.writeInt(backedgeCounterOffset(INJECTED_VMCONFIG), counterValue); int mask = notificationMask(freqLog, probLog, stepLog); ! if (probability(SLOW_PATH_PROBABILITY, (counterValue & (mask << invocationCounterShift(INJECTED_VMCONFIG))) == 0)) { methodBackedgeEvent(HotSpotBackend.BACKEDGE_EVENT, counters, bci, targetBci); } } }
< prev index next >