--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationCounters.java 2017-03-20 17:38:27.000000000 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationCounters.java 2017-03-20 17:38:27.000000000 -0700 @@ -24,7 +24,6 @@ import static org.graalvm.compiler.hotspot.HotSpotGraalCompiler.fmt; import static org.graalvm.compiler.hotspot.HotSpotGraalCompiler.str; - import java.util.Comparator; import java.util.HashMap; import java.util.Map; @@ -35,9 +34,8 @@ import org.graalvm.compiler.debug.TTY; import org.graalvm.compiler.options.Option; import org.graalvm.compiler.options.OptionType; -import org.graalvm.compiler.options.OptionValue; -import org.graalvm.compiler.options.StableOptionValue; - +import org.graalvm.compiler.options.OptionValues; +import org.graalvm.compiler.options.OptionKey; import jdk.vm.ci.code.CompilationRequest; import jdk.vm.ci.meta.ResolvedJavaMethod; @@ -47,12 +45,15 @@ // @formatter:off @Option(help = "The number of compilations allowed for any method before " + "the VM exits (a value of 0 means there is no limit).", type = OptionType.Debug) - public static final OptionValue CompilationCountLimit = new StableOptionValue<>(0); + public static final OptionKey CompilationCountLimit = new OptionKey<>(0); // @formatter:on } - CompilationCounters() { + private final OptionValues options; + + CompilationCounters(OptionValues options) { TTY.println("Warning: Compilation counters enabled, excessive recompilation of a method will cause a failure!"); + this.options = options; } private final Map counters = new HashMap<>(); @@ -68,16 +69,16 @@ Integer val = counters.get(method); val = val != null ? val + 1 : 1; counters.put(method, val); - if (val > Options.CompilationCountLimit.getValue()) { + if (val > Options.CompilationCountLimit.getValue(options)) { TTY.printf("Error. Method %s was compiled too many times. Number of compilations: %d\n", fmt(method), - CompilationCounters.Options.CompilationCountLimit.getValue()); + CompilationCounters.Options.CompilationCountLimit.getValue(options)); TTY.println("==================================== High compilation counters ===================================="); SortedSet> sortedCounters = new TreeSet<>(new CounterComparator()); for (Map.Entry e : counters.entrySet()) { sortedCounters.add(e); } for (Map.Entry entry : sortedCounters) { - if (entry.getValue() >= Options.CompilationCountLimit.getValue() / 2) { + if (entry.getValue() >= Options.CompilationCountLimit.getValue(options) / 2) { TTY.out.printf("%d\t%s%n", entry.getValue(), str(entry.getKey())); } }