# HG changeset patch # User Roland Schatz # Date 1375434225 -7200 # Node ID 2da7f2efe6e281e6bd2d4791614643fbbb6181cd # Parent e2333d8c72b1abd8d5735689fa6041e024dc1728 Move inlining phases to HighTier. diff -r e2333d8c72b1 -r 2da7f2efe6e2 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 Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri Aug 02 11:03:45 2013 +0200 @@ -48,7 +48,6 @@ import com.oracle.graal.phases.schedule.*; import com.oracle.graal.phases.tiers.*; import com.oracle.graal.phases.verify.*; -import com.oracle.graal.virtual.phases.ea.*; /** * Static methods for orchestrating the compilation of a {@linkplain StructuredGraph graph}. @@ -58,8 +57,6 @@ // @formatter:off @Option(help = "") public static final OptionValue VerifyUsageWithEquals = new OptionValue<>(true); - @Option(help = "Enable inlining") - public static final OptionValue Inline = new OptionValue<>(true); // @formatter:on /** @@ -143,27 +140,7 @@ new VerifyUsageWithEquals(runtime, Register.class).apply(graph); } - CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue()); HighTierContext highTierContext = new HighTierContext(runtime, assumptions, replacements, cache, plan, optimisticOpts); - - if (OptCanonicalizer.getValue()) { - canonicalizer.apply(graph, highTierContext); - } - - if (Inline.getValue() && !plan.isPhaseDisabled(InliningPhase.class)) { - if (IterativeInlining.getValue()) { - new IterativeInliningPhase(canonicalizer).apply(graph, highTierContext); - } else { - new InliningPhase().apply(graph, highTierContext); - new DeadCodeEliminationPhase().apply(graph); - - if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) { - canonicalizer.apply(graph, highTierContext); - new IterativeConditionalEliminationPhase().apply(graph, highTierContext); - } - } - } - suites.getHighTier().apply(graph, highTierContext); MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target, optimisticOpts); diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Fri Aug 02 11:03:45 2013 +0200 @@ -26,6 +26,7 @@ import com.oracle.graal.loop.phases.*; import com.oracle.graal.nodes.spi.Lowerable.LoweringType; +import com.oracle.graal.options.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -33,9 +34,32 @@ public class HighTier extends PhaseSuite { + // @formatter:off + @Option(help = "Enable inlining") + public static final OptionValue Inline = new OptionValue<>(true); + // @formatter:on + public HighTier() { CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue()); + if (OptCanonicalizer.getValue()) { + appendPhase(canonicalizer); + } + + if (Inline.getValue()) { + if (IterativeInlining.getValue()) { + appendPhase(new IterativeInliningPhase(canonicalizer)); + } else { + appendPhase(new InliningPhase()); + appendPhase(new DeadCodeEliminationPhase()); + + if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) { + appendPhase(canonicalizer); + appendPhase(new IterativeConditionalEliminationPhase()); + } + } + } + appendPhase(new CleanTypeProfileProxyPhase()); if (FullUnroll.getValue()) { diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/AbstractInliningPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/AbstractInliningPhase.java Fri Aug 02 11:03:45 2013 +0200 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.phases.common; + +import com.oracle.graal.phases.*; +import com.oracle.graal.phases.tiers.*; + +/** + * Common superclass for phases that perform inlining. + */ +public abstract class AbstractInliningPhase extends BasePhase { +} diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Fri Aug 02 11:03:45 2013 +0200 @@ -38,18 +38,17 @@ import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; import com.oracle.graal.options.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer; import com.oracle.graal.phases.common.InliningUtil.InlineInfo; import com.oracle.graal.phases.common.InliningUtil.Inlineable; +import com.oracle.graal.phases.common.InliningUtil.InlineableGraph; import com.oracle.graal.phases.common.InliningUtil.InlineableMacroNode; -import com.oracle.graal.phases.common.InliningUtil.InlineableGraph; import com.oracle.graal.phases.common.InliningUtil.InliningPolicy; import com.oracle.graal.phases.graph.*; import com.oracle.graal.phases.tiers.*; -public class InliningPhase extends BasePhase { +public class InliningPhase extends AbstractInliningPhase { static class Options { diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java Fri Aug 02 11:03:45 2013 +0200 @@ -38,6 +38,10 @@ */ public class CompiledExceptionHandlerTest extends GraalCompilerTest { + public CompiledExceptionHandlerTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); + } + @Override protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { phasePlan.disablePhase(InliningPhase.class); diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java Fri Aug 02 11:03:45 2013 +0200 @@ -35,6 +35,10 @@ */ public class DeoptimizeOnExceptionTest extends GraalCompilerTest { + public DeoptimizeOnExceptionTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); + } + @Override protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { phasePlan.disablePhase(InliningPhase.class); diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Fri Aug 02 11:03:45 2013 +0200 @@ -42,6 +42,10 @@ */ public class InstanceOfTest extends TypeCheckTest { + public InstanceOfTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); + } + @Override protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { phasePlan.disablePhase(InliningPhase.class); diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InvokeTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InvokeTest.java Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InvokeTest.java Fri Aug 02 11:03:45 2013 +0200 @@ -35,6 +35,10 @@ */ public class InvokeTest extends GraalCompilerTest { + public InvokeTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); + } + @Override protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { phasePlan.disablePhase(InliningPhase.class); diff -r e2333d8c72b1 -r 2da7f2efe6e2 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java Fri Aug 02 11:00:57 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java Fri Aug 02 11:03:45 2013 +0200 @@ -29,11 +29,10 @@ import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; -public class IterativeInliningPhase extends BasePhase { +public class IterativeInliningPhase extends AbstractInliningPhase { private final CanonicalizerPhase canonicalizer;