# HG changeset patch # User Thomas Wuerthinger # Date 1394550984 -3600 # Node ID 4eac66a9b87d78a77be4cea9d39077589b0a53ea # Parent 3a30575968cdf8efeeaf10fa2f311cdb9b5383be Remove reference to graph in LIRGenerator. diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Tue Mar 11 16:16:24 2014 +0100 @@ -135,7 +135,7 @@ } @Override - public void emitPrologue() { + public void emitPrologue(StructuredGraph graph) { // Need to emit .param directives based on incoming arguments and return value CallingConvention incomingArguments = cc; Object returnObject = incomingArguments.getReturn(); diff -r 3a30575968cd -r 4eac66a9b87d 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 Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Tue Mar 11 16:16:24 2014 +0100 @@ -46,6 +46,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.graph.Node.Verbosity; import com.oracle.graal.java.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; @@ -500,7 +501,7 @@ private CompilationResult compileBaseline(ResolvedJavaMethod javaMethod) { try (Scope bds = Debug.scope("compileBaseline")) { BaselineCompiler baselineCompiler = new BaselineCompiler(GraphBuilderConfiguration.getDefault(), providers.getMetaAccess()); - baselineCompiler.generate(javaMethod, -1); + LIR lir = baselineCompiler.generate(javaMethod, -1); return null; } catch (Throwable e) { throw Debug.handle(e); @@ -661,8 +662,8 @@ protected CompilationResult compile(ResolvedJavaMethod method, final StructuredGraph graph) { CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); - return compileGraph(graph, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), - getSpeculationLog(), getSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default); + return compileGraph(graph, null, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, + getProfilingInfo(graph), getSpeculationLog(), getSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default); } protected SpeculationLog getSpeculationLog() { diff -r 3a30575968cd -r 4eac66a9b87d 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 Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Tue Mar 11 16:16:24 2014 +0100 @@ -62,7 +62,7 @@ final Method method = getMethod("testMethod"); final StructuredGraph graph = parse(method); CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); - final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), + final CompilationResult cr = compileGraph(graph, null, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), null, getSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default); for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); @@ -85,7 +85,7 @@ assertTrue(graphLineSPs > 0); CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); PhaseSuite graphBuilderSuite = getCustomGraphBuilderSuite(GraphBuilderConfiguration.getEagerInfopointDefault()); - final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, + final CompilationResult cr = compileGraph(graph, null, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), getSpeculationLog(), getSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default); int lineSPs = 0; for (Infopoint sp : cr.getInfopoints()) { diff -r 3a30575968cd -r 4eac66a9b87d 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 Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Tue Mar 11 16:16:24 2014 +0100 @@ -120,7 +120,7 @@ } CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); - LIRGenerator lirGen = GraalCompiler.emitLIR(getBackend(), getBackend().getTarget(), schedule, graph, cc); + LIRGenerator lirGen = GraalCompiler.emitLIR(getBackend(), getBackend().getTarget(), schedule, graph, null, cc); return new RegisterStats(lirGen.lir); } } diff -r 3a30575968cd -r 4eac66a9b87d 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 Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Mar 11 16:16:24 2014 +0100 @@ -135,7 +135,7 @@ * should be used for the compilation * @return the result of the compilation */ - public static T compileGraph(StructuredGraph graph, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend, + public static T compileGraph(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend, TargetDescription target, GraphCache cache, PhaseSuite graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites, boolean withScope, T compilationResult, CompilationResultBuilderFactory factory) { assert !graph.isFrozen(); @@ -149,7 +149,7 @@ } try (TimerCloseable a = BackEnd.start()) { LIRGenerator lirGen = null; - lirGen = emitLIR(backend, target, schedule, graph, cc); + lirGen = emitLIR(backend, target, schedule, graph, stub, cc); try (Scope s = Debug.scope("CodeGen", lirGen)) { emitCode(backend, getLeafGraphIdArray(graph), assumptions, lirGen, compilationResult, installedCodeOwner, factory); } catch (Throwable e) { @@ -223,18 +223,18 @@ } - private static void emitBlock(LIRGenerator lirGen, Block b) { + private static void emitBlock(LIRGenerator lirGen, Block b, StructuredGraph graph, BlockMap> blockMap) { if (lirGen.lir.lir(b) == null) { for (Block pred : b.getPredecessors()) { if (!b.isLoopHeader() || !pred.isLoopEnd()) { - emitBlock(lirGen, pred); + emitBlock(lirGen, pred, graph, blockMap); } } - lirGen.doBlock(b); + lirGen.doBlock(b, graph, blockMap); } } - public static LIRGenerator emitLIR(Backend backend, TargetDescription target, SchedulePhase schedule, StructuredGraph graph, CallingConvention cc) { + public static LIRGenerator emitLIR(Backend backend, TargetDescription target, SchedulePhase schedule, StructuredGraph graph, Object stub, CallingConvention cc) { Block[] blocks = schedule.getCFG().getBlocks(); Block startBlock = schedule.getCFG().getStartBlock(); assert startBlock != null; @@ -257,11 +257,11 @@ } try (Scope ds = Debug.scope("BackEnd", lir)) { FrameMap frameMap = backend.newFrameMap(); - LIRGenerator lirGen = backend.newLIRGenerator(graph, frameMap, cc, lir); + LIRGenerator lirGen = backend.newLIRGenerator(graph, stub, frameMap, cc, lir); try (Scope s = Debug.scope("LIRGen", lirGen)) { for (Block b : lir.linearScanOrder()) { - emitBlock(lirGen, b); + emitBlock(lirGen, b, graph, schedule.getBlockToNodesMap()); } lirGen.beforeRegisterAllocation(); @@ -282,7 +282,7 @@ EdgeMoveOptimizer.optimize(lir); ControlFlowOptimizer.optimize(lir); if (lirGen.canEliminateRedundantMoves()) { - RedundantMoveElimination.optimize(lir, frameMap, lirGen.getGraph().method()); + RedundantMoveElimination.optimize(lir, frameMap); } NullCheckOptimizer.optimize(lir, target.implicitNullCheckLimit); diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Mar 11 16:16:24 2014 +0100 @@ -897,25 +897,9 @@ return null; } - private static StructuredGraph getGraphFromDebugContext() { - LIRGenerator gen = getLIRGeneratorFromDebugContext(); - if (gen != null) { - return gen.getGraph(); - } - return null; - } - - private static ResolvedJavaMethod getMethodFromDebugContext() { - StructuredGraph graph = getGraphFromDebugContext(); - if (graph != null) { - return graph.method(); - } - return null; - } - private void reportFailure(int numBlocks) { try (Scope s = Debug.forceLog()) { - Indent indent = Debug.logAndIndent("report failure, graph: %s", getGraphFromDebugContext()); + Indent indent = Debug.logAndIndent("report failure"); BitSet startBlockLiveIn = blockData.get(ir.cfg.getStartBlock()).liveIn; try (Indent indent2 = Debug.logAndIndent("Error: liveIn set of first block must be empty (when this fails, variables are used before they are defined):")) { @@ -1873,7 +1857,7 @@ /* * This is the point to enable debug logging for the whole register allocation. */ - Indent indent = Debug.logAndIndent("LinearScan allocate %s", getMethodFromDebugContext()); + Indent indent = Debug.logAndIndent("LinearScan allocate"); try (Scope s = Debug.scope("LifetimeAnalysis")) { numberInstructions(); diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Tue Mar 11 16:16:24 2014 +0100 @@ -72,7 +72,6 @@ public final NodeMap nodeOperands; public final LIR lir; - protected final StructuredGraph graph; private final Providers providers; protected final CallingConvention cc; @@ -172,7 +171,6 @@ public abstract boolean canStoreConstant(Constant c, boolean isCompressed); public LIRGenerator(StructuredGraph graph, Providers providers, FrameMap frameMap, CallingConvention cc, LIR lir) { - this.graph = graph; this.providers = providers; this.frameMap = frameMap; this.cc = cc; @@ -220,10 +218,6 @@ return providers.getForeignCalls(); } - public StructuredGraph getGraph() { - return graph; - } - /** * Determines whether the code being generated makes at least one foreign call. */ @@ -415,7 +409,7 @@ lir.lir(currentBlock).add(op); } - public void doBlock(Block block) { + public void doBlock(Block block, StructuredGraph graph, BlockMap> blockMap) { if (printIRWithLIR) { TTY.print(block.toString()); } @@ -434,12 +428,12 @@ if (block == lir.cfg.getStartBlock()) { assert block.getPredecessorCount() == 0; - emitPrologue(); + emitPrologue(graph); } else { assert block.getPredecessorCount() > 0; } - List nodes = lir.nodesFor(block); + List nodes = blockMap.get(block); for (int i = 0; i < nodes.size(); i++) { Node instr = nodes.get(i); if (traceLevel >= 3) { @@ -528,7 +522,7 @@ } } - protected void emitPrologue() { + protected void emitPrologue(StructuredGraph graph) { CallingConvention incomingArguments = cc; Value[] params = new Value[incomingArguments.getArgumentCount()]; diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Tue Mar 11 16:16:24 2014 +0100 @@ -65,7 +65,7 @@ public abstract FrameMap newFrameMap(); - public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir); + public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir); /** * Creates the assembler used to emit the machine code. diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Tue Mar 11 16:16:24 2014 +0100 @@ -72,8 +72,8 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new AMD64HotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir); + public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) { + return new AMD64HotSpotLIRGenerator(graph, stub, getProviders(), getRuntime().getConfig(), frameMap, cc, lir); } /** diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Tue Mar 11 16:16:24 2014 +0100 @@ -71,10 +71,13 @@ private final HotSpotVMConfig config; - protected AMD64HotSpotLIRGenerator(StructuredGraph graph, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) { + private final Object stub; + + protected AMD64HotSpotLIRGenerator(StructuredGraph graph, Object stub, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) { super(graph, providers, frameMap, cc, lir); assert config.basicLockSize == 8; this.config = config; + this.stub = stub; } @Override @@ -154,7 +157,7 @@ } @Override - protected void emitPrologue() { + protected void emitPrologue(StructuredGraph graph) { CallingConvention incomingArguments = cc; @@ -205,7 +208,7 @@ @Override protected boolean needOnlyOopMaps() { // Stubs only need oop maps - return graph.start() instanceof StubStartNode; + return stub != null; } /** @@ -233,22 +236,18 @@ } Stub getStub() { - if (graph.start() instanceof StubStartNode) { - return ((StubStartNode) graph.start()).getStub(); - } - return null; + return (Stub) stub; } @Override public Variable emitForeignCall(ForeignCallLinkage linkage, DeoptimizingNode info, Value... args) { - Stub stub = getStub(); boolean destroysRegisters = linkage.destroysRegisters(); AMD64SaveRegistersOp save = null; StackSlot[] savedRegisterLocations = null; if (destroysRegisters) { - if (stub != null) { - if (stub.preservesRegisters()) { + if (getStub() != null) { + if (getStub().preservesRegisters()) { Register[] savedRegisters = frameMap.registerConfig.getAllocatableRegisters(); savedRegisterLocations = new StackSlot[savedRegisters.length]; for (int i = 0; i < savedRegisters.length; i++) { @@ -275,8 +274,8 @@ } if (destroysRegisters) { - if (stub != null) { - if (stub.preservesRegisters()) { + if (getStub() != null) { + if (getStub().preservesRegisters()) { assert !calleeSaveInfo.containsKey(currentRuntimeCallInfo); calleeSaveInfo.put(currentRuntimeCallInfo, save); diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue Mar 11 16:16:24 2014 +0100 @@ -132,8 +132,8 @@ graphBuilderSuite.appendPhase(new NonNullParametersPhase()); CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); Suites suites = providers.getSuites().getDefaultSuites(); - ExternalCompilationResult hsailCode = compileGraph(graph, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph), null, - suites, true, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default); + ExternalCompilationResult hsailCode = compileGraph(graph, null, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph), + null, suites, true, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default); if (makeBinary) { if (!deviceInitialized) { @@ -188,7 +188,7 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { + public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) { return new HSAILHotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir); } diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Tue Mar 11 16:16:24 2014 +0100 @@ -204,8 +204,8 @@ PhaseSuite graphBuilderSuite = providers.getSuites().getDefaultGraphBuilderSuite(); graphBuilderSuite.appendPhase(new NonNullParametersPhase()); Suites suites = providers.getSuites().getDefaultSuites(); - ExternalCompilationResult ptxCode = compileGraph(graph, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph), null, - suites, true, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default); + ExternalCompilationResult ptxCode = compileGraph(graph, null, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph), + null, suites, true, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default); if (makeBinary) { try (Scope ds = Debug.scope("GeneratingKernelBinary")) { assert ptxCode.getTargetCode() != null; @@ -372,7 +372,7 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { + public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) { return new PTXHotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir); } diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Tue Mar 11 16:16:24 2014 +0100 @@ -72,8 +72,8 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new SPARCHotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir); + public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) { + return new SPARCHotSpotLIRGenerator(graph, stub, getProviders(), getRuntime().getConfig(), frameMap, cc, lir); } /** diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Tue Mar 11 16:16:24 2014 +0100 @@ -51,10 +51,12 @@ public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSpotLIRGenerator { private final HotSpotVMConfig config; + private final Object stub; - public SPARCHotSpotLIRGenerator(StructuredGraph graph, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) { + public SPARCHotSpotLIRGenerator(StructuredGraph graph, Object stub, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) { super(graph, providers, frameMap, cc, lir); this.config = config; + this.stub = stub; } @Override @@ -84,23 +86,19 @@ @Override protected boolean needOnlyOopMaps() { // Stubs only need oop maps - return graph.start() instanceof StubStartNode; + return stub != null; } Stub getStub() { - if (graph.start() instanceof StubStartNode) { - return ((StubStartNode) graph.start()).getStub(); - } - return null; + return (Stub) stub; } @Override public Variable emitForeignCall(ForeignCallLinkage linkage, DeoptimizingNode info, Value... args) { - Stub stub = getStub(); Variable result; if (linkage.canDeoptimize()) { - assert info != null || stub != null; + assert info != null || getStub() != null; HotSpotRegistersProvider registers = getProviders().getRegisters(); Register thread = registers.getThreadRegister(); Register stackPointer = registers.getStackPointerRegister(); diff -r 3a30575968cd -r 4eac66a9b87d 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 Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Tue Mar 11 16:16:24 2014 +0100 @@ -204,7 +204,7 @@ CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); // create suites everytime, as we modify options for the compiler final Suites suitesLocal = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getSuites().createSuites(); - final CompilationResult compResult = compileGraph(graph, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), + final CompilationResult compResult = compileGraph(graph, null, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), getSpeculationLog(), suitesLocal, true, new CompilationResult(), CompilationResultBuilderFactory.Default); addMethod(method, compResult); } diff -r 3a30575968cd -r 4eac66a9b87d 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 Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Tue Mar 11 16:16:24 2014 +0100 @@ -263,7 +263,7 @@ Suites suites = getSuites(providers); ProfilingInfo profilingInfo = getProfilingInfo(); OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo); - result = compileGraph(graph, cc, method, providers, backend, backend.getTarget(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo, + result = compileGraph(graph, null, cc, method, providers, backend, backend.getTarget(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo, method.getSpeculationLog(), suites, true, new CompilationResult(), CompilationResultBuilderFactory.Default); result.setId(getId()); result.setEntryBCI(entryBCI); diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/HotSpotNativeFunctionInterface.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/HotSpotNativeFunctionInterface.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/HotSpotNativeFunctionInterface.java Tue Mar 11 16:16:24 2014 +0100 @@ -157,7 +157,7 @@ Suites suites = providers.getSuites().createSuites(); PhaseSuite phaseSuite = backend.getSuites().getDefaultGraphBuilderSuite().copy(); CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, g.method(), false); - CompilationResult compResult = GraalCompiler.compileGraph(g, cc, g.method(), providers, backend, backend.getTarget(), null, phaseSuite, OptimisticOptimizations.ALL, + CompilationResult compResult = GraalCompiler.compileGraph(g, null, cc, g.method(), providers, backend, backend.getTarget(), null, phaseSuite, OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), null, suites, true, new CompilationResult(), CompilationResultBuilderFactory.Default); InstalledCode installedCode; try (Scope s = Debug.scope("CodeInstall", providers.getCodeCache(), g.method())) { diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Tue Mar 11 16:16:24 2014 +0100 @@ -186,7 +186,6 @@ boolean isObjectResult = linkage.getOutgoingCallingConvention().getReturn().getKind() == Kind.Object; StructuredGraph graph = new StructuredGraph(toString(), null); - graph.replaceFixed(graph.start(), graph.add(new StubStartNode(this))); GraphKit kit = new GraphKit(graph, providers); ParameterNode[] params = createParameters(kit, args); diff -r 3a30575968cd -r 4eac66a9b87d 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 Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Tue Mar 11 16:16:24 2014 +0100 @@ -145,7 +145,7 @@ CodeCacheProvider codeCache = providers.getCodeCache(); // The stub itself needs the incoming calling convention. CallingConvention incomingCc = linkage.getIncomingCallingConvention(); - final CompilationResult compResult = compileGraph(graph, incomingCc, getInstalledCodeOwner(), providers, backend, codeCache.getTarget(), null, + final CompilationResult compResult = compileGraph(graph, Stub.this, incomingCc, getInstalledCodeOwner(), providers, backend, codeCache.getTarget(), null, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), null, providers.getSuites().getDefaultSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default); diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java --- a/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java Tue Mar 11 16:16:24 2014 +0100 @@ -49,7 +49,7 @@ new GraphBuilderPhase.Instance(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); PhaseSuite graphBuilderSuite = suitesProvider.getDefaultGraphBuilderSuite(); CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); - compileGraph(graph, cc, method, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null, suites, true, - new CompilationResult(), CompilationResultBuilderFactory.Default); + compileGraph(graph, null, cc, method, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null, suites, + true, new CompilationResult(), CompilationResultBuilderFactory.Default); } } diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java Tue Mar 11 16:16:24 2014 +0100 @@ -38,9 +38,9 @@ */ public final class RedundantMoveElimination { - public static void optimize(LIR lir, FrameMap frameMap, ResolvedJavaMethod method) { + public static void optimize(LIR lir, FrameMap frameMap) { RedundantMoveElimination redundantMoveElimination = new RedundantMoveElimination(); - redundantMoveElimination.doOptimize(lir, frameMap, method); + redundantMoveElimination.doOptimize(lir, frameMap); } /** @@ -100,9 +100,9 @@ /** * The main method doing the elimination of redundant moves. */ - private void doOptimize(LIR lir, FrameMap frameMap, ResolvedJavaMethod method) { + private void doOptimize(LIR lir, FrameMap frameMap) { - try (Indent indent = Debug.logAndIndent("eliminate redundant moves in %s", method)) { + try (Indent indent = Debug.logAndIndent("eliminate redundant moves")) { callerSaveRegs = frameMap.registerConfig.getCallerSaveRegisters(); diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Tue Mar 11 16:16:24 2014 +0100 @@ -203,7 +203,7 @@ CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); Backend backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend(); CompilationResultBuilderFactory factory = getOptimizedCallTargetInstrumentationFactory(backend.getTarget().arch.getName(), javaMethod); - return compileGraph(graph, cc, javaMethod, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null, + return compileGraph(graph, null, cc, javaMethod, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null, suites, true, new CompilationResult(), factory); } diff -r 3a30575968cd -r 4eac66a9b87d graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Tue Mar 11 14:45:35 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Tue Mar 11 16:16:24 2014 +0100 @@ -203,7 +203,7 @@ CodeCacheProvider codeCache = providers.getCodeCache(); CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); CompilationResult compilationResult = new CompilationResult(name); - result = compileGraph(graph, cc, graph.method(), providers, backend, codeCache.getTarget(), null, createGraphBuilderSuite(), Optimizations, getProfilingInfo(graph), speculationLog, + result = compileGraph(graph, null, cc, graph.method(), providers, backend, codeCache.getTarget(), null, createGraphBuilderSuite(), Optimizations, getProfilingInfo(graph), speculationLog, suites, false, compilationResult, CompilationResultBuilderFactory.Default); } catch (Throwable e) { throw Debug.handle(e);