# HG changeset patch # User Roland Schatz # Date 1370873169 -7200 # Node ID 3df534c97af104e0cdddb8fb519363e26bca12db # Parent 6b6d34f83eb12ce3af072b1092fb5aa242ced684 Create Suites instance in runtime. diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Mon Jun 10 16:06:09 2013 +0200 @@ -58,7 +58,7 @@ new PTXPhase().apply(graph); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(), ptxBackend, target, null, phasePlan, OptimisticOptimizations.NONE, - new SpeculationLog()); + new SpeculationLog(), suites); return result; } diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCTestBase.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCTestBase.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCTestBase.java Mon Jun 10 16:06:09 2013 +0200 @@ -55,9 +55,8 @@ GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(), - sparcBackend, target, null, phasePlan, OptimisticOptimizations.NONE, - new SpeculationLog()); + CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(), sparcBackend, target, null, phasePlan, + OptimisticOptimizations.NONE, new SpeculationLog(), suites); return result; } @@ -66,4 +65,3 @@ } } - diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Jun 10 16:06:09 2013 +0200 @@ -48,6 +48,7 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.phases.schedule.*; +import com.oracle.graal.phases.tiers.*; import com.oracle.graal.printer.*; import com.oracle.graal.test.*; import com.oracle.graal.hotspot.phases.WriteBarrierAdditionPhase; @@ -76,11 +77,13 @@ protected final GraalCodeCacheProvider runtime; protected final Replacements replacements; protected final Backend backend; + protected final Suites suites; public GraalCompilerTest() { this.replacements = Graal.getRequiredCapability(Replacements.class); this.runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class); this.backend = Graal.getRequiredCapability(Backend.class); + this.suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); } @BeforeClass @@ -434,7 +437,7 @@ editPhasePlan(method, graph, phasePlan); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime().getTarget(), null, phasePlan, OptimisticOptimizations.ALL, - new SpeculationLog()); + new SpeculationLog(), suites); if (printCompilation) { TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize())); } diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Mon Jun 10 16:06:09 2013 +0200 @@ -60,7 +60,7 @@ final StructuredGraph graph = parse(method); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, getDefaultPhasePlan(), - OptimisticOptimizations.ALL, new SpeculationLog()); + OptimisticOptimizations.ALL, new SpeculationLog(), suites); for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); if (sp instanceof Call) { @@ -82,7 +82,7 @@ assertTrue(graphLineSPs > 0); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, getDefaultPhasePlan(true), - OptimisticOptimizations.ALL, new SpeculationLog()); + OptimisticOptimizations.ALL, new SpeculationLog(), suites); int lineSPs = 0; for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Mon Jun 10 16:06:09 2013 +0200 @@ -119,7 +119,7 @@ @Override public LIR call() { - return GraalCompiler.emitHIR(runtime, backend.target, graph, replacements, assumptions, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog()); + return GraalCompiler.emitHIR(runtime, backend.target, graph, replacements, assumptions, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog(), suites); } }); diff -r 6b6d34f83eb1 -r 3df534c97af1 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 Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Jun 10 16:06:09 2013 +0200 @@ -75,7 +75,7 @@ */ public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final GraalCodeCacheProvider runtime, final Replacements replacements, final Backend backend, final TargetDescription target, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts, - final SpeculationLog speculationLog) { + final SpeculationLog speculationLog, final Suites suites) { final CompilationResult compilationResult = new CompilationResult(); Debug.scope("GraalCompiler", new Object[]{graph, runtime}, new Runnable() { @@ -84,7 +84,7 @@ final LIR lir = Debug.scope("FrontEnd", new Callable() { public LIR call() { - return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog); + return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog, suites); } }); final LIRGenerator lirGen = Debug.scope("BackEnd", lir, new Callable() { @@ -124,7 +124,7 @@ * @param target */ public static LIR emitHIR(GraalCodeCacheProvider runtime, TargetDescription target, final StructuredGraph graph, Replacements replacements, Assumptions assumptions, GraphCache cache, - PhasePlan plan, OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog) { + PhasePlan plan, OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog, final Suites suites) { if (speculationLog != null) { speculationLog.snapshot(); @@ -164,15 +164,15 @@ TypeProfileProxyNode.cleanFromGraph(graph); plan.runPhases(PhasePosition.HIGH_LEVEL, graph); - Suites.DEFAULT.getHighTier().apply(graph, highTierContext); + suites.getHighTier().apply(graph, highTierContext); MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target, optimisticOpts); - Suites.DEFAULT.getMidTier().apply(graph, midTierContext); + suites.getMidTier().apply(graph, midTierContext); plan.runPhases(PhasePosition.LOW_LEVEL, graph); LowTierContext lowTierContext = new LowTierContext(runtime, assumptions, replacements, target); - Suites.DEFAULT.getLowTier().apply(graph, lowTierContext); + suites.getLowTier().apply(graph, lowTierContext); // we do not want to store statistics about OSR compilations because it may prevent inlining boolean isOSRCompilation = graph.start() instanceof OSRStartNode; diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Mon Jun 10 16:06:09 2013 +0200 @@ -85,7 +85,7 @@ editPhasePlan(method, graph, phasePlan); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime().getTarget(), null, phasePlan, OptimisticOptimizations.ALL, - new SpeculationLog()); + new SpeculationLog(), suites); addMethod(method, compResult, graphCopy); OptCanonicalizeReads.setValue(originalSetting); diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Mon Jun 10 16:06:09 2013 +0200 @@ -41,6 +41,7 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; public final class CompilationTask implements Runnable, Comparable { @@ -57,6 +58,7 @@ private final HotSpotGraalRuntime graalRuntime; private final PhasePlan plan; + private final SuitesProvider suitesProvider; private final OptimisticOptimizations optimisticOpts; private final HotSpotResolvedJavaMethod method; private final int entryBCI; @@ -72,6 +74,7 @@ private CompilationTask(HotSpotGraalRuntime graalRuntime, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotResolvedJavaMethod method, int entryBCI, int id, int priority) { this.graalRuntime = graalRuntime; this.plan = plan; + this.suitesProvider = graalRuntime.getCapability(SuitesProvider.class); this.method = method; this.optimisticOpts = optimisticOpts; this.entryBCI = entryBCI; @@ -165,7 +168,7 @@ HotSpotRuntime runtime = graalRuntime.getRuntime(); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); return GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, graalRuntime.getBackend(), graalRuntime.getTarget(), graalRuntime.getCache(), plan, optimisticOpts, - method.getSpeculationLog()); + method.getSpeculationLog(), suitesProvider.getDefaultSuites()); } }); } finally { diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Mon Jun 10 16:06:09 2013 +0200 @@ -38,6 +38,7 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.options.*; import com.oracle.graal.phases.*; +import com.oracle.graal.phases.tiers.*; //import static com.oracle.graal.phases.GraalOptions.*; @@ -318,7 +319,7 @@ if (clazz == GraalCodeCacheProvider.class || clazz == CodeCacheProvider.class || clazz == MetaAccessProvider.class) { return (T) getRuntime(); } - if (clazz == DisassemblerProvider.class || clazz == BytecodeDisassemblerProvider.class) { + if (clazz == DisassemblerProvider.class || clazz == BytecodeDisassemblerProvider.class || clazz == SuitesProvider.class) { return (T) getRuntime(); } if (clazz == HotSpotRuntime.class) { diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon Jun 10 16:06:09 2013 +0200 @@ -86,6 +86,7 @@ import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.virtual.*; +import com.oracle.graal.phases.tiers.*; import com.oracle.graal.printer.*; import com.oracle.graal.replacements.*; import com.oracle.graal.word.*; @@ -93,7 +94,7 @@ /** * HotSpot implementation of {@link GraalCodeCacheProvider}. */ -public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider { +public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider, SuitesProvider { public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class); public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class); @@ -104,6 +105,7 @@ protected final RegisterConfig regConfig; protected final HotSpotGraalRuntime graalRuntime; + private final Suites defaultSuites; private CheckCastSnippets.Templates checkcastSnippets; private InstanceOfSnippets.Templates instanceofSnippets; @@ -179,6 +181,7 @@ this.config = c; this.graalRuntime = graalRuntime; regConfig = createRegisterConfig(); + defaultSuites = createSuites(); } protected abstract RegisterConfig createRegisterConfig(); @@ -1059,4 +1062,12 @@ public String disassemble(ResolvedJavaMethod method) { return new BytecodeDisassembler().disassemble(method); } + + public Suites getDefaultSuites() { + return defaultSuites; + } + + public Suites createSuites() { + return Suites.createDefaultSuites(); + } } diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Mon Jun 10 16:06:09 2013 +0200 @@ -156,7 +156,7 @@ phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); CallingConvention cc = linkage.getCallingConvention(); final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, getInstalledCodeOwner(), runtime, replacements, backend, runtime.getTarget(), null, phasePlan, - OptimisticOptimizations.ALL, new SpeculationLog()); + OptimisticOptimizations.ALL, new SpeculationLog(), runtime.getDefaultSuites()); assert destroyedRegisters != null; code = Debug.scope("CodeInstall", new Callable() { diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Mon Jun 10 15:41:26 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Mon Jun 10 16:06:09 2013 +0200 @@ -35,8 +35,6 @@ private static final OptionValue CompilerConfiguration = new OptionValue<>("basic"); // @formatter:on - public static final Suites DEFAULT; - private final PhaseSuite highTier; private final PhaseSuite midTier; private final PhaseSuite lowTier; @@ -64,8 +62,6 @@ } configurations.put(name.toLowerCase(), config); } - - DEFAULT = createDefaultSuites(); } private Suites(CompilerConfiguration config) { diff -r 6b6d34f83eb1 -r 3df534c97af1 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/SuitesProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/SuitesProvider.java Mon Jun 10 16:06:09 2013 +0200 @@ -0,0 +1,37 @@ +/* + * 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.tiers; + +public interface SuitesProvider { + + /** + * Get the default phase suites of this compiler. + */ + Suites getDefaultSuites(); + + /** + * Create a new set of phase suites. Initially, the suites are the same as the + * {@link #getDefaultSuites default} suites. + */ + Suites createSuites(); +}