Mercurial > hg > graal-compiler
changeset 12768:2842b357c316
moved options guiding when to use profile info in compiled type checks to InstanceOfSnippets
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 14 Nov 2013 23:29:19 +0100 |
parents | 5a51864f3088 |
children | 99769479f9ce |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java |
diffstat | 2 files changed, 17 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Thu Nov 14 15:02:17 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Thu Nov 14 23:29:19 2013 +0100 @@ -26,9 +26,9 @@ 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.*; import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*; -import static com.oracle.graal.phases.GraalOptions.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; @@ -39,7 +39,7 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; -import com.oracle.graal.phases.*; +import com.oracle.graal.options.*; import com.oracle.graal.phases.util.*; import com.oracle.graal.replacements.*; import com.oracle.graal.replacements.Snippet.ConstantParameter; @@ -66,7 +66,7 @@ * example, if a method is compiled after being interpreted 10000 times, the deoptimizing * snippet will only be used for an instanceof if its profile indicates that less than 1 in * 100000 executions are for an object whose type is not one of the top N profiled types (where - * {@code N == } {@link GraalOptions#InstanceOfMaxHints}). + * {@code N == } {@link Options#TypeCheckMaxHints}). */ public static double hintHitProbabilityThresholdForDeoptimizingSnippet() { return 1.0D - (1.0D / (runtime().getConfig().compileThreshold * 10)); @@ -193,6 +193,19 @@ return trueValue; } + static class Options { + + // @formatter:off + @Option(help = "If the probability that a type check will hit one the profiled types (up to " + + "TypeCheckMaxHints) is below this value, the type check will be compiled without profiling info") + static final OptionValue<Double> TypeCheckMinProfileHitProbability = new OptionValue<>(0.5); + + @Option(help = "The maximum number of profiled types that will be used when compiling a profiled type check. " + + "Note that TypeCheckMinProfileHitProbability also influences whether profiling info is used in compiled type checks.") + static final OptionValue<Integer> TypeCheckMaxHints = new OptionValue<>(2); + // @formatter:on + } + public static class Templates extends InstanceOfSnippetsTemplates { private final SnippetInfo instanceofWithProfile = snippet(InstanceOfSnippets.class, "instanceofWithProfile"); @@ -210,7 +223,7 @@ if (replacer.instanceOf instanceof InstanceOfNode) { InstanceOfNode instanceOf = (InstanceOfNode) replacer.instanceOf; ValueNode object = instanceOf.object(); - TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), InstanceOfMinHintHitProbability.getValue(), InstanceOfMaxHints.getValue()); + TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), TypeCheckMinProfileHitProbability.getValue(), TypeCheckMaxHints.getValue()); final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type(); ConstantNode hub = ConstantNode.forConstant(type.klass(), providers.getMetaAccess(), instanceOf.graph());
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Thu Nov 14 15:02:17 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Thu Nov 14 23:29:19 2013 +0100 @@ -288,34 +288,4 @@ */ @Option(help = "") public static final OptionValue<Boolean> SnippetCounters = new OptionValue<>(false); - - /** - * If the probability that a checkcast will hit one the profiled types (up to {@link #CheckcastMaxHints}) - * is below this value, the checkcast will be compiled without hints. - */ - @Option(help = "") - public static final OptionValue<Double> CheckcastMinHintHitProbability = new OptionValue<>(0.5); - - /** - * The maximum number of hint types that will be used when compiling a checkcast for which - * profiling information is available. Note that {@link #CheckcastMinHintHitProbability} - * also influences whether hints are used. - */ - @Option(help = "") - public static final OptionValue<Integer> CheckcastMaxHints = new OptionValue<>(2); - - /** - * If the probability that an instanceof will hit one the profiled types (up to {@link #InstanceOfMaxHints}) - * is below this value, the instanceof will be compiled without hints. - */ - @Option(help = "") - public static final OptionValue<Double> InstanceOfMinHintHitProbability = new OptionValue<>(0.5); - - /** - * The maximum number of hint types that will be used when compiling an instanceof for which - * profiling information is available. Note that {@link #InstanceOfMinHintHitProbability} - * also influences whether hints are used. - */ - @Option(help = "") - public static final OptionValue<Integer> InstanceOfMaxHints = new OptionValue<>(2); }