# HG changeset patch # User Doug Simon # Date 1368008043 -7200 # Node ID 0c17815817a4aae4d0be2d80c84045557f6be4f2 # Parent 66db0353f55a3093e075d40fad80f96497cac160 removed LIRGenerator.method field diff -r 66db0353f55a -r 0c17815817a4 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Tue May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Wed May 08 12:14:03 2013 +0200 @@ -92,8 +92,8 @@ } } - public AMD64LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, method, cc, lir); + public AMD64LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, runtime, target, frameMap, cc, lir); lir.spillMoveFactory = new AMD64SpillMoveFactory(); } diff -r 66db0353f55a -r 0c17815817a4 graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java Tue May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java Wed May 08 12:14:03 2013 +0200 @@ -42,8 +42,8 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { - return new PTXLIRGenerator(graph, runtime(), target, frameMap, method, cc, lir); + public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { + return new PTXLIRGenerator(graph, runtime(), target, frameMap, cc, lir); } class HotSpotFrameContext implements FrameContext { diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Wed May 08 12:14:03 2013 +0200 @@ -81,8 +81,8 @@ } } - public PTXLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, method, cc, lir); + public PTXLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, runtime, target, frameMap, cc, lir); lir.spillMoveFactory = new PTXSpillMoveFactory(); } diff -r 66db0353f55a -r 0c17815817a4 graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java --- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Tue May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Wed May 08 12:14:03 2013 +0200 @@ -38,8 +38,8 @@ */ public class SPARCLIRGenerator extends LIRGenerator { - public SPARCLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, method, cc, lir); + public SPARCLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, runtime, target, frameMap, cc, lir); // SPARC: Implement lir generator. } diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed May 08 12:14:03 2013 +0200 @@ -176,7 +176,7 @@ public static LIRGenerator emitLIR(Backend backend, final TargetDescription target, final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method, CallingConvention cc) { final FrameMap frameMap = backend.newFrameMap(); - final LIRGenerator lirGen = backend.newLIRGenerator(graph, frameMap, method, cc, lir); + final LIRGenerator lirGen = backend.newLIRGenerator(graph, frameMap, cc, lir); Debug.scope("LIRGen", lirGen, new Runnable() { diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Wed May 08 12:14:03 2013 +0200 @@ -61,7 +61,6 @@ protected final StructuredGraph graph; protected final CodeCacheProvider runtime; protected final TargetDescription target; - protected final ResolvedJavaMethod method; protected final CallingConvention cc; protected final DebugInfoBuilder debugInfoBuilder; @@ -86,16 +85,17 @@ */ public abstract boolean canStoreConstant(Constant c); - public LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { + public LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { this.graph = graph; this.runtime = runtime; this.target = target; this.frameMap = frameMap; - this.method = method; if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) { this.cc = cc; } else { - this.cc = frameMap.registerConfig.getCallingConvention(JavaCallee, method.getSignature().getReturnType(null), new JavaType[]{runtime.lookupJavaType(long.class)}, target, false); + JavaType[] parameterTypes = new JavaType[]{runtime.lookupJavaType(long.class)}; + CallingConvention tmp = frameMap.registerConfig.getCallingConvention(JavaCallee, runtime.lookupJavaType(void.class), parameterTypes, target, false); + this.cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0)); } this.nodeOperands = graph.createNodeMap(); this.lir = lir; @@ -118,10 +118,6 @@ return runtime; } - public ResolvedJavaMethod method() { - return method; - } - /** * Returns the operand that has been previously initialized by * {@link #setResult(ValueNode, Value)} with the result of an instruction. diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Wed May 08 12:14:03 2013 +0200 @@ -51,7 +51,7 @@ return new FrameMap(runtime, target, runtime.lookupRegisterConfig()); } - public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir); + public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir); protected abstract AbstractAssembler createAssembler(FrameMap frameMap); diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Wed May 08 12:14:03 2013 +0200 @@ -64,8 +64,8 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { - return new AMD64HotSpotLIRGenerator(graph, runtime(), target, frameMap, method, cc, lir); + public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { + return new AMD64HotSpotLIRGenerator(graph, runtime(), target, frameMap, cc, lir); } /** @@ -160,7 +160,7 @@ LIR lir = gen.lir; boolean omitFrame = CanOmitFrame && !frameMap.frameNeedsAllocating() && !lir.hasArgInCallerFrame(); - Stub stub = runtime().asStub(lirGen.method()); + Stub stub = gen.getStub(); AbstractAssembler masm = createAssembler(frameMap); HotSpotFrameContext frameContext = omitFrame ? null : new HotSpotFrameContext(stub != null); TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime(), frameMap, masm, frameContext, compilationResult); diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Wed May 08 12:14:03 2013 +0200 @@ -59,8 +59,8 @@ return (HotSpotRuntime) runtime; } - protected AMD64HotSpotLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { - super(graph, runtime, target, frameMap, method, cc, lir); + protected AMD64HotSpotLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, CallingConvention cc, LIR lir) { + super(graph, runtime, target, frameMap, cc, lir); } /** @@ -174,7 +174,7 @@ @Override protected boolean needOnlyOopMaps() { // Stubs only need oop maps - return runtime().asStub(method) != null; + return graph.start() instanceof StubStartNode; } /** @@ -201,11 +201,18 @@ append(new AMD64RestoreRegistersOp(save.getSlots().clone(), save)); } + Stub getStub() { + if (graph.start() instanceof StubStartNode) { + return ((StubStartNode) graph.start()).getStub(); + } + return null; + } + @Override public Variable emitCall(RuntimeCallTarget callTarget, CallingConvention callCc, DeoptimizingNode info, Value... args) { - Stub stub = runtime().asStub(method); + Stub stub = getStub(); boolean isCRuntimeCall = ((HotSpotRuntimeCallTarget) callTarget).isCRuntimeCall(); - assert !isCRuntimeCall || stub != null : "direct call to C runtime can only be made from compiled stubs, not from " + method; + assert !isCRuntimeCall || stub != null : "direct call to C runtime can only be made from compiled stubs, not from " + graph; AMD64SaveRegistersOp save = null; StackSlot[] savedRegisterLocations = null; diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Wed May 08 12:14:03 2013 +0200 @@ -43,8 +43,8 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, ResolvedJavaMethod method, CallingConvention cc, LIR lir) { - return new SPARCLIRGenerator(graph, this.runtime(), this.target, frameMap, method, cc, lir); + public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { + return new SPARCLIRGenerator(graph, this.runtime(), this.target, frameMap, cc, lir); } @Override diff -r 66db0353f55a -r 0c17815817a4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubStartNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubStartNode.java Wed May 08 12:14:03 2013 +0200 @@ -0,0 +1,42 @@ +/* + * 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.hotspot.nodes; + +import com.oracle.graal.hotspot.stubs.*; +import com.oracle.graal.nodes.*; + +/** + * Start node for a {@link Stub}'s graph. + */ +public class StubStartNode extends StartNode { + + private final Stub stub; + + public StubStartNode(Stub stub) { + this.stub = stub; + } + + public Stub getStub() { + return stub; + } +} diff -r 66db0353f55a -r 0c17815817a4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Tue May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Wed May 08 12:14:03 2013 +0200 @@ -49,7 +49,7 @@ @Override public void generate(LIRGenerator gen) { - String whereString = "in compiled code for " + MetaUtil.format("%H.%n(%p)", gen.method()); + String whereString = "in compiled code for " + graph(); // As these strings will end up embedded as oops in the code, they // must be interned or else they will cause the nmethod to be unloaded diff -r 66db0353f55a -r 0c17815817a4 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 May 07 23:38:53 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Wed May 08 12:14:03 2013 +0200 @@ -204,6 +204,11 @@ SnippetTemplate template = template(args); StructuredGraph graph = template.copySpecializedGraph(); + StubStartNode newStart = graph.add(new StubStartNode(Stub.this)); + newStart.setStateAfter(graph.start().stateAfter()); + graph.replaceFixed(graph.start(), newStart); + graph.setStart(newStart); + PhasePlan phasePlan = new PhasePlan(); GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);