# HG changeset patch # User Lukas Stadler # Date 1352297430 -3600 # Node ID e75c3dd32c5ba584d986a53c00e0f872735917be # Parent 3dddb311395f25fe8ddf70e6a1ba9b6e9a263961# Parent abd5b49a26fd7190a28a7e161c2e95fd175734ae Merge. diff -r 3dddb311395f -r e75c3dd32c5b graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Nov 07 14:52:12 2012 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Nov 07 15:10:30 2012 +0100 @@ -168,7 +168,7 @@ new CullFrameStatesPhase().apply(graph); } - if (GraalOptions.FloatingReads) { + if (GraalOptions.OptFloatingReads) { int mark = graph.getMark(); new FloatingReadPhase().apply(graph); new CanonicalizerPhase(target, runtime, assumptions, mark, null).apply(graph); @@ -186,12 +186,18 @@ new CanonicalizerPhase(target, runtime, assumptions).apply(graph); } - new EliminatePartiallyRedundantGuardsPhase().apply(graph); + if (GraalOptions.OptEliminatePartiallyRedundantGuards) { + new EliminatePartiallyRedundantGuardsPhase(false, true).apply(graph); + } if (GraalOptions.CheckCastElimination && GraalOptions.OptCanonicalizer) { new IterativeConditionalEliminationPhase(target, runtime, assumptions).apply(graph); } + if (GraalOptions.OptEliminatePartiallyRedundantGuards) { + new EliminatePartiallyRedundantGuardsPhase(true, true).apply(graph); + } + plan.runPhases(PhasePosition.MID_LEVEL, graph); plan.runPhases(PhasePosition.LOW_LEVEL, graph); diff -r 3dddb311395f -r e75c3dd32c5b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java Wed Nov 07 14:52:12 2012 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java Wed Nov 07 15:10:30 2012 +0100 @@ -178,7 +178,7 @@ ValueNode trueValue = replacer.trueValue; ValueNode falseValue = replacer.falseValue; ValueNode object = instanceOf.object(); - TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), GraalOptions.CheckcastMinHintHitProbability, GraalOptions.CheckcastMaxHints); + TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), GraalOptions.InstanceOfMinHintHitProbability, GraalOptions.InstanceOfMaxHints); final HotSpotResolvedJavaType type = (HotSpotResolvedJavaType) instanceOf.type(); ConstantNode hub = ConstantNode.forObject(type.klassOop(), runtime, instanceOf.graph()); boolean checkNull = !object.stamp().nonNull(); diff -r 3dddb311395f -r e75c3dd32c5b graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Wed Nov 07 14:52:12 2012 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Wed Nov 07 15:10:30 2012 +0100 @@ -210,7 +210,7 @@ graph.removeFloating((FloatingNode) node); } else { // case 2 - assert !(canonical instanceof FixedNode) || (canonical.predecessor() != null || canonical instanceof StartNode) : node + " -> " + canonical + + assert !(canonical instanceof FixedNode) || (canonical.predecessor() != null || canonical instanceof StartNode || canonical instanceof MergeNode) : node + " -> " + canonical + " : replacement should be floating or fixed and connected"; graph.replaceFloating((FloatingNode) node, canonical); } diff -r 3dddb311395f -r e75c3dd32c5b graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java Wed Nov 07 14:52:12 2012 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java Wed Nov 07 15:10:30 2012 +0100 @@ -38,6 +38,16 @@ private static final DebugMetric metricPRGuardsEliminatedAtMerge = Debug.metric("PRGuardsEliminatedAtMerge"); private static final DebugMetric metricPRGuardsEliminatedAtSplit = Debug.metric("PRGuardsEliminatedAtSplit"); + private static final DebugMetric metricPRGuardsDifferentGraphId = Debug.metric("PRGuardsDifferentGraphId"); + + private final boolean eliminateAtSplit; + private final boolean eliminateAtMerge; + + public EliminatePartiallyRedundantGuardsPhase(boolean eliminateAtSplit, boolean eliminateAtMerge) { + assert eliminateAtMerge || eliminateAtSplit; + this.eliminateAtSplit = eliminateAtSplit; + this.eliminateAtMerge = eliminateAtMerge; + } private static class Condition { final BooleanNode conditionNode; @@ -85,11 +95,15 @@ boolean hits; do { hits = false; - for (MergeNode merge : graph.getNodes(MergeNode.class)) { - hits |= eliminateAtMerge(merge); + if (eliminateAtMerge) { + for (MergeNode merge : graph.getNodes(MergeNode.class)) { + hits |= eliminateAtMerge(merge); + } } - for (ControlSplitNode controlSplit : graph.getNodes().filter(ControlSplitNode.class)) { - hits |= eliminateAtControlSplit(controlSplit); + if (eliminateAtSplit) { + for (ControlSplitNode controlSplit : graph.getNodes().filter(ControlSplitNode.class)) { + hits |= eliminateAtControlSplit(controlSplit); + } } } while(hits); } @@ -174,7 +188,9 @@ if (leafGraphId == -1) { leafGraphId = guard.getLeafGraphId(); } else if (leafGraphId != guard.getLeafGraphId()) { + metricPRGuardsDifferentGraphId.increment(); leafGraphId = -1; + break; } } if (leafGraphId < 0) { diff -r 3dddb311395f -r e75c3dd32c5b graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Wed Nov 07 14:52:12 2012 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Wed Nov 07 15:10:30 2012 +0100 @@ -52,7 +52,6 @@ public static int SmallCompiledCodeSize = 2200; public static boolean LimitInlinedProbability = ____; // WeightBasedInliningPolicy (0) - public static boolean ParseBeforeInlining = ____; public static float InliningSizePenaltyExp = 20; public static float MaximumInlineWeight = 1.25f; public static float InliningSizePenalty = 1; @@ -98,9 +97,6 @@ public static int GraphCacheSize = 1000; public static boolean PrintGraphCache = ____; - //rematerialize settings - public static float MinimumUsageProbability = 0.95f; - //loop transform settings TODO (gd) tune public static boolean LoopPeeling = true; public static boolean ReassociateInvariants = true; @@ -122,10 +118,6 @@ public static String PrintFilter = null; - // printing settings - public static boolean PrintLIR = ____; - public static boolean PrintCFGToFile = ____; - // Debug settings: public static boolean Debug = true; public static boolean PerThreadDebugValues = ____; @@ -151,24 +143,16 @@ public static boolean PrintQueue = ____; public static boolean PrintCompilation = ____; public static boolean PrintProfilingInformation = ____; - public static boolean PrintXirTemplates = ____; public static boolean PrintIRWithLIR = ____; - public static boolean PrintAssembly = ____; public static boolean PrintCodeBytes = ____; - public static int PrintAssemblyBytesPerLine = 16; public static boolean PrintBailout = ____; public static int TraceLinearScanLevel = 0; - public static boolean TraceRegisterAllocation = false; public static int TraceLIRGeneratorLevel = 0; public static boolean TraceEscapeAnalysis = ____; public static int TraceBytecodeParserLevel = 0; - public static boolean PrintBailouts = true; public static boolean ExitVMOnBailout = ____; public static boolean ExitVMOnException = true; - // state merging settings - public static boolean AssumeVerifiedBytecode = true; - // Code generator settings public static boolean CheckCastElimination = true; public static boolean CullFrameStates = ____; @@ -182,7 +166,6 @@ static boolean UseTypeCheckHints = true; public static boolean InlineVTableStubs = true; public static boolean AlwaysInlineVTableStubs = ____; - public static boolean GenAssertionCode = ____; public static boolean AlignCallsForPatching = true; public static boolean ResolveClassBeforeStaticInvoke = true; @@ -195,33 +178,23 @@ public static boolean DetailedAsserts = ____; // Runtime settings - public static int ReadPrefetchInstr = 0; public static int StackShadowPages = 2; - // Assembler settings - public static boolean CommentedAssembly = ____; - public static boolean PrintLIRWithAssembly = ____; - public static boolean SupportJsrBytecodes = true; public static boolean OptAssumptions = true; public static boolean OptReadElimination = true; - public static boolean OptGVN = true; public static boolean OptCanonicalizer = true; - public static boolean ScheduleOutOfLoops = true; + public static boolean OptScheduleOutOfLoops = true; public static boolean OptReorderLoops = true; public static boolean OptEliminateGuards = true; public static boolean OptImplicitNullChecks = true; public static boolean OptLivenessAnalysis = true; public static boolean OptLoopTransform = true; public static boolean OptSafepointElimination = true; - public static boolean FloatingReads = true; + public static boolean OptFloatingReads = true; public static boolean OptTailDuplication = true; - - /** - * Prints all the available GraalOptions. - */ - public static boolean PrintFlags = false; + public static boolean OptEliminatePartiallyRedundantGuards = true; /** * Counts the various paths taken through snippets. @@ -249,11 +222,10 @@ /** * @see #CheckcastMaxHints */ - public static int InstanceOfMaxHints = 1; + public static int InstanceOfMaxHints = 2; static { // turn detailed assertions on when the general assertions are on (misusing the assert keyword for this) assert (DetailedAsserts = true) == true; - assert (CommentedAssembly = true) == true; } } diff -r 3dddb311395f -r e75c3dd32c5b graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Nov 07 14:52:12 2012 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Nov 07 15:10:30 2012 +0100 @@ -127,7 +127,7 @@ Block block; if (latestBlock == null) { block = earliestBlock(node); - } else if (GraalOptions.ScheduleOutOfLoops && !(node instanceof VirtualObjectNode)) { + } else if (GraalOptions.OptScheduleOutOfLoops && !(node instanceof VirtualObjectNode)) { Block earliestBlock = earliestBlock(node); block = scheduleOutOfLoops(node, latestBlock, earliestBlock); assert earliestBlock.dominates(block) : "Graph can not be scheduled : inconsistent for " + node + " (" + earliestBlock + " needs to dominate " + block + ")";