# HG changeset patch # User Doug Simon # Date 1417029007 -3600 # Node ID 1c4209b4c1be33a61325979b53ea6d4dac2795dd # Parent 3b7dbb34bd9e49b95e117cddba8243fa0b65e49f removed static accesses to HotSpotGraalRuntime from InstanceOfSnippets diff -r 3b7dbb34bd9e -r 1c4209b4c1be graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Wed Nov 26 17:44:44 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Wed Nov 26 20:10:07 2014 +0100 @@ -84,7 +84,7 @@ assert target == providers.getCodeCache().getTarget(); checkcastDynamicSnippets = new CheckCastDynamicSnippets.Templates(providers, target); - instanceofSnippets = new InstanceOfSnippets.Templates(providers, target); + instanceofSnippets = new InstanceOfSnippets.Templates(providers, target, config.compileThreshold); newObjectSnippets = new NewObjectSnippets.Templates(providers, target); monitorSnippets = new MonitorSnippets.Templates(providers, target, config.useFastLocking); writeBarrierSnippets = new WriteBarrierSnippets.Templates(providers, target, config.useCompressedOops ? config.getOopEncoding() : null); diff -r 3b7dbb34bd9e -r 1c4209b4c1be graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Wed Nov 26 17:44:44 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Wed Nov 26 20:10:07 2014 +0100 @@ -24,7 +24,6 @@ import static com.oracle.graal.api.meta.DeoptimizationAction.*; import static com.oracle.graal.api.meta.DeoptimizationReason.*; -import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.hotspot.replacements.InstanceOfSnippets.Options.*; import static com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.*; @@ -70,15 +69,15 @@ * 100000 executions are for an object whose type is not one of the top N profiled types (where * {@code N == } {@link Options#TypeCheckMaxHints}). */ - public static double hintHitProbabilityThresholdForDeoptimizingSnippet() { - return 1.0D - (1.0D / (runtime().getConfig().compileThreshold * 10)); + public static double hintHitProbabilityThresholdForDeoptimizingSnippet(long compilationThreshold) { + return 1.0D - (1.0D / (compilationThreshold * 10)); } /** * A test against a set of hints derived from a profile with very close to 100% precise coverage * of seen types. This snippet deoptimizes on hint miss paths. * - * @see #hintHitProbabilityThresholdForDeoptimizingSnippet() + * @see #hintHitProbabilityThresholdForDeoptimizingSnippet(long) */ @Snippet public static Object instanceofWithProfile(Object object, @VarargsParameter KlassPointer[] hints, @VarargsParameter boolean[] hintIsPositive, Object trueValue, Object falseValue, @@ -215,9 +214,11 @@ private final SnippetInfo instanceofPrimary = snippet(InstanceOfSnippets.class, "instanceofPrimary"); private final SnippetInfo instanceofSecondary = snippet(InstanceOfSnippets.class, "instanceofSecondary"); private final SnippetInfo instanceofDynamic = snippet(InstanceOfSnippets.class, "instanceofDynamic"); + private final long compilationThreshold; - public Templates(HotSpotProviders providers, TargetDescription target) { + public Templates(HotSpotProviders providers, TargetDescription target, long compilationThreshold) { super(providers, providers.getSnippetReflection(), target); + this.compilationThreshold = compilationThreshold; } @Override @@ -232,7 +233,7 @@ Arguments args; StructuredGraph graph = instanceOf.graph(); - if (hintInfo.hintHitProbability >= hintHitProbabilityThresholdForDeoptimizingSnippet() && hintInfo.exact == null) { + if (hintInfo.hintHitProbability >= hintHitProbabilityThresholdForDeoptimizingSnippet(compilationThreshold) && hintInfo.exact == null) { Hints hints = createHints(hintInfo, providers.getMetaAccess(), false, graph); args = new Arguments(instanceofWithProfile, graph.getGuardsStage(), tool.getLoweringStage()); args.add("object", object); @@ -257,7 +258,7 @@ } args.add("trueValue", replacer.trueValue); args.add("falseValue", replacer.falseValue); - if (hintInfo.hintHitProbability >= hintHitProbabilityThresholdForDeoptimizingSnippet() && hintInfo.exact == null) { + if (hintInfo.hintHitProbability >= hintHitProbabilityThresholdForDeoptimizingSnippet(compilationThreshold) && hintInfo.exact == null) { args.addConst("nullSeen", hintInfo.profile.getNullSeen() != TriState.FALSE); } return args;