5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.graalvm.compiler.hotspot.meta;
24
25 import org.graalvm.compiler.hotspot.FingerprintUtil;
26 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
27 import org.graalvm.compiler.options.Option;
28 import org.graalvm.compiler.options.OptionKey;
29 import org.graalvm.compiler.options.OptionType;
30 import org.graalvm.compiler.options.OptionValues;
31
32 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
33 import jdk.vm.ci.meta.ResolvedJavaMethod;
34
35 public class HotSpotAOTProfilingPlugin extends HotSpotProfilingPlugin {
36 public static class Options {
37 @Option(help = "Do profiling and callbacks to tiered runtime", type = OptionType.User)//
38 public static final OptionKey<Boolean> TieredAOT = new OptionKey<>(false);
39 @Option(help = "Invocation notification frequency", type = OptionType.Expert)//
40 public static final OptionKey<Integer> TierAInvokeNotifyFreqLog = new OptionKey<>(13);
41 @Option(help = "Inlinee invocation notification frequency (-1 means count, but do not notify)", type = OptionType.Expert)//
42 public static final OptionKey<Integer> TierAInvokeInlineeNotifyFreqLog = new OptionKey<>(-1);
43 @Option(help = "Invocation profile probability", type = OptionType.Expert)//
44 public static final OptionKey<Integer> TierAInvokeProfileProbabilityLog = new OptionKey<>(8);
45 @Option(help = "Backedge notification frequency", type = OptionType.Expert)//
46 public static final OptionKey<Integer> TierABackedgeNotifyFreqLog = new OptionKey<>(16);
47 @Option(help = "Backedge profile probability", type = OptionType.Expert)//
48 public static final OptionKey<Integer> TierABackedgeProfileProbabilityLog = new OptionKey<>(12);
49 }
50
51 @Override
52 public boolean shouldProfile(GraphBuilderContext builder, ResolvedJavaMethod method) {
53 return super.shouldProfile(builder, method) && FingerprintUtil.getFingerprint(((HotSpotResolvedObjectType) method.getDeclaringClass())) != 0;
54 }
55
56 @Override
57 public int invokeNotifyFreqLog(OptionValues options) {
58 return Options.TierAInvokeNotifyFreqLog.getValue(options);
59 }
60
61 @Override
62 public int invokeInlineeNotifyFreqLog(OptionValues options) {
63 return Options.TierAInvokeInlineeNotifyFreqLog.getValue(options);
64 }
65
66 @Override
67 public int invokeProfilePobabilityLog(OptionValues options) {
68 return Options.TierAInvokeProfileProbabilityLog.getValue(options);
69 }
70
71 @Override
72 public int backedgeNotifyFreqLog(OptionValues options) {
73 return Options.TierABackedgeNotifyFreqLog.getValue(options);
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.graalvm.compiler.hotspot.meta;
24
25 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
26 import org.graalvm.compiler.options.Option;
27 import org.graalvm.compiler.options.OptionKey;
28 import org.graalvm.compiler.options.OptionType;
29 import org.graalvm.compiler.options.OptionValues;
30
31 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
32 import jdk.vm.ci.meta.ResolvedJavaMethod;
33
34 public class HotSpotAOTProfilingPlugin extends HotSpotProfilingPlugin {
35 public static class Options {
36 @Option(help = "Do profiling and callbacks to tiered runtime", type = OptionType.User)//
37 public static final OptionKey<Boolean> TieredAOT = new OptionKey<>(false);
38 @Option(help = "Invocation notification frequency", type = OptionType.Expert)//
39 public static final OptionKey<Integer> TierAInvokeNotifyFreqLog = new OptionKey<>(13);
40 @Option(help = "Inlinee invocation notification frequency (-1 means count, but do not notify)", type = OptionType.Expert)//
41 public static final OptionKey<Integer> TierAInvokeInlineeNotifyFreqLog = new OptionKey<>(-1);
42 @Option(help = "Invocation profile probability", type = OptionType.Expert)//
43 public static final OptionKey<Integer> TierAInvokeProfileProbabilityLog = new OptionKey<>(8);
44 @Option(help = "Backedge notification frequency", type = OptionType.Expert)//
45 public static final OptionKey<Integer> TierABackedgeNotifyFreqLog = new OptionKey<>(16);
46 @Option(help = "Backedge profile probability", type = OptionType.Expert)//
47 public static final OptionKey<Integer> TierABackedgeProfileProbabilityLog = new OptionKey<>(12);
48 }
49
50 @Override
51 public boolean shouldProfile(GraphBuilderContext builder, ResolvedJavaMethod method) {
52 return super.shouldProfile(builder, method) && ((HotSpotResolvedObjectType) method.getDeclaringClass()).getFingerprint() != 0;
53 }
54
55 @Override
56 public int invokeNotifyFreqLog(OptionValues options) {
57 return Options.TierAInvokeNotifyFreqLog.getValue(options);
58 }
59
60 @Override
61 public int invokeInlineeNotifyFreqLog(OptionValues options) {
62 return Options.TierAInvokeInlineeNotifyFreqLog.getValue(options);
63 }
64
65 @Override
66 public int invokeProfilePobabilityLog(OptionValues options) {
67 return Options.TierAInvokeProfileProbabilityLog.getValue(options);
68 }
69
70 @Override
71 public int backedgeNotifyFreqLog(OptionValues options) {
72 return Options.TierABackedgeNotifyFreqLog.getValue(options);
|