# HG changeset patch # User Josef Eisl # Date 1395832448 -3600 # Node ID f2e61bf2a2d810d95888991eec64776726f2c364 # Parent 47e4d2e01c6e1f8e3000ac668576a0b759951fb9 Removed nodeOperands from LIRGenerator. diff -r 47e4d2e01c6e -r f2e61bf2a2d8 graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Wed Mar 26 12:14:08 2014 +0100 @@ -173,7 +173,7 @@ TargetDescription target = backend.getTarget(); CallingConvention cc = CodeUtil.getCallingConvention(backend.getProviders().getCodeCache(), CallingConvention.Type.JavaCallee, method, false); this.lirGenRes = backend.newLIRGenerationResult(lir, frameMap, null); - this.lirGen = backend.newLIRGenerator(null, cc, lirGenRes); + this.lirGen = backend.newLIRGenerator(cc, lirGenRes); try (Scope ds = Debug.scope("BackEnd", lir)) { try (Scope s = Debug.scope("LIRGen", lirGen)) { diff -r 47e4d2e01c6e -r f2e61bf2a2d8 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 Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Wed Mar 26 12:14:08 2014 +0100 @@ -87,8 +87,8 @@ } } - public AMD64LIRGenerator(StructuredGraph graph, Providers providers, CallingConvention cc, LIRGenerationResult lirGenRes) { - super(graph, providers, cc, lirGenRes); + public AMD64LIRGenerator(Providers providers, CallingConvention cc, LIRGenerationResult lirGenRes) { + super(providers, cc, lirGenRes); lirGenRes.getLIR().setSpillMoveFactory(new AMD64SpillMoveFactory()); } diff -r 47e4d2e01c6e -r f2e61bf2a2d8 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 Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Mar 26 12:14:08 2014 +0100 @@ -243,7 +243,7 @@ try (Scope ds = Debug.scope("BackEnd", lir)) { FrameMap frameMap = backend.newFrameMap(); LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(lir, frameMap, stub); - LIRGenerator lirGen = backend.newLIRGenerator(graph, cc, lirGenRes); + LIRGenerator lirGen = backend.newLIRGenerator(cc, lirGenRes); NodeLIRGenerator nodeLirGen = backend.newNodeLIRGenerator(graph, cc, lirGenRes, lirGen); try (Scope s = Debug.scope("LIRGen", lirGen)) { diff -r 47e4d2e01c6e -r f2e61bf2a2d8 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 Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Wed Mar 26 12:14:08 2014 +0100 @@ -64,8 +64,7 @@ private final Providers providers; private final CallingConvention cc; - private final NodeMap nodeOperands; - private final DebugInfoBuilder debugInfoBuilder; + private DebugInfoBuilder debugInfoBuilder; protected AbstractBlock currentBlock; private final int traceLevel; @@ -148,6 +147,15 @@ protected LIRGenerationResult res; /** + * set this before using the LIRGenerator + * + * TODO this should be removed + */ + void setDebugInfoBuilder(DebugInfoBuilder builder) { + debugInfoBuilder = builder; + } + + /** * Checks whether the supplied constant can be used without loading it into a register for store * operations, i.e., on the right hand side of a memory access. * @@ -158,20 +166,9 @@ public abstract boolean canStoreConstant(Constant c, boolean isCompressed); public LIRGenerator(Providers providers, CallingConvention cc, LIRGenerationResult res) { - this(null, providers, cc, res); - } - - public LIRGenerator(StructuredGraph graph, Providers providers, CallingConvention cc, LIRGenerationResult res) { this.res = res; this.providers = providers; this.cc = cc; - if (graph != null) { - this.nodeOperands = graph.createNodeMap(); - this.debugInfoBuilder = createDebugInfoBuilder(nodeOperands); - } else { - this.nodeOperands = null; - this.debugInfoBuilder = null; - } this.traceLevel = Options.TraceLIRGeneratorLevel.getValue(); this.printIRWithLIR = Options.PrintIRWithLIR.getValue(); } @@ -184,11 +181,6 @@ return true; } - @SuppressWarnings("hiding") - protected DebugInfoBuilder createDebugInfoBuilder(NodeMap nodeOperands) { - return new DebugInfoBuilder(nodeOperands); - } - @Override public TargetDescription target() { return getCodeCache().getTarget(); @@ -457,11 +449,6 @@ protected abstract void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key); - public final NodeMap getNodeOperands() { - assert nodeOperands != null; - return nodeOperands; - } - public CallingConvention getCallingConvention() { return cc; } diff -r 47e4d2e01c6e -r f2e61bf2a2d8 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRGenerator.java Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRGenerator.java Wed Mar 26 12:14:08 2014 +0100 @@ -89,6 +89,7 @@ this.gen = gen; this.traceLevel = LIRGenerator.Options.TraceLIRGeneratorLevel.getValue(); this.printIRWithLIR = LIRGenerator.Options.PrintIRWithLIR.getValue(); + gen.setDebugInfoBuilder(debugInfoBuilder); } @SuppressWarnings("hiding") diff -r 47e4d2e01c6e -r f2e61bf2a2d8 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 Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Wed Mar 26 12:14:08 2014 +0100 @@ -65,7 +65,7 @@ public abstract FrameMap newFrameMap(); - public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, CallingConvention cc, LIRGenerationResult lirGenRes); + public abstract LIRGenerator newLIRGenerator(CallingConvention cc, LIRGenerationResult lirGenRes); public abstract LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, Object stub); diff -r 47e4d2e01c6e -r f2e61bf2a2d8 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 Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Wed Mar 26 12:14:08 2014 +0100 @@ -72,8 +72,8 @@ } @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, CallingConvention cc, LIRGenerationResult lirGenRes) { - return new AMD64HotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), cc, lirGenRes); + public LIRGenerator newLIRGenerator(CallingConvention cc, LIRGenerationResult lirGenRes) { + return new AMD64HotSpotLIRGenerator(getProviders(), getRuntime().getConfig(), cc, lirGenRes); } @Override diff -r 47e4d2e01c6e -r f2e61bf2a2d8 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 Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Wed Mar 26 12:14:08 2014 +0100 @@ -58,8 +58,8 @@ final HotSpotVMConfig config; - protected AMD64HotSpotLIRGenerator(StructuredGraph graph, HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) { - super(graph, providers, cc, lirGenRes); + protected AMD64HotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) { + super(providers, cc, lirGenRes); assert config.basicLockSize == 8; this.config = config; } @@ -122,12 +122,6 @@ } @Override - protected DebugInfoBuilder createDebugInfoBuilder(NodeMap nodeOperands) { - HotSpotLockStack lockStack = new HotSpotLockStack(res.getFrameMap(), Kind.Long); - return new HotSpotDebugInfoBuilder(nodeOperands, lockStack); - } - - @Override public StackSlot getLockSlot(int lockDepth) { return ((HotSpotDebugInfoBuilder) getDebugInfoBuilder()).lockStack().makeLockSlot(lockDepth); } diff -r 47e4d2e01c6e -r f2e61bf2a2d8 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRGenerator.java Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRGenerator.java Wed Mar 26 12:14:08 2014 +0100 @@ -36,6 +36,7 @@ import com.oracle.graal.compiler.amd64.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.debug.*; +import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.amd64.AMD64HotSpotLIRGenerator.SaveRbp; import com.oracle.graal.hotspot.amd64.AMD64HotSpotMove.CompareAndSwapCompressedOp; @@ -73,6 +74,12 @@ } @Override + protected DebugInfoBuilder createDebugInfoBuilder(NodeMap nodeOperands) { + HotSpotLockStack lockStack = new HotSpotLockStack(res.getFrameMap(), Kind.Long); + return new HotSpotDebugInfoBuilder(nodeOperands, lockStack); + } + + @Override protected void emitPrologue(StructuredGraph graph) { CallingConvention incomingArguments = getCallingConvention(); diff -r 47e4d2e01c6e -r f2e61bf2a2d8 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Wed Mar 26 12:14:08 2014 +0100 @@ -50,7 +50,7 @@ protected TargetDescription target; protected LIR lir; - protected LIRGenerator lirGenerator; + protected NodeLIRGenerator nodeLirGenerator; protected ControlFlowGraph cfg; protected SchedulePhase schedule; @@ -309,8 +309,8 @@ } out.print("tid ").print(nodeToString(node)).println(COLUMN_END); - if (lirGenerator != null) { - Value operand = lirGenerator.getNodeOperands().get(node); + if (nodeLirGenerator != null) { + Value operand = nodeLirGenerator.getNodeOperands().get(node); if (operand != null) { out.print("result ").print(operand.toString()).println(COLUMN_END); } @@ -414,8 +414,8 @@ private String stateValueToString(ValueNode value) { String result = nodeToString(value); - if (lirGenerator != null && lirGenerator.getNodeOperands() != null && value != null) { - Value operand = lirGenerator.getNodeOperands().get(value); + if (nodeLirGenerator != null && nodeLirGenerator.getNodeOperands() != null && value != null) { + Value operand = nodeLirGenerator.getNodeOperands().get(value); if (operand != null) { result += ": " + operand; } diff -r 47e4d2e01c6e -r f2e61bf2a2d8 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Wed Mar 26 11:49:07 2014 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Wed Mar 26 12:14:08 2014 +0100 @@ -137,9 +137,9 @@ } else { cfgPrinter.lir = Debug.contextLookup(LIR.class); } - cfgPrinter.lirGenerator = Debug.contextLookup(LIRGenerator.class); - if (cfgPrinter.lirGenerator != null) { - cfgPrinter.target = cfgPrinter.lirGenerator.target(); + cfgPrinter.nodeLirGenerator = Debug.contextLookup(NodeLIRGenerator.class); + if (cfgPrinter.nodeLirGenerator != null) { + cfgPrinter.target = cfgPrinter.nodeLirGenerator.getLIRGeneratorTool().target(); } if (cfgPrinter.lir != null && cfgPrinter.lir.getControlFlowGraph() instanceof ControlFlowGraph) { cfgPrinter.cfg = (ControlFlowGraph) cfgPrinter.lir.getControlFlowGraph(); @@ -185,7 +185,7 @@ cfgPrinter.target = null; cfgPrinter.lir = null; - cfgPrinter.lirGenerator = null; + cfgPrinter.nodeLirGenerator = null; cfgPrinter.cfg = null; cfgPrinter.flush();