1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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.OptionType; 29 import org.graalvm.compiler.options.OptionValue; 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 OptionValue<Boolean> TieredAOT = new OptionValue<>(false); 38 @Option(help = "Invocation notification frequency", type = OptionType.Expert)// 39 public static final OptionValue<Integer> TierAInvokeNotifyFreqLog = new OptionValue<>(13); 40 @Option(help = "Inlinee invocation notification frequency (-1 means count, but do not notify)", type = OptionType.Expert)// 41 public static final OptionValue<Integer> TierAInvokeInlineeNotifyFreqLog = new OptionValue<>(-1); 42 @Option(help = "Invocation profile probability", type = OptionType.Expert)// 43 public static final OptionValue<Integer> TierAInvokeProfileProbabilityLog = new OptionValue<>(8); 44 @Option(help = "Backedge notification frequency", type = OptionType.Expert)// 45 public static final OptionValue<Integer> TierABackedgeNotifyFreqLog = new OptionValue<>(16); 46 @Option(help = "Backedge profile probability", type = OptionType.Expert)// 47 public static final OptionValue<Integer> TierABackedgeProfileProbabilityLog = new OptionValue<>(12); 48 } 49 50 @Override 51 public boolean shouldProfile(GraphBuilderContext builder, ResolvedJavaMethod method) { 52 return super.shouldProfile(builder, method) && FingerprintUtil.getFingerprint(((HotSpotResolvedObjectType) method.getDeclaringClass())) != 0; 53 } 54 55 @Override 56 public int invokeNotifyFreqLog() { 57 return Options.TierAInvokeNotifyFreqLog.getValue(); 58 } 59 60 @Override 61 public int invokeInlineeNotifyFreqLog() { 62 return Options.TierAInvokeInlineeNotifyFreqLog.getValue(); 63 } 64 65 @Override 66 public int invokeProfilePobabilityLog() { 67 return Options.TierAInvokeProfileProbabilityLog.getValue(); 68 } 69 70 @Override 71 public int backedgeNotifyFreqLog() { 72 return Options.TierABackedgeNotifyFreqLog.getValue(); 73 } 74 75 @Override 76 public int backedgeProfilePobabilityLog() { 77 return Options.TierABackedgeProfileProbabilityLog.getValue(); 78 } 79 }