# HG changeset patch # User Thomas Wuerthinger # Date 1312926970 -7200 # Node ID 6b841b6b2437c53262d6c5449dd57c18e984df51 # Parent 391302094f86634a54741ee1b632670b499adfc8 First round of refactoring. diff -r 391302094f86 -r 6b841b6b2437 .test.txt.swo Binary file .test.txt.swo has changed diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java Tue Aug 09 23:56:10 2011 +0200 @@ -33,8 +33,8 @@ import com.oracle.max.graal.compiler.gen.LIRGenerator.DeoptimizationStub; import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; -import com.oracle.max.graal.compiler.value.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,7 @@ import java.lang.reflect.*; import java.util.*; -import java.util.Map.*; +import java.util.Map.Entry; import com.oracle.max.graal.compiler.debug.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler; -import com.oracle.max.graal.compiler.debug.TTY.*; +import com.oracle.max.graal.compiler.debug.TTY.Filter; /** * This class encapsulates options that control the behavior of the Graal compiler. diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,7 +23,7 @@ package com.oracle.max.graal.compiler; import java.util.*; -import java.util.Map.*; +import java.util.Map.Entry; import com.oracle.max.graal.compiler.debug.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,7 +23,9 @@ package com.oracle.max.graal.compiler.alloc; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.alloc.Interval.*; +import com.oracle.max.graal.compiler.alloc.Interval.RegisterBinding; +import com.oracle.max.graal.compiler.alloc.Interval.RegisterBindingLists; +import com.oracle.max.graal.compiler.alloc.Interval.State; import com.oracle.max.graal.compiler.debug.*; /** diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Tue Aug 09 23:56:10 2011 +0200 @@ -38,10 +38,11 @@ import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.lir.*; import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.base.FrameState.ValueProcedure; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.util.*; -import com.oracle.max.graal.compiler.value.*; -import com.oracle.max.graal.compiler.value.FrameState.ValueProcedure; import com.oracle.max.graal.extensions.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -639,7 +640,7 @@ if (info != null) { assert info.state != null; info.state.forEachLiveStateValue(new ValueProcedure() { - public void doValue(Value value) { + public void doValue(ValueNode value) { CiValue operand = value.operand(); if (operand.isVariable()) { int operandNum = operandNumber(operand); @@ -834,7 +835,7 @@ for (int operandNum = 0; operandNum < ir.startBlock.liveIn.size(); operandNum++) { if (ir.startBlock.liveIn.get(operandNum)) { CiValue operand = operands.operandFor(operandNum); - Value instr = operand.isVariable() ? gen.operands.instructionForResult(((CiVariable) operand)) : null; + ValueNode instr = operand.isVariable() ? gen.operands.instructionForResult(((CiVariable) operand)) : null; TTY.println(" var %d (HIR instruction %s)", operandNum, instr == null ? " " : instr.toString()); if (instr instanceof Phi) { @@ -1273,7 +1274,7 @@ LIRDebugInfo info = op.info; if (info != null) { info.state.forEachLiveStateValue(new ValueProcedure() { - public void doValue(Value value) { + public void doValue(ValueNode value) { CiValue operand = value.operand(); if (operand.isVariableOrRegister()) { addUse(operand, blockFrom, (opId + 1), RegisterPriority.None, null); @@ -1864,7 +1865,7 @@ private final int opId; private final BitMap frameRefMap; - private HashMap virtualObjects; + private HashMap virtualObjects; public DebugFrameBuilder(FrameState topState, int opId, BitMap frameRefMap) { this.topState = topState; @@ -1872,12 +1873,12 @@ this.frameRefMap = frameRefMap; } - private CiValue toCiValue(Value value) { - if (value instanceof VirtualObject) { + private CiValue toCiValue(ValueNode value) { + if (value instanceof VirtualObjectNode) { if (virtualObjects == null) { - virtualObjects = new HashMap(); + virtualObjects = new HashMap(); } - VirtualObject obj = (VirtualObject) value; + VirtualObjectNode obj = (VirtualObjectNode) value; CiVirtualObject ciObj = virtualObjects.get(value); if (ciObj == null) { ciObj = CiVirtualObject.get(obj.type(), null, value.id()); @@ -1947,7 +1948,7 @@ CiStackSlot objectAddress = frameMap.toMonitorObjectStackAddress(i); frameRefMap.set(objectAddress.index()); } else { - Value lock = state.lockAt(i); + ValueNode lock = state.lockAt(i); if (lock.isConstant() && compilation.runtime.asJavaClass(lock.asConstant()) != null) { // lock on class for synchronized static method values[valueIndex++] = lock.asConstant(); @@ -1972,11 +1973,11 @@ if (virtualObjects != null) { // collect all VirtualObjectField instances: - HashMap objectStates = new HashMap(); + HashMap objectStates = new HashMap(); FrameState current = topState; do { for (Node n : current.virtualObjectMappings()) { - VirtualObjectField field = (VirtualObjectField) n; + VirtualObjectFieldNode field = (VirtualObjectFieldNode) n; // null states occur for objects with 0 fields if (field != null && !objectStates.containsKey(field.object())) { objectStates.put(field.object(), field); @@ -1989,10 +1990,10 @@ boolean changed; do { changed = false; - HashMap virtualObjectsCopy = new HashMap(virtualObjects); - for (Entry entry : virtualObjectsCopy.entrySet()) { + HashMap virtualObjectsCopy = new HashMap(virtualObjects); + for (Entry entry : virtualObjectsCopy.entrySet()) { if (entry.getValue().values() == null) { - VirtualObject vobj = entry.getKey(); + VirtualObjectNode vobj = entry.getKey(); CiValue[] values = new CiValue[vobj.fields().length]; entry.getValue().setValues(values); if (vobj.fields().length > 0) { @@ -2000,12 +2001,12 @@ FloatingNode currentField = objectStates.get(vobj); assert currentField != null; do { - if (currentField instanceof VirtualObjectField) { - int index = ((VirtualObjectField) currentField).index(); + if (currentField instanceof VirtualObjectFieldNode) { + int index = ((VirtualObjectFieldNode) currentField).index(); if (values[index] == null) { - values[index] = toCiValue(((VirtualObjectField) currentField).input()); + values[index] = toCiValue(((VirtualObjectFieldNode) currentField).input()); } - currentField = ((VirtualObjectField) currentField).lastState(); + currentField = ((VirtualObjectFieldNode) currentField).lastState(); } else { assert currentField instanceof Phi : currentField; currentField = (FloatingNode) ((Phi) currentField).valueAt(0); @@ -2406,7 +2407,7 @@ } CiValue operand = operands.operandFor(operandNum); assert operand.isVariable() : "value must have variable operand"; - Value value = gen.operands.instructionForResult(((CiVariable) operand)); + ValueNode value = gen.operands.instructionForResult(((CiVariable) operand)); assert value != null : "all intervals live across block boundaries must have Value"; // TKR assert value.asConstant() == null || value.isPinned() : // "only pinned constants can be alive accross block boundaries"; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,12 +27,15 @@ import java.util.*; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.alloc.Interval.*; +import com.oracle.max.graal.compiler.alloc.Interval.RegisterBinding; +import com.oracle.max.graal.compiler.alloc.Interval.RegisterPriority; +import com.oracle.max.graal.compiler.alloc.Interval.SpillState; +import com.oracle.max.graal.compiler.alloc.Interval.State; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.lir.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiRegister.*; +import com.sun.cri.ci.CiRegister.RegisterFlag; /** * diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,7 +25,7 @@ import java.util.*; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -62,7 +62,7 @@ * Map from a {@linkplain CiVariable#index variable index} to the instruction whose result is stored in the denoted variable. * This map is only populated and used if {@link GraalOptions#DetailedAsserts} is {@code true}. */ - private final ArrayList variableDefs; + private final ArrayList variableDefs; /** * The {@linkplain #operandNumber(CiValue) number} of the first variable operand @@ -138,7 +138,7 @@ this.firstVariableNumber = registers.length; this.registers = registers; variables = new ArrayList(INITIAL_VARIABLE_CAPACITY); - variableDefs = GraalOptions.DetailedAsserts ? new ArrayList(INITIAL_VARIABLE_CAPACITY) : null; + variableDefs = GraalOptions.DetailedAsserts ? new ArrayList(INITIAL_VARIABLE_CAPACITY) : null; } /** @@ -215,7 +215,7 @@ * @param result the variable storing the result of {@code instruction} * @param instruction an instruction that produces a result (i.e. pushes a value to the stack) */ - public void recordResult(CiVariable result, Value instruction) { + public void recordResult(CiVariable result, ValueNode instruction) { while (variableDefs.size() <= result.index) { variableDefs.add(null); } @@ -228,7 +228,7 @@ * @param result the variable storing the result of an instruction * @return the instruction that stores its result in {@code result} */ - public Value instructionForResult(CiVariable result) { + public ValueNode instructionForResult(CiVariable result) { if (variableDefs.size() > result.index) { return variableDefs.get(result.index); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/BlockPrinter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/BlockPrinter.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/BlockPrinter.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,9 +24,9 @@ import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; /** @@ -81,7 +81,7 @@ if (i > 0) { out.print(", "); } - Value value = newFrameState.stackAt(i); + ValueNode value = newFrameState.stackAt(i); out.print(i + ":" + Util.valueString(value)); if (value == null) { i++; @@ -105,7 +105,7 @@ out.fillTo(startPosition, ' '); out.print("locks ["); for (int i = 0; i < newFrameState.locksSize(); i++) { - Value value = newFrameState.lockAt(i); + ValueNode value = newFrameState.lockAt(i); if (i > 0) { out.print(", "); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Tue Aug 09 23:56:10 2011 +0200 @@ -32,9 +32,9 @@ import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.lir.*; import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFormatter; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiAddress.Scale; @@ -258,7 +258,7 @@ if (i == 0) { buf.append(' '); } - Value value = state.stackAt(i); + ValueNode value = state.stackAt(i); buf.append(stateValueToString(value, operandFmt)).append(' '); i++; } @@ -271,7 +271,7 @@ if (i == 0) { buf.append(' '); } - Value value = state.lockAt(i); + ValueNode value = state.lockAt(i); buf.append(stateValueToString(value, operandFmt)).append(' '); } buf.append("\n"); @@ -283,7 +283,7 @@ if (i == 0) { buf.append(' '); } - Value value = state.localAt(i); + ValueNode value = state.localAt(i); buf.append(stateValueToString(value, operandFmt)).append(' '); i++; } @@ -291,7 +291,7 @@ return buf.toString(); } - private String stateValueToString(Value value, OperandFormatter operandFmt) { + private String stateValueToString(ValueNode value, OperandFormatter operandFmt) { if (operandFmt == null) { return Util.valueString(value); } @@ -504,7 +504,7 @@ } } - private void printOperand(Value i) { + private void printOperand(ValueNode i) { if (i != null && i.operand().isLegal()) { out.print(new CFGOperandFormatter(true).format(i.operand())); } @@ -531,7 +531,7 @@ } out.print("instruction "); - i.print(out); + out.print(i.toString()); out.print(COLUMN_END).print(' ').println(COLUMN_END); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,8 +27,9 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.observer.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graphviz.*; @@ -101,7 +102,7 @@ printer.addClassColor(StartNode.class, "snow3"); printer.addClassColor(LoopBegin.class, "skyblue"); printer.addClassColor(LoopEnd.class, "skyblue3"); - printer.addClassColor(Unwind.class, "red"); + printer.addClassColor(UnwindNode.class, "red"); printer.addClassColor(Return.class, "indianred1"); printer.begin(name); printer.print(graph, true); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,16 +23,16 @@ package com.oracle.max.graal.compiler.debug; import java.io.*; +import java.util.AbstractMap.SimpleImmutableEntry; import java.util.*; -import java.util.AbstractMap.SimpleImmutableEntry; import java.util.Map.Entry; import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.compiler.util.LoopUtil.Loop; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; import com.sun.cri.bytecode.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,8 +27,8 @@ import java.util.regex.*; import com.oracle.max.graal.compiler.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ri.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/InstructionPrinter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/InstructionPrinter.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/InstructionPrinter.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,9 +25,11 @@ import static com.oracle.max.graal.compiler.debug.InstructionPrinter.InstructionLineColumn.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; /** - * A {@link ValueVisitor} for {@linkplain #printInstruction(Value) printing} + * A {@link ValueVisitor} for {@linkplain #printInstruction(ValueNode) printing} * an {@link FixedNodeWithNext} as an expression or statement. * * @author Doug Simon @@ -37,7 +39,7 @@ /** * The columns printed in a tabulated instruction - * {@linkplain InstructionPrinter#printInstructionListing(Value) listing}. + * {@linkplain InstructionPrinter#printInstructionListing(ValueNode) listing}. */ public enum InstructionLineColumn { /** @@ -101,17 +103,7 @@ } /** - * Prints a given instruction as an expression or statement. - * - * @param instruction the instruction to print - */ - public void printInstruction(Value instruction) { - instruction.print(out); - } - - - /** - * Prints a header for the tabulated data printed by {@link #printInstructionListing(Value)}. + * Prints a header for the tabulated data printed by {@link #printInstructionListing(ValueNode)}. */ public void printInstructionListingHeader() { BCI.printLabel(out); @@ -128,7 +120,7 @@ * * @param instruction the instruction to print */ - public void printInstructionListing(Value instruction) { + public void printInstructionListing(ValueNode instruction) { int indentation = out.indentationLevel(); out.fillTo(BCI.position + indentation, ' '). print(0). @@ -147,4 +139,8 @@ } out.println(); } + + public void printInstruction(ValueNode node) { + out.print(node.toString()); + } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/LogStream.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/LogStream.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/LogStream.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,7 +25,7 @@ import java.io.*; import java.util.*; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; /** @@ -451,12 +451,12 @@ } /** - * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.compiler.ir.Value) value} to this stream. + * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.compiler.nodes.base.ValueNode) value} to this stream. * * @param value the instruction to print * @return this {@code LogStream} instance */ - public LogStream print(Value value) { + public LogStream print(ValueNode value) { if (ps != null) { indent(); lineBuffer.append(Util.valueString(value)); @@ -465,13 +465,13 @@ } /** - * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.compiler.ir.Value) value} to this stream + * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.compiler.nodes.base.ValueNode) value} to this stream * followed by a {@linkplain #LINE_SEPARATOR line separator}. * * @param value the instruction to print * @return this {@code LogStream} instance */ - public LogStream println(Value value) { + public LogStream println(ValueNode value) { if (ps != null) { print(value); flushLine(true); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Tue Aug 09 23:56:10 2011 +0200 @@ -41,9 +41,12 @@ import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction; import com.oracle.max.graal.compiler.ir.Phi.PhiType; import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.base.FrameState.ValueProcedure; +import com.oracle.max.graal.compiler.nodes.cfg.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.compiler.util.*; -import com.oracle.max.graal.compiler.value.*; -import com.oracle.max.graal.compiler.value.FrameState.ValueProcedure; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.bytecode.Bytecodes.MemoryBarriers; @@ -61,7 +64,7 @@ /** * This class traverses the HIR instructions and generates LIR instructions from them. */ -public abstract class LIRGenerator extends ValueVisitor { +public abstract class LIRGenerator extends LIRGeneratorTool { /** * Helper class for inserting memory barriers as necessary to implement the Java Memory Model @@ -116,11 +119,11 @@ * Forces the result of a given instruction to be available in a given register, * inserting move instructions if necessary. * - * @param instruction an instruction that produces a {@linkplain Value#operand() result} + * @param instruction an instruction that produces a {@linkplain ValueNode#operand() result} * @param register the {@linkplain CiRegister} in which the result of {@code instruction} must be available * @return {@code register} as an operand */ - protected CiValue force(Value instruction, CiRegister register) { + protected CiValue force(ValueNode instruction, CiRegister register) { return force(instruction, register.asValue(instruction.kind)); } @@ -128,11 +131,11 @@ * Forces the result of a given instruction to be available in a given operand, * inserting move instructions if necessary. * - * @param instruction an instruction that produces a {@linkplain Value#operand() result} + * @param instruction an instruction that produces a {@linkplain ValueNode#operand() result} * @param operand the operand in which the result of {@code instruction} must be available * @return {@code operand} */ - protected CiValue force(Value instruction, CiValue operand) { + protected CiValue force(ValueNode instruction, CiValue operand) { CiValue result = makeOperand(instruction); if (result != operand) { assert result.kind != CiKind.Illegal; @@ -147,7 +150,8 @@ return operand; } - public CiValue load(Value val) { + @Override + public CiValue load(ValueNode val) { CiValue result = makeOperand(val); if (!result.isVariableOrRegister()) { CiVariable operand = newVariable(val.kind); @@ -180,8 +184,8 @@ public final OperandPool operands; - private Value currentInstruction; - private Value lastInstructionPrinted; // Debugging only + private ValueNode currentInstruction; + private ValueNode lastInstructionPrinted; // Debugging only private List constants; private List variablesForConstants; @@ -204,6 +208,7 @@ this.operands = new OperandPool(compilation.target); } + @Override public CiTarget target() { return compilation.target; } @@ -288,7 +293,7 @@ } if (instr != instr.graph().start()) { walkState(instr, stateAfter); - doRoot((Value) instr); + doRoot((ValueNode) instr); } if (stateAfter != null) { lastState = stateAfter; @@ -406,7 +411,7 @@ } @Override - public void visitStoreIndexed(StoreIndexed x) { + public void visitStoreIndexed(StoreIndexedNode x) { XirArgument array = toXirArgument(x.array()); XirArgument length = x.length() == null ? null : toXirArgument(x.length()); XirArgument index = toXirArgument(x.index()); @@ -517,7 +522,7 @@ } else if (node instanceof Compare) { emitCompare((Compare) node, trueSuccessor, falseSuccessor); } else if (node instanceof InstanceOf) { - emitInstanceOf((TypeCheck) node, trueSuccessor, falseSuccessor, info); + emitInstanceOf((TypeCheckNode) node, trueSuccessor, falseSuccessor, info); } else if (node instanceof Constant) { emitConstantBranch(((Constant) node).asConstant().asBoolean(), trueSuccessor, falseSuccessor, info); } else { @@ -544,7 +549,7 @@ } } - private void emitInstanceOf(TypeCheck x, LIRBlock trueSuccessor, LIRBlock falseSuccessor, LIRDebugInfo info) { + private void emitInstanceOf(TypeCheckNode x, LIRBlock trueSuccessor, LIRBlock falseSuccessor, LIRDebugInfo info) { XirArgument obj = toXirArgument(x.object()); XirSnippet snippet = xir.genInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass()); emitXir(snippet, x, info, null, false); @@ -553,8 +558,8 @@ instr.setFalseSuccessor(falseSuccessor); } - public void emitMaterializeInstanceOf(MaterializeNode materialize, Value resultValue, LIRDebugInfo info) { - TypeCheck x = (TypeCheck) materialize.condition(); + public void emitMaterializeInstanceOf(MaterializeNode materialize, ValueNode resultValue, LIRDebugInfo info) { + TypeCheckNode x = (TypeCheckNode) materialize.condition(); XirArgument obj = toXirArgument(x.object()); XirSnippet snippet = xir.genMaterializeInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass()); emitXir(snippet, resultValue, info, null, true); @@ -623,7 +628,7 @@ } protected FrameState stateBeforeInvokeWithArguments(Invoke invoke) { - return invoke.stateAfter().duplicateModified(invoke.bci, invoke.stateAfter().rethrowException(), invoke.kind, invoke.arguments().toArray(new Value[0])); + return invoke.stateAfter().duplicateModified(invoke.bci, invoke.stateAfter().rethrowException(), invoke.kind, invoke.arguments().toArray(new ValueNode[0])); } @Override @@ -665,7 +670,7 @@ } CiValue resultOperand = resultOperandFor(x.kind); - CiCallingConvention cc = compilation.frameMap().getCallingConvention(x.signature(), JavaCall); + CiCallingConvention cc = compilation.frameMap().getCallingConvention(getSignature(x), JavaCall); List pointerSlots = new ArrayList(2); List argList = visitInvokeArguments(cc, x, pointerSlots); @@ -690,6 +695,11 @@ } } + private CiKind[] getSignature(Invoke x) { + CiKind receiver = x.isStatic() ? null : x.target.holder().kind(); + return Util.signatureToKinds(x.target.signature(), receiver); + } + @Override public void visitMonitorAddress(MonitorAddress x) { CiValue result = createResultVariable(x); @@ -818,6 +828,7 @@ return stub; } + @Override public void deoptimizeOn(Condition cond) { DeoptimizationStub stub = createDeoptStub(); lir.branch(cond, stub.label, stub.info); @@ -857,7 +868,7 @@ return XirArgument.forInternalObject(v); } - protected XirArgument toXirArgument(Value i) { + protected XirArgument toXirArgument(ValueNode i) { if (i == null) { return null; } @@ -904,11 +915,11 @@ } } - protected CiValue emitXir(XirSnippet snippet, Value x, LIRDebugInfo info, RiMethod method, boolean setInstructionResult) { + protected CiValue emitXir(XirSnippet snippet, ValueNode x, LIRDebugInfo info, RiMethod method, boolean setInstructionResult) { return emitXir(snippet, x, info, null, method, setInstructionResult, null); } - protected CiValue emitXir(XirSnippet snippet, Value instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod method, boolean setInstructionResult, List pointerSlots) { + protected CiValue emitXir(XirSnippet snippet, ValueNode instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod method, boolean setInstructionResult, List pointerSlots) { if (GraalOptions.PrintXirTemplates) { TTY.println("Emit XIR template " + snippet.template.name); } @@ -1028,7 +1039,7 @@ } @Override - public void visitStoreField(StoreField x) { + public void visitStoreField(StoreFieldNode x) { RiField field = x.field(); LIRDebugInfo info = stateFor(x); @@ -1047,7 +1058,7 @@ } @Override - public void visitTableSwitch(TableSwitch x) { + public void visitTableSwitch(TableSwitchNode x) { LIRItem value = new LIRItem(x.value(), this); // Making a copy of the switch value is necessary when generating a jump table @@ -1121,6 +1132,7 @@ * @return the operand that is guaranteed to be a stack location when it is * initially defined a by move from {@code value} */ + @Override public CiValue forceToSpill(CiValue value, CiKind kind, boolean mustStayOnStack) { assert value.isLegal() : "value should not be illegal"; assert kind.jvmSlots == value.kind.jvmSlots : "size mismatch"; @@ -1165,7 +1177,8 @@ * @param x an instruction that produces a result * @return the variable assigned to hold the result produced by {@code x} */ - public CiVariable createResultVariable(Value x) { + @Override + public CiVariable createResultVariable(ValueNode x) { CiVariable operand = newVariable(x.kind); setResult(x, operand); return operand; @@ -1236,10 +1249,21 @@ } } - public void integerAdd(Value result, Value left, Value right) { + @Override + public void integerAdd(ValueNode result, ValueNode left, ValueNode right) { arithmeticOpInt(Bytecodes.IADD, createResultVariable(result), load(left), load(right), CiValue.IllegalValue); } + @Override + public void emitUnsignedShiftRight(CiValue value, CiValue count, CiValue dst, CiValue tmp) { + lir().unsignedShiftRight(value, count, dst, tmp); + } + + @Override + public void emitAdd(CiValue a, CiValue b, CiValue dest) { + lir().add(a, b, dest); + } + public void arithmeticOpInt(int code, CiValue result, CiValue left, CiValue right, CiValue tmp) { CiValue leftOp = left; @@ -1383,7 +1407,7 @@ return res.toArray(new SwitchRange[res.size()]); } - SwitchRange[] createLookupRanges(TableSwitch x) { + SwitchRange[] createLookupRanges(TableSwitchNode x) { // XXX: try to merge this with the code for LookupSwitch List res = new ArrayList(x.numberOfCases()); int len = x.numberOfCases(); @@ -1413,7 +1437,7 @@ return res.toArray(new SwitchRange[res.size()]); } - void doRoot(Value instr) { + void doRoot(ValueNode instr) { if (GraalOptions.TraceLIRGeneratorLevel >= 2) { TTY.println("Emitting LIR for instruction " + instr); } @@ -1529,7 +1553,7 @@ PhiResolver resolver = new PhiResolver(this); for (Phi phi : merge.phis()) { if (phi.type() == PhiType.Value) { - Value curVal = phi.valueAt(nextSuccIndex); + ValueNode curVal = phi.valueAt(nextSuccIndex); if (curVal != null && curVal != phi) { if (curVal instanceof Phi) { operandForPhi((Phi) curVal); @@ -1552,11 +1576,12 @@ * @param kind the kind of the variable * @return a new variable */ + @Override public CiVariable newVariable(CiKind kind) { return operands.newVariable(kind); } - CiValue operandForInstruction(Value x) { + CiValue operandForInstruction(ValueNode x) { CiValue operand = x.operand(); if (operand.isIllegal()) { if (x instanceof Constant) { @@ -1589,11 +1614,11 @@ protected void preGCWriteBarrier(CiValue addrOpr, boolean patch, LIRDebugInfo info) { } - protected void setNoResult(Value x) { + protected void setNoResult(ValueNode x) { x.clearOperand(); } - public CiValue setResult(Value x, CiVariable operand) { + public CiValue setResult(ValueNode x, CiVariable operand) { x.setOperand(operand); if (GraalOptions.DetailedAsserts) { operands.recordResult(operand, x); @@ -1633,7 +1658,7 @@ } state.forEachLiveStateValue(new ValueProcedure() { - public void doValue(Value value) { + public void doValue(ValueNode value) { if (value == x) { // nothing to do, will be visited shortly } else if (value instanceof Phi && ((Phi) value).type() == PhiType.Value) { @@ -1648,12 +1673,12 @@ }); } - protected LIRDebugInfo stateFor(Value x) { + protected LIRDebugInfo stateFor(ValueNode x) { assert lastState != null : "must have state before instruction for " + x; return stateFor(x, lastState); } - protected LIRDebugInfo stateFor(Value x, FrameState state) { + protected LIRDebugInfo stateFor(ValueNode x, FrameState state) { if (compilation.placeholderState != null) { state = compilation.placeholderState; } @@ -1664,7 +1689,7 @@ // for each argument, load it into the correct location List argList = new ArrayList(); int j = 0; - for (Value arg : x.arguments()) { + for (ValueNode arg : x.arguments()) { if (arg != null) { CiValue operand = cc.locations[j++]; if (operand.isRegister()) { @@ -1693,12 +1718,13 @@ } /** - * Ensures that an operand has been {@linkplain Value#setOperand(CiValue) initialized} + * Ensures that an operand has been {@linkplain ValueNode#setOperand(CiValue) initialized} * for storing the result of an instruction. * * @param instruction an instruction that produces a result value */ - public CiValue makeOperand(Value instruction) { + @Override + public CiValue makeOperand(ValueNode instruction) { if (instruction == null) { return CiValue.IllegalValue; } @@ -1730,7 +1756,7 @@ return returnRegister.asValue(kind); } - protected XirSupport site(Value x) { + protected XirSupport site(ValueNode x) { return xirSupport.site(x); } @@ -1742,9 +1768,9 @@ } } - public abstract boolean canInlineAsConstant(Value i); + public abstract boolean canInlineAsConstant(ValueNode i); - protected abstract boolean canStoreAsConstant(Value i, CiKind kind); + protected abstract boolean canStoreAsConstant(ValueNode i, CiKind kind); protected abstract boolean strengthReduceMultiply(CiValue left, int constant, CiValue result, CiValue tmp); @@ -1758,7 +1784,7 @@ * Implements site-specific information for the XIR interface. */ static class XirSupport implements XirSite { - Value current; + ValueNode current; XirSupport() { } @@ -1800,7 +1826,7 @@ return current == null ? null : current.exactType(); } - XirSupport site(Value v) { + XirSupport site(ValueNode v) { current = v; return this; } @@ -1819,7 +1845,7 @@ } @Override - public void visitUnwind(Unwind x) { + public void visitUnwind(UnwindNode x) { // move exception oop into fixed register CiCallingConvention callingConvention = compilation.frameMap().getCallingConvention(new CiKind[]{CiKind.Object}, RuntimeCall); CiValue argumentOperand = callingConvention.locations[0]; @@ -1829,16 +1855,75 @@ setNoResult(x); } - public interface LIRGeneratorOp extends Op { - void generate(Node n, LIRGenerator generator); - } + public abstract Condition floatingPointCondition(Condition cond); + + @Override + public void visitConditional(Conditional conditional) { + + BooleanNode condition = conditional.condition(); + LIRGenerator generator = this; - public static final LIRGeneratorOp DELEGATE_TO_VALUE_VISITOR = new LIRGeneratorOp() { - @Override - public void generate(Node n, LIRGenerator generator) { - ((Value) n).accept(generator); + // try to use cmp + cmov first + Condition cond = null; + CiValue left = null; + CiValue right = null; + boolean floating = false; + boolean unOrderedIsSecond = false; + boolean negate = false; + while (condition instanceof NegateBooleanNode) { + negate = !negate; + condition = ((NegateBooleanNode) condition).value(); } - }; + if (condition instanceof Compare) { + Compare compare = (Compare) condition; + ValueNode x = compare.x(); + ValueNode y = compare.y(); + cond = compare.condition(); + if (x.kind.isFloatOrDouble()) { + floating = true; + unOrderedIsSecond = !compare.unorderedIsTrue(); + cond = generator.floatingPointCondition(cond); + } + left = generator.load(x); + if (!generator.canInlineAsConstant(y)) { + right = generator.load(y); + } else { + right = generator.makeOperand(y); + } + } else if (condition instanceof IsNonNull) { + IsNonNull isNonNull = (IsNonNull) condition; + left = generator.load(isNonNull.object()); + right = CiConstant.NULL_OBJECT; + cond = Condition.NE; + } else if (condition instanceof Constant) { + generator.lir().move(condition.asConstant(), generator.createResultVariable(conditional)); + } else if (condition instanceof InstanceOf) { + if (conditional instanceof MaterializeNode && !negate) { + generator.emitMaterializeInstanceOf((MaterializeNode) conditional, conditional, null); + } else { + generator.emitMaterializeInstanceOf((MaterializeNode) conditional, condition, null); + left = condition.operand(); + right = CiConstant.INT_1; + cond = Condition.EQ; + } + } else { + throw Util.shouldNotReachHere("Currently not implemented because we can not create blocks during LIRGen : " + condition); + } - public abstract Condition floatingPointCondition(Condition cond); + if (cond != null) { + CiVariable result = generator.createResultVariable(conditional); + CiValue tVal = generator.makeOperand(conditional.trueValue()); + CiValue fVal = generator.makeOperand(conditional.falseValue()); + if (negate) { + cond = cond.negate(); + } + assert left != null && right != null; + generator.lir().cmp(cond, left, right); + if (floating) { + generator.lir().fcmove(cond, tVal, fVal, result, unOrderedIsSecond); + } else { + generator.lir().cmove(cond, tVal, fVal, result); + } + } + } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRItem.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRItem.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRItem.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,13 +22,13 @@ */ package com.oracle.max.graal.compiler.gen; -import com.oracle.max.graal.compiler.alloc.OperandPool.*; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.alloc.OperandPool.VariableFlag; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.ci.*; /** - * A helper utility for loading the {@linkplain Value#operand() result} + * A helper utility for loading the {@linkplain ValueNode#operand() result} * of an instruction for use by another instruction. This helper takes * into account the specifics of the consuming instruction such as whether * it requires the input operand to be in memory or a register, any @@ -46,10 +46,10 @@ /** * The instruction whose usage by another instruction is being modeled by this object. - * An instruction {@code x} uses instruction {@code y} if the {@linkplain Value#operand() result} + * An instruction {@code x} uses instruction {@code y} if the {@linkplain ValueNode#operand() result} * of {@code y} is an input operand of {@code x}. */ - public Value instruction; + public ValueNode instruction; /** * The LIR context of this helper object. @@ -75,7 +75,7 @@ */ private CiValue intermediateOperand; - public LIRItem(Value instruction, LIRGenerator gen) { + public LIRItem(ValueNode instruction, LIRGenerator gen) { this.gen = gen; this.instruction = instruction; resultOperand = gen.makeOperand(instruction); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiSimplifier.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiSimplifier.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiSimplifier.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,6 +23,7 @@ package com.oracle.max.graal.compiler.gen; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; @@ -45,14 +46,14 @@ } } - private Value simplify(Value x) { + private ValueNode simplify(ValueNode x) { if (x == null || !(x instanceof Phi)) { return x; } Phi phi = (Phi) x; if (phi.valueCount() == 1 && !cannotSimplify.isMarked(phi)) { - Value result = phi.valueAt(0); + ValueNode result = phi.valueAt(0); phi.replaceAndDelete(result); return result; } @@ -66,11 +67,11 @@ } else { // attempt to simplify the phi by recursively simplifying its operands visited.mark(phi); - Value phiSubst = null; + ValueNode phiSubst = null; int max = phi.valueCount(); boolean cannotSimplify = false; for (int i = 0; i < max; i++) { - Value oldInstr = phi.valueAt(i); + ValueNode oldInstr = phi.valueAt(i); if (oldInstr == null) { // if one operand is illegal, make the entire phi illegal @@ -79,7 +80,7 @@ return null; } - Value newInstr = simplify(oldInstr); + ValueNode newInstr = simplify(oldInstr); if (newInstr == null) { // if the subst instruction is illegal, make the entire phi illegal diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/CompilerGraph.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/CompilerGraph.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/CompilerGraph.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,6 +23,7 @@ package com.oracle.max.graal.compiler.graph; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -32,7 +33,7 @@ private RiRuntime runtime; private Return returnSingleton; - private Unwind unwindSingleton; + private UnwindNode unwindSingleton; private CiAssumptions assumptions = new CiAssumptions(); public CompilerGraph(RiRuntime runtime) { @@ -48,12 +49,12 @@ return returnSingleton; } - public void setUnwind(Unwind unwind) { + public void setUnwind(UnwindNode unwind) { assert unwindSingleton == null; unwindSingleton = unwind; } - public Unwind getUnwind() { + public UnwindNode getUnwind() { return unwindSingleton; } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,10 +27,10 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.compiler.schedule.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.extensions.*; import com.oracle.max.graal.graph.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/PostOrderNodeIterator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/PostOrderNodeIterator.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/PostOrderNodeIterator.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,6 +25,7 @@ import java.util.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; @@ -86,8 +87,8 @@ } else if (current instanceof Return) { returnNode((Return) current); current = nextQueuedNode(); - } else if (current instanceof Unwind) { - unwind((Unwind) current); + } else if (current instanceof UnwindNode) { + unwind((UnwindNode) current); current = nextQueuedNode(); } else if (current instanceof ControlSplit) { controlSplit((ControlSplit) current); @@ -189,7 +190,7 @@ node(invoke); } - protected void unwind(Unwind unwind) { + protected void unwind(UnwindNode unwind) { node(unwind); } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AbstractMemoryCheckpointNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AbstractMemoryCheckpointNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AbstractMemoryCheckpointNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,6 +24,7 @@ import java.util.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AbstractVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AbstractVectorNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AbstractVectorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,6 +24,7 @@ import java.util.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -76,7 +77,7 @@ } } - public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { + public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { throw new IllegalStateException("unimplemented"); } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessArray.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessArray.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessArray.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -30,13 +31,13 @@ */ public abstract class AccessArray extends StateSplit { - @Input private Value array; + @Input private ValueNode array; - public Value array() { + public ValueNode array() { return array; } - public void setArray(Value x) { + public void setArray(ValueNode x) { updateUsages(array, x); array = x; } @@ -47,7 +48,7 @@ * @param array the instruction that produces the array object value * @param graph */ - public AccessArray(CiKind kind, Value array, Graph graph) { + public AccessArray(CiKind kind, ValueNode array, Graph graph) { super(kind, graph); setArray(array); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessField.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessField.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessField.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,6 +25,7 @@ import java.lang.reflect.*; import java.util.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -34,13 +35,13 @@ */ public abstract class AccessField extends StateSplit { - @Input private Value object; + @Input private ValueNode object; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } @@ -54,7 +55,7 @@ * @param field the compiler interface representation of the field * @param graph */ - public AccessField(CiKind kind, Value object, RiField field, Graph graph) { + public AccessField(CiKind kind, ValueNode object, RiField field, Graph graph) { super(kind, graph); this.field = field; setObject(object); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessIndexed.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessIndexed.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessIndexed.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -31,24 +32,24 @@ */ public abstract class AccessIndexed extends AccessArray { - @Input private Value index; + @Input private ValueNode index; - @Input private Value length; + @Input private ValueNode length; - public Value index() { + public ValueNode index() { return index; } - public void setIndex(Value x) { + public void setIndex(ValueNode x) { updateUsages(index, x); index = x; } - public Value length() { + public ValueNode length() { return length; } - public void setLength(Value x) { + public void setLength(ValueNode x) { updateUsages(length, x); length = x; } @@ -64,7 +65,7 @@ * @param elementKind the type of the elements of the array * @param graph */ - AccessIndexed(CiKind kind, Value array, Value index, Value length, CiKind elementKind, Graph graph) { + protected AccessIndexed(CiKind kind, ValueNode array, ValueNode index, ValueNode length, CiKind elementKind, Graph graph) { super(kind, array, graph); setIndex(index); setLength(length); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessMonitor.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessMonitor.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessMonitor.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -30,24 +31,24 @@ */ public abstract class AccessMonitor extends AbstractMemoryCheckpointNode { - @Input private Value object; + @Input private ValueNode object; - @Input private Value lockAddress; + @Input private ValueNode lockAddress; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } - public Value lockAddress() { + public ValueNode lockAddress() { return lockAddress; } - public void setLockAddress(Value x) { + public void setLockAddress(ValueNode x) { updateUsages(lockAddress, x); lockAddress = x; } @@ -65,7 +66,7 @@ * @param lockNumber the number of the lock being acquired * @param graph */ - public AccessMonitor(Value object, Value lockAddress, int lockNumber, Graph graph) { + public AccessMonitor(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) { super(CiKind.Illegal, graph); this.lockNumber = lockNumber; setObject(object); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,22 +22,22 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public abstract class AccessNode extends AbstractMemoryCheckpointNode { - @Input private Value object; + @Input private ValueNode object; @Input private GuardNode guard; @Input private LocationNode location; @Input private final NodeInputList dependencies = new NodeInputList(this); - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } @@ -60,7 +60,7 @@ location = x; } - public AccessNode(CiKind kind, Value object, LocationNode location, Graph graph) { + public AccessNode(CiKind kind, ValueNode object, LocationNode location, Graph graph) { super(kind, graph); setLocation(location); setObject(object); @@ -73,9 +73,4 @@ public NodeInputList dependencies() { return dependencies; } - - @Override - public void print(LogStream out) { - out.print("mem read from ").print(object()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessVectorNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/AccessVectorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,20 +22,21 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public abstract class AccessVectorNode extends AbstractVectorNode { - @Input private Value object; + @Input private ValueNode object; @Input private LocationNode location; @Input private final NodeInputList dependencies = new NodeInputList(this); - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } @@ -49,7 +50,7 @@ location = x; } - public AccessVectorNode(CiKind kind, AbstractVectorNode vector, Value object, LocationNode location, Graph graph) { + public AccessVectorNode(CiKind kind, AbstractVectorNode vector, ValueNode object, LocationNode location, Graph graph) { super(kind, vector, graph); setObject(object); setLocation(location); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Anchor.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Anchor.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Anchor.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -45,9 +45,4 @@ public void accept(ValueVisitor v) { v.visitAnchor(this); } - - @Override - public void print(LogStream out) { - out.print("anchor ").print(next()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/And.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/And.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/And.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "&") public final class And extends Logic implements Canonicalizable { - public And(CiKind kind, Value x, Value y, Graph graph) { + public And(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.IAND : Bytecodes.LAND, x, y, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Arithmetic.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Arithmetic.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Arithmetic.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -42,7 +43,7 @@ * @param y the second input instruction * @param isStrictFP indicates this operation has strict rounding semantics */ - public Arithmetic(CiKind kind, int opcode, Value x, Value y, boolean isStrictFP, Graph graph) { + public Arithmetic(CiKind kind, int opcode, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) { super(kind, opcode, x, y, graph); this.isStrictFP = isStrictFP; } @@ -63,9 +64,4 @@ public boolean isCommutative() { return Bytecodes.isCommutative(opcode); } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(this.shortName()).print(' ').print(y()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ArrayLength.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ArrayLength.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ArrayLength.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,10 +22,9 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.graph.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -35,13 +34,13 @@ */ public final class ArrayLength extends FloatingNode implements Canonicalizable { - @Input private Value array; + @Input private ValueNode array; - public Value array() { + public ValueNode array() { return array; } - public void setArray(Value x) { + public void setArray(ValueNode x) { updateUsages(array, x); array = x; } @@ -52,7 +51,7 @@ * @param array the instruction producing the array * @param newFrameState the state after executing this instruction */ - public ArrayLength(Value array, Graph graph) { + public ArrayLength(ValueNode array, Graph graph) { super(CiKind.Int, graph); setArray(array); } @@ -63,14 +62,9 @@ } @Override - public void print(LogStream out) { - out.print(array()).print(".length"); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (array() instanceof NewArray) { - Value length = ((NewArray) array()).dimension(0); + ValueNode length = ((NewArray) array()).dimension(0); assert length != null; return length; } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BasicInductionVariable.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BasicInductionVariable.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BasicInductionVariable.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,9 +23,8 @@ package com.oracle.max.graal.compiler.ir; import com.oracle.max.graal.compiler.ir.Phi.PhiType; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; -import com.oracle.max.graal.compiler.phases.LoweringPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -38,7 +37,7 @@ public static final BIVLoweringOp LOWERING = new BIVLoweringOp(); @Input private LoopCounter loopCounter; - public BasicInductionVariable(CiKind kind, Value init, Value stride, LoopCounter counter, Graph graph) { + public BasicInductionVariable(CiKind kind, ValueNode init, ValueNode stride, LoopCounter counter, Graph graph) { super(kind, init, stride, graph); setLoopCounter(counter); } @@ -52,19 +51,19 @@ this.loopCounter = loopCounter; } - public Value init() { + public ValueNode init() { return a(); } - public void setInit(Value init) { + public void setInit(ValueNode init) { setA(init); } - public Value stride() { + public ValueNode stride() { return b(); } - public void setStride(Value stride) { + public void setStride(ValueNode stride) { setB(stride); } @@ -114,7 +113,7 @@ biv.replaceAtNonIVUsages(phi); } - public Phi ivToPhi(LoopBegin loopBegin, Value init, Value stride, CiKind kind) { + public Phi ivToPhi(LoopBegin loopBegin, ValueNode init, ValueNode stride, CiKind kind) { Phi phi = new Phi(kind, loopBegin, PhiType.Value, loopBegin.graph()); IntegerArithmeticNode after = IntegerArithmeticNode.add(phi, stride); phi.addInput(init); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Binary.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Binary.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Binary.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,24 +32,24 @@ */ public abstract class Binary extends FloatingNode { - @Input private Value x; - @Input private Value y; + @Input private ValueNode x; + @Input private ValueNode y; @Data public final int opcode; - public Value x() { + public ValueNode x() { return x; } - public void setX(Value x) { + public void setX(ValueNode x) { updateUsages(this.x, x); this.x = x; } - public Value y() { + public ValueNode y() { return y; } - public void setY(Value x) { + public void setY(ValueNode x) { updateUsages(y, x); this.y = x; } @@ -60,7 +61,7 @@ * @param x the first input instruction * @param y the second input instruction */ - public Binary(CiKind kind, int opcode, Value x, Value y, Graph graph) { + public Binary(CiKind kind, int opcode, ValueNode x, ValueNode y, Graph graph) { super(kind, graph); this.opcode = opcode; setX(x); @@ -72,7 +73,7 @@ */ public void swapOperands() { assert Bytecodes.isCommutative(opcode); - Value t = x(); + ValueNode t = x(); setX(y()); setY(t); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CastNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CastNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CastNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,25 +22,25 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class CastNode extends FloatingNode { - @Input private Value value; + @Input private ValueNode value; - public Value value() { + public ValueNode value() { return value; } - public void setValue(Value x) { + public void setValue(ValueNode x) { updateUsages(value, x); value = x; } - public CastNode(CiKind kind, Value n, Graph graph) { + public CastNode(CiKind kind, ValueNode n, Graph graph) { super(kind, graph); setValue(n); } @@ -53,10 +53,10 @@ @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { - return (T) new LIRGenerator.LIRGeneratorOp() { + if (clazz == LIRGeneratorOp.class) { + return (T) new LIRGeneratorOp() { @Override - public void generate(Node n, LIRGenerator generator) { + public void generate(Node n, LIRGeneratorTool generator) { CastNode conv = (CastNode) n; conv.setOperand(generator.load(conv.value())); } @@ -64,9 +64,4 @@ } return super.lookup(clazz); } - - @Override - public void print(LogStream out) { - out.print("cast node ").print(value().toString()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CheckCast.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CheckCast.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CheckCast.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -33,7 +33,7 @@ /** * The {@code CheckCast} instruction represents a {@link Bytecodes#CHECKCAST}. */ -public final class CheckCast extends TypeCheck implements Canonicalizable { +public final class CheckCast extends TypeCheckNode implements Canonicalizable { /** * Creates a new CheckCast instruction. @@ -42,7 +42,7 @@ * @param object the instruction producing the object * @param graph */ - public CheckCast(Value targetClassInstruction, Value object, Graph graph) { + public CheckCast(ValueNode targetClassInstruction, ValueNode object, Graph graph) { super(targetClassInstruction, object, CiKind.Object, graph); } @@ -72,11 +72,6 @@ } @Override - public void print(LogStream out) { - out.print("checkcast(").print(object()).print(",").print(targetClassInstruction()).print(") ").print(CiUtil.toJavaName(targetClass())); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (object().exactType() != null) { return object(); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Compare.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Compare.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Compare.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,11 +24,9 @@ import java.util.*; -import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.graph.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -42,26 +40,26 @@ */ public final class Compare extends BooleanNode implements Canonicalizable { - @Input private Value x; - @Input private Value y; + @Input private ValueNode x; + @Input private ValueNode y; @Data private Condition condition; @Data private boolean unorderedIsTrue; - public Value x() { + public ValueNode x() { return x; } - public void setX(Value x) { + public void setX(ValueNode x) { updateUsages(this.x, x); this.x = x; } - public Value y() { + public ValueNode y() { return y; } - public void setY(Value x) { + public void setY(ValueNode x) { updateUsages(y, x); this.y = x; } @@ -74,7 +72,7 @@ * @param y the instruction that produces the second input to this instruction * @param graph */ - public Compare(Value x, Condition condition, Value y, Graph graph) { + public Compare(ValueNode x, Condition condition, ValueNode y, Graph graph) { super(CiKind.Illegal, graph); assert (x == null && y == null) || Util.archKindsEqual(x, y); this.condition = condition; @@ -111,7 +109,7 @@ */ public void swapOperands() { condition = condition.mirror(); - Value t = x(); + ValueNode t = x(); setX(y()); setY(t); } @@ -126,11 +124,6 @@ } @Override - public void print(LogStream out) { - out.print("comp ").print(x()).print(' ').print(condition().operator).print(' ').print(y()); - } - - @Override public String shortName() { return "Comp " + condition.operator; } @@ -153,9 +146,6 @@ if (isFalseCheck) { result = new NegateBooleanNode(result, graph()); } - if (GraalOptions.TraceCanonicalizer) { - TTY.println("Removed materialize replacing with " + result); - } return result; } } @@ -171,9 +161,6 @@ Compare result = new Compare(normalizeNode.x(), condition, normalizeNode.y(), graph()); boolean isLess = condition == Condition.LE || condition == Condition.LT || condition == Condition.BE || condition == Condition.BT; result.unorderedIsTrue = condition != Condition.EQ && (condition == Condition.NE || !(isLess ^ normalizeNode.isUnorderedLess())); - if (GraalOptions.TraceCanonicalizer) { - TTY.println("Replaced Compare+NormalizeCompare with " + result); - } return result; } return this; @@ -188,14 +175,7 @@ CiConstant constY = y().asConstant(); Boolean result = condition().foldCondition(constX, constY, ((CompilerGraph) graph()).runtime(), unorderedIsTrue()); if (result != null) { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("folded condition " + constX + " " + condition() + " " + constY); - } return Constant.forBoolean(result, graph()); - } else { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("if not removed %s %s %s (%s %s)", constX, condition(), constY, constX.kind, constY.kind); - } } } @@ -211,7 +191,7 @@ return Constant.forBoolean(condition().check(1, 1), graph()); } if ((condition == Condition.NE || condition == Condition.EQ) && x().kind == CiKind.Object) { - Value object = null; + ValueNode object = null; if (x().isNullConstant()) { object = y(); } else if (y().isNullConstant()) { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Conditional.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Conditional.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Conditional.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,14 +22,9 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; -import com.oracle.max.graal.compiler.gen.LIRGenerator.LIRGeneratorOp; import com.oracle.max.graal.compiler.ir.Phi.PhiType; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -60,7 +55,7 @@ * @param trueValue the value produced if the condition is true * @param falseValue the value produced if the condition is false */ - public Conditional(BooleanNode condition, Value trueValue, Value falseValue, Graph graph) { + public Conditional(BooleanNode condition, ValueNode trueValue, ValueNode falseValue, Graph graph) { // TODO: return the appropriate bytecode IF_ICMPEQ, etc super(trueValue.kind.meet(falseValue.kind), Bytecodes.ILLEGAL, trueValue, falseValue, graph); setCondition(condition); @@ -71,27 +66,22 @@ super(kind, Bytecodes.ILLEGAL, null, null, graph); } - public Value trueValue() { + public ValueNode trueValue() { return x(); } - public Value falseValue() { + public ValueNode falseValue() { return y(); } - public void setTrueValue(Value value) { + public void setTrueValue(ValueNode value) { setX(value); } - public void setFalseValue(Value value) { + public void setFalseValue(ValueNode value) { setY(value); } - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(condition()).print(' ').print(y()).print(" ? ").print(trueValue()).print(" : ").print(falseValue()); - } - @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { @@ -114,11 +104,11 @@ } } - public static ConditionalStructure createConditionalStructure(BooleanNode condition, Value trueValue, Value falseValue) { + public static ConditionalStructure createConditionalStructure(BooleanNode condition, ValueNode trueValue, ValueNode falseValue) { return createConditionalStructure(condition, trueValue, falseValue, 0.5); } - public static ConditionalStructure createConditionalStructure(BooleanNode condition, Value trueValue, Value falseValue, double trueProbability) { + public static ConditionalStructure createConditionalStructure(BooleanNode condition, ValueNode trueValue, ValueNode falseValue, double trueProbability) { Graph graph = condition.graph(); CiKind kind = trueValue.kind.meet(falseValue.kind); If ifNode = new If(condition, trueProbability, graph); @@ -138,72 +128,8 @@ private static final LIRGeneratorOp LIRGEN = new LIRGeneratorOp() { @Override - public void generate(Node n, LIRGenerator generator) { - Conditional conditional = (Conditional) n; - BooleanNode condition = conditional.condition(); - - // try to use cmp + cmov first - Condition cond = null; - CiValue left = null; - CiValue right = null; - boolean floating = false; - boolean unOrderedIsSecond = false; - boolean negate = false; - while (condition instanceof NegateBooleanNode) { - negate = !negate; - condition = ((NegateBooleanNode) condition).value(); - } - if (condition instanceof Compare) { - Compare compare = (Compare) condition; - Value x = compare.x(); - Value y = compare.y(); - cond = compare.condition(); - if (x.kind.isFloatOrDouble()) { - floating = true; - unOrderedIsSecond = !compare.unorderedIsTrue(); - cond = generator.floatingPointCondition(cond); - } - left = generator.load(x); - if (!generator.canInlineAsConstant(y)) { - right = generator.load(y); - } else { - right = generator.makeOperand(y); - } - } else if (condition instanceof IsNonNull) { - IsNonNull isNonNull = (IsNonNull) condition; - left = generator.load(isNonNull.object()); - right = CiConstant.NULL_OBJECT; - cond = Condition.NE; - } else if (condition instanceof Constant) { - generator.lir().move(condition.asConstant(), generator.createResultVariable(conditional)); - } else if (condition instanceof InstanceOf) { - if (conditional instanceof MaterializeNode && !negate) { - generator.emitMaterializeInstanceOf((MaterializeNode) conditional, conditional, null); - } else { - generator.emitMaterializeInstanceOf((MaterializeNode) conditional, condition, null); - left = condition.operand(); - right = CiConstant.INT_1; - cond = Condition.EQ; - } - } else { - throw Util.shouldNotReachHere("Currently not implemented because we can not create blocks during LIRGen : " + condition); - } - - if (cond != null) { - CiVariable result = generator.createResultVariable(conditional); - CiValue tVal = generator.makeOperand(conditional.trueValue()); - CiValue fVal = generator.makeOperand(conditional.falseValue()); - if (negate) { - cond = cond.negate(); - } - assert left != null && right != null; - generator.lir().cmp(cond, left, right); - if (floating) { - generator.lir().fcmove(cond, tVal, fVal, result, unOrderedIsSecond); - } else { - generator.lir().cmove(cond, tVal, fVal, result); - } - } + public void generate(Node n, LIRGeneratorTool generator) { + generator.visitConditional((Conditional) n); } }; @@ -224,19 +150,13 @@ int trueInt = trueValue().asConstant().asInt(); int falseInt = falseValue().asConstant().asInt(); if (trueInt == 0 && falseInt == 1) { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("> Conditional canon'ed to ~Materialize"); - } reProcess.reProccess(condition); // because we negate it return new MaterializeNode(new NegateBooleanNode(condition, graph()), graph()); } else if (trueInt == 1 && falseInt == 0) { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("> Conditional canon'ed to Materialize"); - } return new MaterializeNode(condition, graph()); } } else if (falseValue() instanceof Constant && !(trueValue() instanceof Constant)) { - Value temp = trueValue(); + ValueNode temp = trueValue(); setTrueValue(falseValue()); setFalseValue(temp); condition = new NegateBooleanNode(condition, graph()); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Constant.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Constant.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Constant.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,7 @@ import static com.oracle.max.graal.compiler.GraalCompilation.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -174,11 +174,6 @@ } @Override - public void print(LogStream out) { - out.print(value.valueString()); - } - - @Override public String shortName() { return value.name(); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Convert.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Convert.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Convert.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,24 +22,24 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; -import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; /** * The {@code Convert} class represents a conversion between primitive types. */ public final class Convert extends FloatingNode { - @Input private Value value; + @Input private ValueNode value; @Data public final int opcode; - public Value value() { + public ValueNode value() { return value; } - public void setValue(Value x) { + public void setValue(ValueNode x) { updateUsages(value, x); value = x; } @@ -51,7 +51,7 @@ * @param kind the result type of this instruction * @param graph */ - public Convert(int opcode, Value value, CiKind kind, Graph graph) { + public Convert(int opcode, ValueNode value, CiKind kind, Graph graph) { super(kind, graph); this.opcode = opcode; setValue(value); @@ -61,9 +61,4 @@ public void accept(ValueVisitor v) { v.visitConvert(this); } - - @Override - public void print(LogStream out) { - out.print(Bytecodes.nameOf(opcode)).print('(').print(value()).print(')'); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CreateVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CreateVectorNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CreateVectorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,22 +24,21 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; import com.oracle.max.graal.compiler.ir.Phi.PhiType; -import com.oracle.max.graal.compiler.phases.LoweringPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class CreateVectorNode extends AbstractVectorNode { - @Input private Value length; + @Input private ValueNode length; - public Value length() { + public ValueNode length() { return length; } - public void setLength(Value x) { + public void setLength(ValueNode x) { updateUsages(length, x); length = x; } @@ -54,7 +53,7 @@ reversed = r; } - public CreateVectorNode(boolean reversed, Value length, Graph graph) { + public CreateVectorNode(boolean reversed, ValueNode length, Graph graph) { super(CiKind.Illegal, null, graph); setLength(length); setReversed(reversed); @@ -70,7 +69,7 @@ @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { + if (clazz == LIRGeneratorOp.class) { return null; } else if (clazz == LoweringOp.class) { return (T) LOWERING_OP; @@ -78,12 +77,7 @@ return super.lookup(clazz); } - @Override - public void print(LogStream out) { - out.print("vector with length ").print(length().toString()); - } - - private LoopBegin createLoop(Map map) { + private LoopBegin createLoop(Map map) { EndNode end = new EndNode(graph()); LoopBegin loopBegin = new LoopBegin(graph()); loopBegin.addEnd(end); @@ -126,14 +120,14 @@ public void lower(Node n, CiLoweringTool tool) { CreateVectorNode vectorNode = (CreateVectorNode) n; - IdentityHashMap nodes = new IdentityHashMap(); + IdentityHashMap nodes = new IdentityHashMap(); LoopBegin begin = vectorNode.createLoop(nodes); for (Node use : vectorNode.usages()) { processUse(begin, use, nodes); } } - private void processUse(LoopBegin loop, Node use, IdentityHashMap nodes) { + private void processUse(LoopBegin loop, Node use, IdentityHashMap nodes) { AbstractVectorNode vectorNode = (AbstractVectorNode) use; if (nodes.containsKey(vectorNode)) { return; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Deoptimize.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -65,11 +65,6 @@ } @Override - public void print(LogStream out) { - out.print("deoptimize"); - } - - @Override public Map getDebugProperties() { Map properties = super.getDebugProperties(); properties.put("message", message); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/DerivedInductionVariable.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/DerivedInductionVariable.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/DerivedInductionVariable.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.LoweringPhase.LoweringOp; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -34,7 +35,7 @@ public class DerivedInductionVariable extends LinearInductionVariable { @Input private InductionVariable base; - public DerivedInductionVariable(CiKind kind, Value offset, Value scale, InductionVariable base, Graph graph) { + public DerivedInductionVariable(CiKind kind, ValueNode offset, ValueNode scale, InductionVariable base, Graph graph) { super(kind, offset, scale, graph); setBase(base); } @@ -48,19 +49,19 @@ this.base = base; } - public Value offset() { + public ValueNode offset() { return a(); } - public void setOffset(Value offset) { + public void setOffset(ValueNode offset) { setA(offset); } - public Value scale() { + public ValueNode scale() { return b(); } - public void setScale(Value scale) { + public void setScale(ValueNode scale) { setB(scale); } @@ -83,8 +84,8 @@ if (base instanceof DerivedInductionVariable) { base = ((DerivedInductionVariable) base).toBasicInductionVariable(); } - Value init; - Value stride; + ValueNode init; + ValueNode stride; LoopCounter counter; if (base instanceof BasicInductionVariable) { BasicInductionVariable basic = (BasicInductionVariable) base; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/EndNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/EndNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/EndNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -40,11 +40,6 @@ v.visitEndNode(this); } - @Override - public void print(LogStream out) { - out.print("end"); - } - public Merge merge() { if (usages().size() == 0) { return null; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionObject.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionObject.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionObject.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -43,9 +44,4 @@ public void accept(ValueVisitor v) { v.visitExceptionObject(this); } - - @Override - public void print(LogStream out) { - out.print("incoming exception"); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedGuard.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedGuard.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedGuard.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,11 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -48,11 +45,6 @@ v.visitFixedGuard(this); } - @Override - public void print(LogStream out) { - out.print("clip node ").print(inputs().toString()); - } - public void addNode(BooleanNode x) { conditions.add(x); } @@ -63,14 +55,8 @@ if (n instanceof Constant) { Constant c = (Constant) n; if (c.asConstant().asBoolean()) { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("Removing redundant fixed guard " + this); - } conditions.remove(n); } else { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("Replacing fixed guard " + this + " with deoptimization node"); - } return new Deoptimize(DeoptAction.InvalidateRecompile, graph()); } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,10 +24,11 @@ import java.util.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; -public abstract class FixedNode extends Value { +public abstract class FixedNode extends ValueNode { private double probability; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatAdd.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatAdd.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatAdd.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "+") public final class FloatAdd extends FloatArithmetic implements Canonicalizable { - public FloatAdd(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + public FloatAdd(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) { super(kind, kind == CiKind.Double ? Bytecodes.DADD : Bytecodes.FADD, x, y, isStrictFP, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatArithmetic.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatArithmetic.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatArithmetic.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,12 +22,13 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public abstract class FloatArithmetic extends Arithmetic { - public FloatArithmetic(CiKind kind, int opcode, Value x, Value y, boolean isStrictFP, Graph graph) { + public FloatArithmetic(CiKind kind, int opcode, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) { super(kind, opcode, x, y, isStrictFP, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatDiv.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatDiv.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatDiv.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "/") public final class FloatDiv extends FloatArithmetic implements Canonicalizable { - public FloatDiv(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + public FloatDiv(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) { super(kind, kind == CiKind.Double ? Bytecodes.DDIV : Bytecodes.FDIV, x, y, isStrictFP, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatMul.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatMul.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatMul.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "*") public final class FloatMul extends FloatArithmetic implements Canonicalizable { - public FloatMul(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + public FloatMul(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) { super(kind, kind == CiKind.Double ? Bytecodes.DMUL : Bytecodes.FMUL, x, y, isStrictFP, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatRem.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatRem.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatRem.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "%") public final class FloatRem extends FloatArithmetic implements Canonicalizable { - public FloatRem(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + public FloatRem(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) { super(kind, kind == CiKind.Double ? Bytecodes.DREM : Bytecodes.FREM, x, y, isStrictFP, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "-") public final class FloatSub extends FloatArithmetic implements Canonicalizable { - public FloatSub(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + public FloatSub(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) { super(kind, kind == CiKind.Double ? Bytecodes.DSUB : Bytecodes.FSUB, x, y, isStrictFP, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatingNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatingNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatingNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,10 +22,11 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; -public abstract class FloatingNode extends Value implements Node.ValueNumberable { +public abstract class FloatingNode extends ValueNode implements Node.ValueNumberable { public FloatingNode(CiKind kind, Graph graph) { super(kind, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/GuardNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/GuardNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/GuardNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,8 +24,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -66,11 +65,6 @@ } @Override - public void print(LogStream out) { - out.print("guard node ").print(node()); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (node() instanceof Constant) { Constant c = (Constant) node(); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/If.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/If.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/If.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,10 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -101,23 +98,12 @@ } @Override - public void print(LogStream out) { - out.print("if ").print(compare()).print(" then ").print(trueSuccessor()).print(" else ").print(falseSuccessor()); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (compare() instanceof Constant) { Constant c = (Constant) compare(); if (c.asConstant().asBoolean()) { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("Replacing if " + this + " with true branch"); - } return trueSuccessor(); } else { - if (GraalOptions.TraceCanonicalizer) { - TTY.println("Replacing if " + this + " with false branch"); - } return falseSuccessor(); } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/InductionVariable.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/InductionVariable.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/InductionVariable.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/InstanceOf.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/InstanceOf.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/InstanceOf.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,16 +22,16 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; /** * The {@code InstanceOf} instruction represents an instanceof test. */ -public final class InstanceOf extends TypeCheck implements Canonicalizable { +public final class InstanceOf extends TypeCheckNode implements Canonicalizable { /** * Constructs a new InstanceOf instruction. @@ -40,7 +40,7 @@ * @param object the instruction producing the object input to this instruction * @param graph */ - public InstanceOf(Constant targetClassInstruction, Value object, boolean nullIsTrue, Graph graph) { + public InstanceOf(Constant targetClassInstruction, ValueNode object, boolean nullIsTrue, Graph graph) { super(targetClassInstruction, object, CiKind.Illegal, graph); } @@ -49,11 +49,6 @@ } @Override - public void print(LogStream out) { - out.print("instanceof(").print(object()).print(") ").print(CiUtil.toJavaName(targetClass())); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (object().exactType() != null) { return Constant.forBoolean(object().exactType().isSubtypeOf(targetClass()), graph()); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAdd.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAdd.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAdd.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "+") public final class IntegerAdd extends IntegerArithmeticNode implements Canonicalizable { - public IntegerAdd(CiKind kind, Value x, Value y, Graph graph) { + public IntegerAdd(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.IADD : Bytecodes.LADD, x, y, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAddVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAddVectorNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAddVectorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,38 +24,39 @@ import java.util.*; -import com.oracle.max.graal.compiler.gen.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class IntegerAddVectorNode extends AbstractVectorNode { - @Input private Value value; + @Input private ValueNode value; - public Value value() { + public ValueNode value() { return value; } - public void setValue(Value x) { + public void setValue(ValueNode x) { updateUsages(value, x); value = x; } - public IntegerAddVectorNode(AbstractVectorNode vector, Value value, Graph graph) { + public IntegerAddVectorNode(AbstractVectorNode vector, ValueNode value, Graph graph) { super(CiKind.Illegal, vector, graph); setValue(value); } @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { + if (clazz == LIRGeneratorOp.class) { return null; } return super.lookup(clazz); } @Override - public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { + public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { nodes.put(this, new IntegerAdd(CiKind.Int, nodes.get(vector()), value(), graph())); } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmeticNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmeticNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmeticNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -29,12 +30,12 @@ public abstract class IntegerArithmeticNode extends Arithmetic { - public IntegerArithmeticNode(CiKind kind, int opcode, Value x, Value y, Graph graph) { + public IntegerArithmeticNode(CiKind kind, int opcode, ValueNode x, ValueNode y, Graph graph) { super(kind, opcode, x, y, false, graph); assert kind == CiKind.Int || kind == CiKind.Long; } - public static IntegerArithmeticNode add(Value v1, Value v2) { + public static IntegerArithmeticNode add(ValueNode v1, ValueNode v2) { assert v1.kind == v2.kind && v1.graph() == v2.graph(); Graph graph = v1.graph(); //TODO (gd) handle conversions here instead of strong assert ? @@ -48,7 +49,7 @@ } } - public static IntegerArithmeticNode mul(Value v1, Value v2) { + public static IntegerArithmeticNode mul(ValueNode v1, ValueNode v2) { assert v1.kind == v2.kind && v1.graph() == v2.graph(); Graph graph = v1.graph(); //TODO (gd) handle conversions here instead of strong assert ? diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerDiv.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerDiv.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerDiv.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "/") public final class IntegerDiv extends IntegerArithmeticNode implements Canonicalizable { - public IntegerDiv(CiKind kind, Value x, Value y, Graph graph) { + public IntegerDiv(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.IDIV : Bytecodes.LDIV, x, y, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerMul.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerMul.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerMul.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "*") public final class IntegerMul extends IntegerArithmeticNode implements Canonicalizable { - public IntegerMul(CiKind kind, Value x, Value y, Graph graph) { + public IntegerMul(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.IMUL : Bytecodes.LMUL, x, y, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerRem.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerRem.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerRem.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "%") public final class IntegerRem extends IntegerArithmeticNode implements Canonicalizable { - public IntegerRem(CiKind kind, Value x, Value y, Graph graph) { + public IntegerRem(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.IREM : Bytecodes.LREM, x, y, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerSub.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerSub.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerSub.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "-") public final class IntegerSub extends IntegerArithmeticNode implements Canonicalizable { - public IntegerSub(CiKind kind, Value x, Value y, Graph graph) { + public IntegerSub(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.ISUB : Bytecodes.LSUB, x, y, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Invoke.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Invoke.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Invoke.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,8 +24,8 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -36,9 +36,9 @@ */ public final class Invoke extends AbstractMemoryCheckpointNode implements ExceptionEdgeInstruction { - @Successor private FixedNode exceptionEdge; + @Successor private FixedNode exceptionEdge; - @Input private final NodeInputList arguments; + @Input private final NodeInputList arguments; @Override public FixedNode exceptionEdge() { @@ -62,7 +62,7 @@ canInline = b; } - public NodeInputList arguments() { + public NodeInputList arguments() { return arguments; } @@ -80,9 +80,9 @@ * @param isStatic {@code true} if this call is static (no receiver object) * @param target the target method being called */ - public Invoke(int bci, int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, Graph graph) { + public Invoke(int bci, int opcode, CiKind result, ValueNode[] args, RiMethod target, RiType returnType, Graph graph) { super(result, graph); - arguments = new NodeInputList(this, args.length); + arguments = new NodeInputList(this, args.length); this.opcode = opcode; this.target = target; this.returnType = returnType; @@ -120,7 +120,7 @@ * @return the instruction that produces the receiver object for this invocation if any, {@code null} if this * invocation does not take a receiver object */ - public Value receiver() { + public ValueNode receiver() { assert !isStatic(); return arguments().get(0); } @@ -147,30 +147,6 @@ v.visitInvoke(this); } - public CiKind[] signature() { - CiKind receiver = isStatic() ? null : target.holder().kind(); - return Util.signatureToKinds(target.signature(), receiver); - } - - @Override - public void print(LogStream out) { - int argStart = 0; - if (hasReceiver()) { - out.print(receiver()).print('.'); - argStart = 1; - } - - RiMethod target = target(); - out.print(target.name()).print('('); - for (int i = argStart; i < argumentCount; i++) { - if (i > argStart) { - out.print(", "); - } - out.print(arguments().get(i)); - } - out.print(CiUtil.format(") [method: %H.%n(%p):%r]", target, false)); - } - @Override public String toString() { return super.toString() + target; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IsNonNull.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IsNonNull.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IsNonNull.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -34,13 +33,13 @@ */ public final class IsNonNull extends BooleanNode implements Canonicalizable { - @Input private Value object; + @Input private ValueNode object; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } @@ -51,7 +50,7 @@ * @param object the instruction producing the object to check against null * @param graph */ - public IsNonNull(Value object, Graph graph) { + public IsNonNull(ValueNode object, Graph graph) { super(CiKind.Object, graph); assert object == null || object.kind == CiKind.Object : object; setObject(object); @@ -75,11 +74,6 @@ } @Override - public void print(LogStream out) { - out.print("null_check(").print(object()).print(')'); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (object() instanceof NewInstance || object() instanceof NewArray) { return Constant.forBoolean(true, graph()); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IsType.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IsType.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IsType.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,9 +24,8 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -36,13 +35,13 @@ */ public final class IsType extends BooleanNode implements Canonicalizable { - @Input private Value object; + @Input private ValueNode object; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } @@ -55,7 +54,7 @@ * @param object the instruction producing the object to check against the given type * @param graph */ - public IsType(Value object, RiType type, Graph graph) { + public IsType(ValueNode object, RiType type, Graph graph) { super(CiKind.Object, graph); assert type.isResolved(); assert object == null || object.kind == CiKind.Object; @@ -84,11 +83,6 @@ } @Override - public void print(LogStream out) { - out.print("null_check(").print(object()).print(')'); - } - - @Override public Map getDebugProperties() { Map properties = super.getDebugProperties(); properties.put("type", type); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LeftShift.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LeftShift.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LeftShift.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,16 +22,17 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @NodeInfo(shortName = "<<") -public final class LeftShift extends Shift implements Canonicalizable { +public final class LeftShift extends ShiftNode implements Canonicalizable { - public LeftShift(CiKind kind, Value x, Value y, Graph graph) { + public LeftShift(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.ISHL : Bytecodes.LSHL, x, y, graph); } @@ -59,8 +60,8 @@ if (amount == 0) { return x(); } - if (x() instanceof Shift) { - Shift other = (Shift) x(); + if (x() instanceof ShiftNode) { + ShiftNode other = (ShiftNode) x(); if (other.y().isConstant()) { int otherAmount = other.y().asConstant().asInt() & mask; if (other instanceof LeftShift) { @@ -69,7 +70,7 @@ return Constant.forInt(0, graph()); } return new LeftShift(kind, other.x(), Constant.forInt(total, graph()), graph()); - } else if ((other instanceof RightShift || other instanceof UnsignedRightShift) && otherAmount == amount) { + } else if ((other instanceof RightShift || other instanceof UnsignedRightShiftNode) && otherAmount == amount) { if (kind == CiKind.Long) { return new And(kind, other.x(), Constant.forLong(-1L << amount, graph()), graph()); } else { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LinearInductionVariable.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LinearInductionVariable.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LinearInductionVariable.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -29,30 +30,30 @@ * InductionVariable of the form a+b*x. */ public abstract class LinearInductionVariable extends InductionVariable { - @Input private Value a; - @Input private Value b; + @Input private ValueNode a; + @Input private ValueNode b; - public LinearInductionVariable(CiKind kind, Value a, Value b, Graph graph) { + public LinearInductionVariable(CiKind kind, ValueNode a, ValueNode b, Graph graph) { super(kind, graph); setA(a); setB(b); } - protected Value a() { + protected ValueNode a() { return a; } - protected Value b() { + protected ValueNode b() { return b; } - protected void setA(Value a) { + protected void setA(ValueNode a) { updateUsages(this.a, a); this.a = a; } - protected void setB(Value b) { + protected void setB(ValueNode b) { updateUsages(this.b, b); this.b = b; } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadField.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadField.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadField.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -44,7 +43,7 @@ * @param graph * @param isLoaded indicates if the class is loaded */ - public LoadField(Value object, RiField field, Graph graph) { + public LoadField(ValueNode object, RiField field, Graph graph) { super(field.kind().stackKind(), object, field, graph); } @@ -76,11 +75,6 @@ } @Override - public void print(LogStream out) { - out.print(object()).print(".").print(field.name()).print(" [field: ").print(CiUtil.format("%h.%n:%t", field, false)).print("]"); - } - - @Override public boolean needsStateAfter() { return false; } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadIndexed.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadIndexed.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadIndexed.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.*; -import com.oracle.max.graal.compiler.phases.LoweringPhase.LoweringOp; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -42,7 +41,7 @@ * @param elementKind the element type * @param graph */ - public LoadIndexed(Value array, Value index, Value length, CiKind elementKind, Graph graph) { + public LoadIndexed(ValueNode array, ValueNode index, ValueNode length, CiKind elementKind, Graph graph) { super(elementKind.stackKind(), array, index, length, elementKind, graph); } @@ -75,21 +74,15 @@ } @Override - public void print(LogStream out) { - out.print(array()).print('[').print(index()).print("] (").print(kind.typeChar).print(')'); - } - - @Override public boolean needsStateAfter() { return false; } - @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { if (clazz == LoweringOp.class) { - return (T) LoweringPhase.DELEGATE_TO_RUNTIME; + return (T) DELEGATE_TO_RUNTIME; } return super.lookup(clazz); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Local.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Local.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Local.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -86,11 +86,6 @@ } @Override - public void print(LogStream out) { - out.print("local[index ").print(index()).print(']'); - } - - @Override public Map getDebugProperties() { Map properties = super.getDebugProperties(); properties.put("index", index()); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LocationNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LocationNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LocationNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,26 +22,26 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiAddress.*; +import com.sun.cri.ci.CiAddress.Scale; public final class LocationNode extends FloatingNode { - @Input private Value index; + @Input private ValueNode index; @Data private int displacement; @Data private boolean indexScalingEnabled = true; @Data private CiKind valueKind; @Data private Object locationIdentity; - public Value index() { + public ValueNode index() { return index; } - public void setIndex(Value x) { + public void setIndex(ValueNode x) { updateUsages(index, x); index = x; } @@ -85,22 +85,17 @@ @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { + if (clazz == LIRGeneratorOp.class) { return null; } return super.lookup(clazz); } - @Override - public void print(LogStream out) { - out.print("mem location disp is ").print(displacement); - } - public CiKind getValueKind() { return valueKind; } - public CiValue createAddress(LIRGenerator lirGenerator, Value object) { + public CiAddress createAddress(LIRGeneratorTool lirGenerator, ValueNode object) { CiValue indexValue = CiValue.IllegalValue; Scale indexScale = Scale.Times1; if (this.index() != null) { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Logic.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Logic.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Logic.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -37,7 +38,7 @@ * @param x the first input into this instruction * @param y the second input into this instruction */ - public Logic(CiKind kind, int opcode, Value x, Value y, Graph graph) { + public Logic(CiKind kind, int opcode, ValueNode x, ValueNode y, Graph graph) { super(kind, opcode, x, y, graph); } @@ -45,9 +46,4 @@ public void accept(ValueVisitor v) { v.visitLogic(this); } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(this.shortName()).print(' ').print(y()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LookupSwitch.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LookupSwitch.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LookupSwitch.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,18 +22,18 @@ */ package com.oracle.max.graal.compiler.ir; -import static com.oracle.max.graal.compiler.debug.InstructionPrinter.InstructionLineColumn.*; - import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.cfg.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; /** * The {@code LookupSwitch} instruction represents a lookup switch bytecode, which has a sorted * array of key values. */ -public final class LookupSwitch extends Switch { +public final class LookupSwitch extends SwitchNode { private static final int INPUT_COUNT = 0; private static final int SUCCESSOR_COUNT = 0; @@ -48,7 +48,7 @@ * @param stateAfter the state after the switch * @param graph */ - public LookupSwitch(Value value, List successors, int[] keys, double[] probability, Graph graph) { + public LookupSwitch(ValueNode value, List successors, int[] keys, double[] probability, Graph graph) { super(value, successors, probability, INPUT_COUNT, SUCCESSOR_COUNT, graph); this.keys = keys; } @@ -70,17 +70,4 @@ public void accept(ValueVisitor v) { v.visitLookupSwitch(this); } - - @Override - public void print(LogStream out) { - out.print("lookupswitch "); - out.println(value()); - int l = numberOfCases(); - for (int i = 0; i < l; i++) { - INSTRUCTION.advance(out); - out.printf("case %5d: B%d%n", keyAt(i), blockSuccessor(i)); - } - INSTRUCTION.advance(out); - out.print("default : ").print(defaultSuccessor()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopBegin.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopBegin.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopBegin.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,8 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -64,11 +65,6 @@ } @Override - public void print(LogStream out) { - out.print("loopBegin"); - } - - @Override public int phiPredecessorCount() { return 2; } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopCounter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopCounter.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopCounter.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.LoweringPhase.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopEnd.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopEnd.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoopEnd.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -52,11 +52,6 @@ } @Override - public void print(LogStream out) { - out.print("loopEnd ").print(loopBegin()); - } - - @Override public Iterable< ? extends Node> dataInputs() { return Collections.emptyList(); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MaterializeNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MaterializeNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MaterializeNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,18 +22,10 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.graph.*; public final class MaterializeNode extends Conditional { - - public MaterializeNode(BooleanNode value, Graph graph) { super(value, Constant.forInt(1, graph), Constant.forInt(0, graph), graph); } - - @Override - public void print(LogStream out) { - out.print("materialize(").print(condition().toString()).print(')'); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MathIntrinsic.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MathIntrinsic.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MathIntrinsic.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,22 +22,24 @@ */ package com.oracle.max.graal.compiler.ir; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; public class MathIntrinsic extends FloatingNode { - @Input private Value x; + @Input private ValueNode x; @Data private final Operation operation; public enum Operation { ABS, SQRT, } - public Value x() { + public ValueNode x() { return x; } - private void setX(Value x) { + private void setX(ValueNode x) { updateUsages(this.x, x); this.x = x; } @@ -46,7 +48,7 @@ return operation; } - public MathIntrinsic(Value x, Operation op, Graph graph) { + public MathIntrinsic(ValueNode x, Operation op, Graph graph) { super(x.kind, graph); setX(x); this.operation = op; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Merge.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Merge.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Merge.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,8 +25,9 @@ import java.util.*; import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.compiler.util.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -126,8 +127,8 @@ //if (end != null && end.blockSuccessors().size() > 0) { out.print(" ."); for (Node successor : this.successors()) { - if (successor instanceof Value) { - out.print((Value) successor); + if (successor instanceof ValueNode) { + out.print((ValueNode) successor); } else { out.print(successor.toString()); } @@ -143,78 +144,6 @@ // } } - @Override - public void print(LogStream out) { - - printWithoutPhis(out); - - // print phi functions - boolean hasPhisInLocals = false; - boolean hasPhisOnStack = false; - - //if (end() != null && end().stateAfter() != null) { - FrameState state = stateAfter(); - - int i = 0; - while (!hasPhisOnStack && i < state.stackSize()) { - Value value = state.stackAt(i); - hasPhisOnStack = isPhiAtBlock(value); - if (value != null) { - i += value.kind.sizeInSlots(); - } else { - i++; - } - } - - for (i = 0; !hasPhisInLocals && i < state.localsSize();) { - Value value = state.localAt(i); - hasPhisInLocals = isPhiAtBlock(value); - // also ignore illegal HiWords - if (value != null) { - i += value.kind.sizeInSlots(); - } else { - i++; - } - } - //} - - // print values in locals - if (hasPhisInLocals) { - out.println(); - out.println("Locals:"); - - int j = 0; - while (j < state.localsSize()) { - Value value = state.localAt(j); - if (value != null) { - out.println(stateString(j, value)); - // also ignore illegal HiWords - j += value.kind.sizeInSlots(); - } else { - j++; - } - } - out.println(); - } - - // print values on stack - if (hasPhisOnStack) { - out.println(); - out.println("Stack:"); - int j = 0; - while (j < stateAfter().stackSize()) { - Value value = stateAfter().stackAt(j); - if (value != null) { - out.println(stateString(j, value)); - j += value.kind.sizeInSlots(); - } else { - j++; - } - } - } - - } - /** * Determines if a given instruction is a phi whose {@linkplain Phi#merge() join block} is a given block. * @@ -222,7 +151,7 @@ * @param block the block that may be the join block of {@code value} if {@code value} is a phi * @return {@code true} if {@code value} is a phi and its join block is {@code block} */ - private boolean isPhiAtBlock(Value value) { + private boolean isPhiAtBlock(ValueNode value) { return value instanceof Phi && ((Phi) value).merge() == this; } @@ -237,7 +166,7 @@ * {@linkplain Phi#merge() join point} * @return the instruction representation as a string */ - public String stateString(int index, Value value) { + public String stateString(int index, ValueNode value) { StringBuilder sb = new StringBuilder(30); sb.append(String.format("%2d %s", index, Util.valueString(value))); if (value instanceof Phi) { @@ -247,7 +176,7 @@ sb.append(" ["); for (int j = 0; j < phi.valueCount(); j++) { sb.append(' '); - Value operand = phi.valueAt(j); + ValueNode operand = phi.valueAt(j); if (operand != null) { sb.append(Util.valueString(operand)); } else { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorAddress.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorAddress.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorAddress.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,14 +24,15 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; /** * Instruction that is used to refer to the address of an on-stack monitor. */ -public final class MonitorAddress extends Value { +public final class MonitorAddress extends ValueNode { private int monitorIndex; @@ -54,13 +55,6 @@ } @Override - public void print(LogStream out) { - out.print("monitor_address (").print(monitorIndex()).print(")"); - } - - - - @Override public Map getDebugProperties() { Map properties = super.getDebugProperties(); properties.put("monitorIndex", monitorIndex); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorEnter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorEnter.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorEnter.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; /** @@ -38,7 +39,7 @@ * @param lockNumber the number of the lock * @param graph */ - public MonitorEnter(Value object, Value lockAddress, int lockNumber, Graph graph) { + public MonitorEnter(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) { super(object, lockAddress, lockNumber, graph); } @@ -46,9 +47,4 @@ public void accept(ValueVisitor v) { v.visitMonitorEnter(this); } - - @Override - public void print(LogStream out) { - out.print("enter monitor[").print(lockNumber).print("](").print(object()).print(')'); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorExit.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorExit.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MonitorExit.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; /** @@ -38,7 +39,7 @@ * @param lockNumber the number of the lock * @param graph */ - public MonitorExit(Value object, Value lockAddress, int lockNumber, Graph graph) { + public MonitorExit(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) { super(object, lockAddress, lockNumber, graph); } @@ -46,9 +47,4 @@ public void accept(ValueVisitor v) { v.visitMonitorExit(this); } - - @Override - public void print(LogStream out) { - out.print("exit monitor[").print(lockNumber).print("](").print(object()).print(')'); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Negate.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Negate.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Negate.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -34,13 +33,13 @@ public final class Negate extends FloatingNode implements Canonicalizable { @Input - private Value x; + private ValueNode x; - public Value x() { + public ValueNode x() { return x; } - public void setX(Value x) { + public void setX(ValueNode x) { updateUsages(this.x, x); this.x = x; } @@ -50,7 +49,7 @@ * * @param x the instruction producing the value that is input to this instruction */ - public Negate(Value x, Graph graph) { + public Negate(ValueNode x, Graph graph) { super(x.kind, graph); setX(x); } @@ -66,11 +65,6 @@ } @Override - public void print(LogStream out) { - out.print("- ").print(x()); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (x().isConstant()) { switch (x().kind) { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NegateBooleanNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NegateBooleanNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NegateBooleanNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -51,11 +49,6 @@ } @Override - public void print(LogStream out) { - out.print(value()).print("!"); - } - - @Override public Node canonical(NotifyReProcess reProcess) { if (value() instanceof NegateBooleanNode) { return ((NegateBooleanNode) value()).value(); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewArray.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewArray.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewArray.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,8 +25,9 @@ import java.util.*; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.phases.EscapeAnalysisPhase.EscapeField; -import com.oracle.max.graal.compiler.phases.EscapeAnalysisPhase.EscapeOp; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -35,13 +36,13 @@ */ public abstract class NewArray extends FixedNodeWithNext { - @Input private Value length; + @Input private ValueNode length; - public Value length() { + public ValueNode length() { return length; } - public void setLength(Value x) { + public void setLength(ValueNode x) { updateUsages(this.length, x); this.length = x; } @@ -51,7 +52,7 @@ * @param length the instruction that produces the length for this allocation * @param graph */ - NewArray(Value length, Graph graph) { + NewArray(ValueNode length, Graph graph) { super(CiKind.Object, graph); setLength(length); } @@ -59,7 +60,7 @@ /** * The list of instructions which produce input for this instruction. */ - public Value dimension(int index) { + public ValueNode dimension(int index) { assert index == 0; return length(); } @@ -109,12 +110,12 @@ return true; } return false; - } else if (usage instanceof StoreField) { - StoreField x = (StoreField) usage; + } else if (usage instanceof StoreFieldNode) { + StoreFieldNode x = (StoreFieldNode) usage; assert x.value() == node; return true; - } else if (usage instanceof StoreIndexed) { - StoreIndexed x = (StoreIndexed) usage; + } else if (usage instanceof StoreIndexedNode) { + StoreIndexedNode x = (StoreIndexedNode) usage; CiConstant index = x.index().asConstant(); CiConstant length = ((NewArray) node).dimension(0).asConstant(); if (index == null || length == null || index.asInt() < 0 || index.asInt() >= length.asInt()) { @@ -125,7 +126,7 @@ ArrayLength x = (ArrayLength) usage; assert x.array() == node; return false; - } else if (usage instanceof VirtualObjectField) { + } else if (usage instanceof VirtualObjectFieldNode) { return false; } else { return super.escape(node, usage); @@ -155,7 +156,7 @@ } @Override - public int updateState(Node node, Node current, Map fieldIndex, Value[] fieldState) { + public int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState) { if (current instanceof AccessIndexed) { AccessIndexed x = (AccessIndexed) current; if (x.array() == node) { @@ -164,8 +165,8 @@ x.replaceAtUsages(fieldState[index]); assert x.usages().size() == 0; x.replaceAndDelete(x.next()); - } else if (current instanceof StoreIndexed) { - fieldState[index] = ((StoreIndexed) x).value(); + } else if (current instanceof StoreIndexedNode) { + fieldState[index] = ((StoreIndexedNode) x).value(); assert x.usages().size() == 0; x.replaceAndDelete(x.next()); return index; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewInstance.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewInstance.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewInstance.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,9 +24,9 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.EscapeAnalysisPhase.EscapeField; -import com.oracle.max.graal.compiler.phases.EscapeAnalysisPhase.EscapeOp; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -77,11 +77,6 @@ } @Override - public void print(LogStream out) { - out.print("new instance ").print(CiUtil.toJavaName(instanceClass())); - } - - @Override public Map getDebugProperties() { Map properties = super.getDebugProperties(); properties.put("instanceClass", instanceClass); @@ -111,14 +106,14 @@ LoadField x = (LoadField) usage; assert x.object() == node; return x.field().isResolved() == false; - } else if (usage instanceof StoreField) { - StoreField x = (StoreField) usage; + } else if (usage instanceof StoreFieldNode) { + StoreFieldNode x = (StoreFieldNode) usage; return x.value() == node && x.object() != node; - } else if (usage instanceof StoreIndexed) { - StoreIndexed x = (StoreIndexed) usage; + } else if (usage instanceof StoreIndexedNode) { + StoreIndexedNode x = (StoreIndexedNode) usage; assert x.value() == node; return true; - } else if (usage instanceof VirtualObjectField) { + } else if (usage instanceof VirtualObjectFieldNode) { return false; } else if (usage instanceof RegisterFinalizer) { RegisterFinalizer x = (RegisterFinalizer) usage; @@ -152,7 +147,7 @@ } @Override - public int updateState(Node node, Node current, Map fieldIndex, Value[] fieldState) { + public int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState) { if (current instanceof AccessField) { AccessField x = (AccessField) current; if (x.object() == node) { @@ -162,8 +157,8 @@ x.replaceAtUsages(fieldState[field]); assert x.usages().size() == 0; x.replaceAndDelete(x.next()); - } else if (current instanceof StoreField) { - fieldState[field] = ((StoreField) x).value(); + } else if (current instanceof StoreFieldNode) { + fieldState[field] = ((StoreFieldNode) x).value(); assert x.usages().size() == 0; x.replaceAndDelete(x.next()); return field; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewMultiArray.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewMultiArray.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewMultiArray.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -33,14 +34,14 @@ */ public final class NewMultiArray extends NewArray { - @Input private final NodeInputList dimensions; + @Input private final NodeInputList dimensions; @Override - public Value dimension(int index) { + public ValueNode dimension(int index) { return dimensions.get(index); } - public void setDimension(int index, Value x) { + public void setDimension(int index, ValueNode x) { dimensions.set(index, x); } @@ -64,13 +65,13 @@ * @param riConstantPool the constant pool for resolution * @param graph */ - public NewMultiArray(RiType elementType, Value[] dimensions, int cpi, RiConstantPool riConstantPool, Graph graph) { + public NewMultiArray(RiType elementType, ValueNode[] dimensions, int cpi, RiConstantPool riConstantPool, Graph graph) { super(null, graph); this.constantPool = riConstantPool; this.elementType = elementType; this.cpi = cpi; - this.dimensions = new NodeInputList(this, dimensions.length); + this.dimensions = new NodeInputList(this, dimensions.length); for (int i = 0; i < dimensions.length; i++) { setDimension(i, dimensions[i]); } @@ -103,16 +104,4 @@ public RiType declaredType() { return exactType(); } - - @Override - public void print(LogStream out) { - out.print("new multi array ["); - for (int i = 0; i < dimensionCount(); i++) { - if (i > 0) { - out.print(", "); - } - out.print(dimension(i)); - } - out.print("] ").print(CiUtil.toJavaName(elementType)); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewObjectArray.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewObjectArray.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewObjectArray.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -40,7 +41,7 @@ * @param length the instruction producing the length of the array * @param graph */ - public NewObjectArray(RiType elementClass, Value length, Graph graph) { + public NewObjectArray(RiType elementClass, ValueNode length, Graph graph) { super(length, graph); this.elementClass = elementClass; } @@ -72,9 +73,4 @@ public void accept(ValueVisitor v) { v.visitNewObjectArray(this); } - - @Override - public void print(LogStream out) { - out.print("new object array [").print(length()).print("] ").print(CiUtil.toJavaName(elementType())); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewTypeArray.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewTypeArray.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NewTypeArray.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -34,7 +35,7 @@ final RiType elementType; - public NewTypeArray(Value length, RiType elementType, Graph graph) { + public NewTypeArray(ValueNode length, RiType elementType, Graph graph) { super(length, graph); this.elementType = elementType; } @@ -58,9 +59,4 @@ public void accept(ValueVisitor v) { v.visitNewTypeArray(this); } - - @Override - public void print(LogStream out) { - out.print("new ").print(elementKind().name()).print(" array [").print(length()).print(']'); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NormalizeCompare.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NormalizeCompare.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/NormalizeCompare.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,7 +24,8 @@ import java.util.*; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -41,7 +42,7 @@ * @param x the first input * @param y the second input */ - public NormalizeCompare(int opcode, CiKind kind, Value x, Value y, Graph graph) { + public NormalizeCompare(int opcode, CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, opcode, x, y, graph); } @@ -51,15 +52,6 @@ } @Override - public void print(LogStream out) { - out.print(x()). - print(' '). - print(Bytecodes.operator(opcode)). - print(' '). - print(y()); - } - - @Override public Map getDebugProperties() { Map properties = super.getDebugProperties(); properties.put("isUnorderedLess", isUnorderedLess()); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Or.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Or.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Or.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -31,7 +31,7 @@ @NodeInfo(shortName = "|") public final class Or extends Logic implements Canonicalizable { - public Or(CiKind kind, Value x, Value y, Graph graph) { + public Or(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.IOR : Bytecodes.LOR, x, y, graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Phi.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Phi.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Phi.java Tue Aug 09 23:56:10 2011 +0200 @@ -26,9 +26,9 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.ir.StateSplit.FilteringIterator; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.StateSplit.FilteringIterator; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -40,7 +40,7 @@ @Input private Merge merge; - @Input private final NodeInputList values = new NodeInputList(this); + @Input private final NodeInputList values = new NodeInputList(this); public Merge merge() { return merge; @@ -87,11 +87,11 @@ * @param i the index of the predecessor * @return the instruction that produced the value in the i'th predecessor */ - public Value valueAt(int i) { + public ValueNode valueAt(int i) { return values.get(i); } - public void setValueAt(int i, Value x) { + public void setValueAt(int i, ValueNode x) { values.set(i, x); } @@ -110,18 +110,6 @@ } @Override - public void print(LogStream out) { - out.print("phi function ("); - for (int i = 0; i < valueCount(); ++i) { - if (i != 0) { - out.print(' '); - } - out.print(valueAt(i)); - } - out.print(')'); - } - - @Override public String shortName() { StringBuilder str = new StringBuilder(); for (int i = 0; i < valueCount(); ++i) { @@ -137,7 +125,7 @@ } } - public void addInput(Value x) { + public void addInput(ValueNode x) { values.add(x); } @@ -174,8 +162,8 @@ } If ifNode = (If) endPred0; boolean inverted = ifNode.trueSuccessor() == end1; - Value trueValue = valueAt(inverted ? 1 : 0); - Value falseValue = valueAt(inverted ? 0 : 1); + ValueNode trueValue = valueAt(inverted ? 1 : 0); + ValueNode falseValue = valueAt(inverted ? 0 : 1); if ((trueValue.kind != CiKind.Int && trueValue.kind != CiKind.Long) || (falseValue.kind != CiKind.Int && falseValue.kind != CiKind.Long)) { return this; } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Placeholder.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Placeholder.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Placeholder.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -37,9 +38,4 @@ public void accept(ValueVisitor v) { //assert false; } - - @Override - public void print(LogStream out) { - assert false; - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ReadNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ReadNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ReadNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,14 +22,15 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class ReadNode extends AccessNode implements Node.ValueNumberable { - public ReadNode(CiKind kind, Value object, LocationNode location, Graph graph) { + public ReadNode(CiKind kind, ValueNode object, LocationNode location, Graph graph) { super(kind, object, location, graph); } @@ -37,9 +38,4 @@ public void accept(ValueVisitor v) { v.visitMemoryRead(this); } - - @Override - public void print(LogStream out) { - out.print("mem read from ").print(object()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ReadVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ReadVectorNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ReadVectorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,29 +24,30 @@ import java.util.*; -import com.oracle.max.graal.compiler.gen.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class ReadVectorNode extends AccessVectorNode { - public ReadVectorNode(AbstractVectorNode vector, Value object, LocationNode location, Graph graph) { + public ReadVectorNode(AbstractVectorNode vector, ValueNode object, LocationNode location, Graph graph) { super(CiKind.Illegal, vector, object, location, graph); } @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { + if (clazz == LIRGeneratorOp.class) { return null; } return super.lookup(clazz); } @Override - public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { + public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { LocationNode newLocation = LocationNode.create(LocationNode.getArrayLocation(location().getValueKind()), location().getValueKind(), location().displacement(), graph()); - Value index = nodes.get(vector()); + ValueNode index = nodes.get(vector()); assert index != null; newLocation.setIndex(index); ReadNode readNode = new ReadNode(location().getValueKind().stackKind(), object(), newLocation, graph()); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/RegisterFinalizer.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/RegisterFinalizer.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/RegisterFinalizer.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,8 +25,8 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.graph.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.Canonicalizable; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -36,18 +36,18 @@ */ public final class RegisterFinalizer extends StateSplit implements Canonicalizable { - @Input private Value object; + @Input private ValueNode object; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } - public RegisterFinalizer(Value object, Graph graph) { + public RegisterFinalizer(ValueNode object, Graph graph) { super(CiKind.Void, graph); setObject(object); } @@ -58,11 +58,6 @@ } @Override - public void print(LogStream out) { - out.print("register finalizer ").print(object()); - } - - @Override public Node canonical(NotifyReProcess reProcess) { RiType declaredType = object.declaredType(); RiType exactType = object.exactType(); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Return.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Return.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Return.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,8 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -31,13 +32,13 @@ */ public final class Return extends FixedNode { - @Input private Value result; + @Input private ValueNode result; - public Value result() { + public ValueNode result() { return result; } - public void setResult(Value x) { + public void setResult(ValueNode x) { updateUsages(this.result, x); this.result = x; } @@ -48,7 +49,7 @@ * is a void return * @param graph */ - public Return(Value result, Graph graph) { + public Return(ValueNode result, Graph graph) { super(result == null ? CiKind.Void : result.kind, graph); setResult(result); } @@ -62,13 +63,4 @@ public void accept(ValueVisitor v) { v.visitReturn(this); } - - @Override - public void print(LogStream out) { - if (result() == null) { - out.print("return"); - } else { - out.print(kind.typeChar).print("return ").print(result()); - } - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/RightShift.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/RightShift.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/RightShift.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,16 +22,17 @@ */ package com.oracle.max.graal.compiler.ir; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @NodeInfo(shortName = ">>") -public final class RightShift extends Shift implements Canonicalizable { +public final class RightShift extends ShiftNode implements Canonicalizable { - public RightShift(CiKind kind, Value x, Value y, Graph graph) { + public RightShift(CiKind kind, ValueNode x, ValueNode y, Graph graph) { super(kind, kind == CiKind.Int ? Bytecodes.ISHR : Bytecodes.LSHR, x, y, graph); } @@ -59,8 +60,8 @@ if (amount == 0) { return x(); } - if (x() instanceof Shift) { - Shift other = (Shift) x(); + if (x() instanceof ShiftNode) { + ShiftNode other = (ShiftNode) x(); if (other.y().isConstant()) { int otherAmount = other.y().asConstant().asInt() & mask; if (other instanceof RightShift) { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Shift.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Shift.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * The {@code ShiftOp} class represents shift operations. - */ -public abstract class Shift extends Binary { - - /** - * Creates a new shift operation. - * @param opcode the opcode of the shift - * @param x the first input value - * @param s the second input value - */ - public Shift(CiKind kind, int opcode, Value x, Value s, Graph graph) { - super(kind, opcode, x, s, graph); - assert x == null || x.kind == kind; - } - - @Override - public void accept(ValueVisitor v) { - v.visitShift(this); - } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(this.shortName()).print(' ').print(y()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/StateSplit.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/StateSplit.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import java.util.*; - -import com.oracle.max.graal.compiler.value.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * The {@code StateSplit} class is the abstract base class of all instructions - * that store an immutable copy of the frame state. - */ -public abstract class StateSplit extends FixedNodeWithNext { - - @Input private FrameState stateAfter; - - public FrameState stateAfter() { - return stateAfter; - } - - public void setStateAfter(FrameState x) { - updateUsages(stateAfter, x); - stateAfter = x; - } - - /** - * Creates a new state split with the specified value type. - * @param kind the type of the value that this instruction produces - * @param graph - */ - public StateSplit(CiKind kind, Graph graph) { - super(kind, graph); - } - - public boolean needsStateAfter() { - return true; - } - - @Override - public void delete() { - FrameState stateAfter = stateAfter(); - super.delete(); - if (stateAfter != null) { - if (stateAfter.usages().isEmpty()) { - stateAfter.delete(); - } - } - } - - @Override - public Iterable< ? extends Node> dataInputs() { - final Iterator< ? extends Node> dataInputs = super.dataInputs().iterator(); - return new Iterable() { - @Override - public Iterator iterator() { - return new FilteringIterator(dataInputs, FrameState.class); - } - }; - } - - public static final class FilteringIterator implements Iterator { - - private final Iterator< ? extends Node> input; - private Node next; - private Class< ? > clazz; - - public FilteringIterator(Iterator< ? extends Node> input, Class clazz) { - this.input = input; - this.clazz = clazz; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public Node next() { - forward(); - if (!hasNext()) { - throw new NoSuchElementException(); - } - Node res = next; - next = null; - return res; - } - - @Override - public boolean hasNext() { - forward(); - return next != null; - } - - private void forward() { - while (next == null && input.hasNext()) { - next = input.next(); - if (clazz.isInstance(next)) { - next = null; - } - } - } - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/StoreField.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/StoreField.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.*; -import com.oracle.max.graal.compiler.phases.LoweringPhase.LoweringOp; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - -/** - * The {@code StoreField} instruction represents a write to a static or instance field. - */ -public final class StoreField extends AccessField { - - @Input private Value value; - - public Value value() { - return value; - } - - public void setValue(Value x) { - updateUsages(value, x); - value = x; - } - - /** - * Creates a new LoadField instance. - * @param object the receiver object - * @param field the compiler interface field - * @param value the instruction representing the value to store to the field - * @param stateAfter the state after the field access - * @param graph - */ - public StoreField(Value object, RiField field, Value value, Graph graph) { - super(CiKind.Void, object, field, graph); - setValue(value); - } - - @Override - public void accept(ValueVisitor v) { - v.visitStoreField(this); - } - - @SuppressWarnings("unchecked") - @Override - public T lookup(java.lang.Class clazz) { - if (clazz == LoweringOp.class) { - return (T) LoweringPhase.DELEGATE_TO_RUNTIME; - } - return super.lookup(clazz); - }; - - @Override - public void print(LogStream out) { - out.print(object()). - print("."). - print(field().name()). - print(" := "). - print(value()). - print(" [type: ").print(CiUtil.format("%h.%n:%t", field(), false)). - print(']'); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/StoreIndexed.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/StoreIndexed.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.*; -import com.oracle.max.graal.compiler.phases.LoweringPhase.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * The {@code StoreIndexed} instruction represents a write to an array element. - */ -public final class StoreIndexed extends AccessIndexed { - - @Input private Value value; - - public Value value() { - return value; - } - - public void setValue(Value x) { - updateUsages(value, x); - value = x; - } - - /** - * Creates a new StoreIndexed instruction. - * @param array the instruction producing the array - * @param index the instruction producing the index - * @param length the instruction producing the length - * @param elementKind the element type - * @param value the value to store into the array - * @param stateAfter the state after executing this instruction - * @param graph - */ - public StoreIndexed(Value array, Value index, Value length, CiKind elementKind, Value value, Graph graph) { - super(CiKind.Void, array, index, length, elementKind, graph); - setValue(value); - } - - @Override - public void accept(ValueVisitor v) { - v.visitStoreIndexed(this); - } - - @Override - public void print(LogStream out) { - out.print(array()).print('[').print(index()).print("] := ").print(value()).print(" (").print(kind.typeChar).print(')'); - } - - @SuppressWarnings("unchecked") - @Override - public T lookup(Class clazz) { - if (clazz == LoweringOp.class) { - return (T) LoweringPhase.DELEGATE_TO_RUNTIME; - } - return super.lookup(clazz); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Switch.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Switch.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2009, 2010, 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.max.graal.compiler.ir; - -import java.util.*; - -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * The {@code Switch} class is the base of both lookup and table switches. - */ -public abstract class Switch extends ControlSplit { - - @Input private Value value; - - public Value value() { - return value; - } - - public void setValue(Value x) { - updateUsages(value, x); - value = x; - } - - /** - * Constructs a new Switch. - * @param value the instruction that provides the value to be switched over - * @param successors the list of successors of this switch - * @param stateAfter the state after the switch - * @param graph - */ - public Switch(Value value, List successors, double[] probability, int inputCount, int successorCount, Graph graph) { - super(CiKind.Illegal, successors, probability, graph); - setValue(value); - } - - /** - * Gets the number of cases that this switch covers (excluding the default case). - * @return the number of cases - */ - public int numberOfCases() { - return blockSuccessorCount() - 1; - } - -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/TableSwitch.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/TableSwitch.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import static com.oracle.max.graal.compiler.debug.InstructionPrinter.InstructionLineColumn.*; - -import java.util.*; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.graph.*; - -/** - * The {@code TableSwitch} instruction represents a table switch. - */ -public final class TableSwitch extends Switch { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - final int lowKey; - - /** - * Constructs a new TableSwitch instruction. - * @param value the instruction producing the value being switched on - * @param successors the list of successors - * @param lowKey the lowest integer key in the table - * @param stateAfter the state after the switch - * @param graph - */ - public TableSwitch(Value value, List successors, int lowKey, double[] probability, Graph graph) { - super(value, successors, probability, INPUT_COUNT, SUCCESSOR_COUNT, graph); - this.lowKey = lowKey; - } - - /** - * Gets the lowest key in the table switch (inclusive). - * @return the low key - */ - public int lowKey() { - return lowKey; - } - - /** - * Gets the highest key in the table switch (exclusive). - * @return the high key - */ - public int highKey() { - return lowKey + numberOfCases(); - } - - @Override - public void accept(ValueVisitor v) { - v.visitTableSwitch(this); - } - - @Override - public void print(LogStream out) { - out.print("tableswitch "); - out.println(value()); - int l = numberOfCases(); - for (int i = 0; i < l; i++) { - INSTRUCTION.advance(out); - out.printf("case %5d: B%d%n", lowKey() + i, blockSuccessor(i)); - } - INSTRUCTION.advance(out); - out.print("default : ").print(defaultSuccessor()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/TypeCheck.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/TypeCheck.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - -/** - * The {@code TypeCheck} instruction is the base class of casts and instanceof tests. - */ -public abstract class TypeCheck extends BooleanNode { - - @Input private Value object; - - @Input private Value targetClassInstruction; - - public Value object() { - return object; - } - - public void setObject(Value x) { - updateUsages(object, x); - object = x; - } - - public Value targetClassInstruction() { - return targetClassInstruction; - } - - public void setTargetClassInstruction(Value x) { - updateUsages(targetClassInstruction, x); - targetClassInstruction = x; - } - - /** - * Gets the target class, i.e. the class being cast to, or the class being tested against. - * @return the target class - */ - public RiType targetClass() { - return targetClassInstruction() instanceof Constant ? (RiType) targetClassInstruction().asConstant().asObject() : null; - } - - /** - * Creates a new TypeCheck instruction. - * @param targetClass the class which is being casted to or checked against - * @param object the instruction which produces the object - * @param kind the result type of this instruction - * @param graph - */ - public TypeCheck(Value targetClassInstruction, Value object, CiKind kind, Graph graph) { - super(kind, graph); - setObject(object); - setTargetClassInstruction(targetClassInstruction); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/UnsignedRightShift.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/UnsignedRightShift.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -@NodeInfo(shortName = ">>>") -public final class UnsignedRightShift extends Shift implements Canonicalizable { - - public UnsignedRightShift(CiKind kind, Value x, Value y, Graph graph) { - super(kind, kind == CiKind.Int ? Bytecodes.IUSHR : Bytecodes.LUSHR, x, y, graph); - } - - @Override - public Node canonical(NotifyReProcess reProcess) { - if (y().isConstant()) { - int amount = y().asConstant().asInt(); - int originalAmout = amount; - int mask; - if (kind == CiKind.Int) { - mask = 0x1f; - } else { - assert kind == CiKind.Long; - mask = 0x3f; - } - amount &= mask; - if (x().isConstant()) { - if (kind == CiKind.Int) { - return Constant.forInt(x().asConstant().asInt() >>> amount, graph()); - } else { - assert kind == CiKind.Long; - return Constant.forLong(x().asConstant().asLong() >>> amount, graph()); - } - } - if (amount == 0) { - return x(); - } - if (x() instanceof Shift) { - Shift other = (Shift) x(); - if (other.y().isConstant()) { - int otherAmount = other.y().asConstant().asInt() & mask; - if (other instanceof UnsignedRightShift) { - int total = amount + otherAmount; - if (total != (total & mask)) { - return Constant.forInt(0, graph()); - } - return new UnsignedRightShift(kind, other.x(), Constant.forInt(total, graph()), graph()); - } else if (other instanceof LeftShift && otherAmount == amount) { - if (kind == CiKind.Long) { - return new And(kind, other.x(), Constant.forLong(-1L >>> amount, graph()), graph()); - } else { - assert kind == CiKind.Int; - return new And(kind, other.x(), Constant.forInt(-1 >>> amount, graph()), graph()); - } - } - } - } - if (originalAmout != amount) { - return new UnsignedRightShift(kind, x(), Constant.forInt(amount, graph()), graph()); - } - } - return this; - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Unwind.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Unwind.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * Unwind takes an exception object, destroys the current stack frame and passes the exception object to the system's exception dispatch code. - */ -public final class Unwind extends FixedNode { - - @Input private Value exception; - - public Value exception() { - return exception; - } - - public void setException(Value x) { - assert x == null || x.kind == CiKind.Object; - updateUsages(this.exception, x); - this.exception = x; - } - - public Unwind(Value exception, Graph graph) { - super(CiKind.Object, graph); - setException(exception); - } - - @Override - public void accept(ValueVisitor v) { - v.visitUnwind(this); - } - - @Override - public void print(LogStream out) { - out.print(kind.typeChar).print("unwind ").print(exception()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Value.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Value.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import java.util.*; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - -/** - * This class represents a value within the HIR graph, including local variables, phis, and - * all other instructions. - */ -public abstract class Value extends Node { - - /** - * The kind of this value. This is {@link CiKind#Void} for instructions that produce no value. - * This kind is guaranteed to be a {@linkplain CiKind#stackKind() stack kind}. - */ - @Data public final CiKind kind; - - protected CiValue operand = CiValue.IllegalValue; - - /** - * Creates a new value with the specified kind. - * @param kind the type of this value - * @param inputCount - * @param successorCount - * @param graph - */ - public Value(CiKind kind, Graph graph) { - super(graph); - assert kind != null && kind == kind.stackKind() : kind + " != " + kind.stackKind(); - this.kind = kind; - } - - /** - * Checks whether this value is a constant (i.e. it is of type {@link Constant}. - * @return {@code true} if this value is a constant - */ - public final boolean isConstant() { - return this instanceof Constant; - } - - /** - * Checks whether this value represents the null constant. - * @return {@code true} if this value represents the null constant - */ - public final boolean isNullConstant() { - return this instanceof Constant && ((Constant) this).value.isNull(); - } - - /** - * Convert this value to a constant if it is a constant, otherwise return null. - * @return the {@link CiConstant} represented by this value if it is a constant; {@code null} - * otherwise - */ - public final CiConstant asConstant() { - if (this instanceof Constant) { - return ((Constant) this).value; - } - return null; - } - - /** - * Gets the LIR operand associated with this instruction. - * @return the LIR operand for this instruction - */ - public final CiValue operand() { - return operand; - } - - /** - * Sets the LIR operand associated with this instruction. - * @param operand the operand to associate with this instruction - */ - public final void setOperand(CiValue operand) { - assert this.operand.isIllegal() : "operand cannot be set twice"; - assert operand != null && operand.isLegal() : "operand must be legal"; - assert operand.kind.stackKind() == this.kind; - assert !(this instanceof VirtualObject); - this.operand = operand; - } - - /** - * Clears the LIR operand associated with this instruction. - */ - public final void clearOperand() { - this.operand = CiValue.IllegalValue; - } - - /** - * Computes the exact type of the result of this instruction, if possible. - * @return the exact type of the result of this instruction, if it is known; {@code null} otherwise - */ - public RiType exactType() { - return null; // default: unknown exact type - } - - /** - * Computes the declared type of the result of this instruction, if possible. - * @return the declared type of the result of this instruction, if it is known; {@code null} otherwise - */ - public RiType declaredType() { - return null; // default: unknown declared type - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("#"); - builder.append(id()); - builder.append(' '); - if (id() < 10) { - builder.append(' '); - } - builder.append(getClass().getSimpleName()); - builder.append(" [").append(flagsToString()).append("]"); - return builder.toString(); - } - - public String flagsToString() { - StringBuilder sb = new StringBuilder(); - return sb.toString(); - } - - /** - * This method supports the visitor pattern by accepting a visitor and calling the - * appropriate {@code visit()} method. - * - * @param v the visitor to accept - */ - public void accept(ValueVisitor v) { - throw new IllegalStateException("No visit method for this node (" + this.getClass().getSimpleName() + ")"); - } - - public void print(LogStream out) { - out.print(this.getClass().toString()); - } - - @SuppressWarnings("unchecked") - @Override - public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { - return (T) LIRGenerator.DELEGATE_TO_VALUE_VISITOR; - } - return super.lookup(clazz); - } - - - @Override - public Map getDebugProperties() { - Map properties = super.getDebugProperties(); - properties.put("kind", kind.toString()); - properties.put("operand", operand == null ? "null" : operand.toString()); - return properties; - } - - /*@Override - public Iterable dataUsages() { - final Iterator dataUsages = super.dataUsages().iterator(); - return new Iterable() { - @Override - public Iterator iterator() { - return new StateSplit.FilteringIterator(dataUsages, FrameState.class); - } - }; - }*/ -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ValueAnchor.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ValueAnchor.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * The ValueAnchor instruction keeps non-CFG nodes above a certain point in the graph. - */ -public final class ValueAnchor extends FixedNodeWithNext { - - @Input private Value object; - - public Value object() { - return object; - } - - public void setObject(Value x) { - updateUsages(object, x); - object = x; - } - - public ValueAnchor(Value object, Graph graph) { - super(CiKind.Illegal, graph); - setObject(object); - } - - @Override - public void accept(ValueVisitor v) { - v.visitValueAnchor(this); - } - - @Override - public void print(LogStream out) { - out.print("value_anchor ").print(object()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ValueClosure.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ValueClosure.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2009, 2010, 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.max.graal.compiler.ir; - -/** - * The {@code ValueClosure} interface represents a first-class - * function that can be applied to a value. - */ -public interface ValueClosure { - Value apply(Value i); -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ValueVisitor.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ValueVisitor.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.value.*; - -/** - * The {@link ValueVisitor} implements one half of the visitor - * pattern for {@linkplain Value IR values}, allowing clients to implement functionality - * depending on the type of an value without doing type tests. - */ -public abstract class ValueVisitor { - // Checkstyle: stop - public abstract void visitArithmetic(Arithmetic i); - public abstract void visitArrayLength(ArrayLength i); - public abstract void visitMerge(Merge i); - public abstract void visitCheckCast(CheckCast i); - public abstract void visitNormalizeCompare(NormalizeCompare i); - public abstract void visitConstant(Constant i); - public abstract void visitConvert(Convert i); - public abstract void visitExceptionObject(ExceptionObject i); - public abstract void visitEndNode(EndNode i); - public abstract void visitFrameState(FrameState i); - public abstract void visitAnchor(Anchor i); - public abstract void visitIf(If i); - public abstract void visitInvoke(Invoke i); - public abstract void visitLoadField(LoadField i); - public abstract void visitLoadIndexed(LoadIndexed i); - public abstract void visitLocal(Local i); - public abstract void visitLogic(Logic i); - public abstract void visitLookupSwitch(LookupSwitch i); - public abstract void visitMemoryRead(ReadNode i); - public abstract void visitMemoryWrite(WriteNode i); - public abstract void visitMonitorAddress(MonitorAddress monitorAddress); - public abstract void visitMonitorEnter(MonitorEnter i); - public abstract void visitMonitorExit(MonitorExit i); - public abstract void visitNegate(Negate i); - public abstract void visitNewInstance(NewInstance i); - public abstract void visitNewMultiArray(NewMultiArray i); - public abstract void visitNewObjectArray(NewObjectArray i); - public abstract void visitNewTypeArray(NewTypeArray i); - public abstract void visitFixedGuard(FixedGuard fixedGuard); - public abstract void visitPhi(Phi i); - public abstract void visitRegisterFinalizer(RegisterFinalizer i); - public abstract void visitReturn(Return i); - public abstract void visitShift(Shift i); - public abstract void visitStoreField(StoreField i); - public abstract void visitStoreIndexed(StoreIndexed i); - public abstract void visitTableSwitch(TableSwitch i); - public abstract void visitDeoptimize(Deoptimize deoptimize); - public abstract void visitUnwind(Unwind unwind); - public abstract void visitLoopBegin(LoopBegin loopBegin); - public abstract void visitLoopEnd(LoopEnd loopEnd); - public abstract void visitValueAnchor(ValueAnchor valueAnchor); - public abstract void visitGuardNode(GuardNode guardNode); - public abstract void visitMathIntrinsic(MathIntrinsic node); -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/VirtualObject.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/VirtualObject.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import java.util.*; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.phases.EscapeAnalysisPhase.EscapeField; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - - -public class VirtualObject extends FloatingNode { - - private EscapeField[] fields; - private RiType type; - - public VirtualObject(RiType type, EscapeField[] fields, Graph graph) { - super(CiKind.Int, graph); - this.type = type; - this.fields = fields; - } - - public RiType type() { - return type; - } - - public EscapeField[] fields() { - return fields; - } - - @Override - public void accept(ValueVisitor v) { - // nothing to do... - } - - @Override - public Map getDebugProperties() { - Map properties = super.getDebugProperties(); - properties.put("type", type); - return properties; - } - - @Override - public String shortName() { - return "VirtualObject " + type.name(); - } - - @Override - public void print(LogStream out) { - out.print("virtualobject ").print(type.name()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/VirtualObjectField.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/VirtualObjectField.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import java.util.*; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - - -public class VirtualObjectField extends FloatingNode { - - @Input private VirtualObject object; - - @Input private FloatingNode lastState; - - @Input private Value input; - - public VirtualObject object() { - return object; - } - - public void setObject(VirtualObject x) { - updateUsages(object, x); - object = x; - } - - public FloatingNode lastState() { - return lastState; - } - - public void setLastState(FloatingNode x) { - updateUsages(lastState, x); - lastState = x; - } - - public Value input() { - return input; - } - - public void setInput(Value x) { - updateUsages(input, x); - input = x; - } - - private int index; - - /** - * Constructs a new ArrayLength instruction. - * @param array the instruction producing the array - * @param newFrameState the state after executing this instruction - */ - public VirtualObjectField(VirtualObject object, FloatingNode lastState, Value input, int index, Graph graph) { - super(CiKind.Int, graph); - this.index = index; - setObject(object); - setLastState(lastState); - setInput(input); - } - - public int index() { - return index; - } - - @Override - public void accept(ValueVisitor v) { - // nothing to do... - } - - @Override - public Map getDebugProperties() { - Map properties = super.getDebugProperties(); - properties.put("index", index); - return properties; - } - - @Override - public String shortName() { - return "VirtualObjectField " + object().fields()[index].name(); - } - - @Override - public void print(LogStream out) { - out.print(object()).print(".").print(object().fields()[index].name()).print("=").print(input()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/WriteMemoryCheckpointNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/WriteMemoryCheckpointNode.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.gen.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - - -public final class WriteMemoryCheckpointNode extends AbstractMemoryCheckpointNode { - - public WriteMemoryCheckpointNode(Graph graph) { - this(CiKind.Illegal, graph); - } - - public WriteMemoryCheckpointNode(CiKind result, Graph graph) { - super(result, graph); - } - - @Override - public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { - return null; - } - return super.lookup(clazz); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/WriteNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/WriteNode.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - - -public final class WriteNode extends AccessNode { - @Input private Value value; - - public Value value() { - return value; - } - - public void setValue(Value x) { - updateUsages(value, x); - value = x; - } - - public WriteNode(CiKind kind, Value object, Value value, LocationNode location, Graph graph) { - super(kind, object, location, graph); - setValue(value); - } - - @Override - public void accept(ValueVisitor v) { - v.visitMemoryWrite(this); - } - - @Override - public void print(LogStream out) { - out.print("mem write to ").print(object()).print(" with value").print(value()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/WriteVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/WriteVectorNode.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import java.util.*; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - - -public final class WriteVectorNode extends AccessVectorNode { - @Input private AbstractVectorNode values; - - public AbstractVectorNode values() { - return values; - } - - public void setValues(AbstractVectorNode x) { - updateUsages(values, x); - values = x; - } - - public WriteVectorNode(AbstractVectorNode vector, Value object, LocationNode location, AbstractVectorNode values, Graph graph) { - super(CiKind.Illegal, vector, object, location, graph); - setValues(values); - } - - @Override - public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { - return null; - } - return super.lookup(clazz); - } - - @Override - public void print(LogStream out) { - out.print("write vector node " + values()); - } - - @Override - public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { - LocationNode newLocation = LocationNode.create(LocationNode.getArrayLocation(location().getValueKind()), location().getValueKind(), location().displacement(), graph()); - Value index = nodes.get(vector()); - Value value = nodes.get(values()); - assert index != null; - assert value != null; - newLocation.setIndex(index); - WriteNode writeNode = new WriteNode(location().getValueKind().stackKind(), object(), value, newLocation, graph()); - loop.loopEnd().replaceAtPredecessors(writeNode); - writeNode.setNext(loop.loopEnd()); - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Xor.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Xor.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011, 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.max.graal.compiler.ir; - -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -@NodeInfo(shortName = "^") -public final class Xor extends Logic implements Canonicalizable { - - public Xor(CiKind kind, Value x, Value y, Graph graph) { - super(kind, kind == CiKind.Int ? Bytecodes.IXOR : Bytecodes.LXOR, x, y, graph); - } - - @Override - public Node canonical(NotifyReProcess reProcess) { - if (x() == y()) { - if (kind == CiKind.Int) { - return Constant.forInt(0, graph()); - } else { - assert kind == CiKind.Long; - return Constant.forLong(0L, graph()); - } - } - if (x().isConstant() && !y().isConstant()) { - swapOperands(); - } - if (x().isConstant()) { - if (kind == CiKind.Int) { - return Constant.forInt(x().asConstant().asInt() ^ y().asConstant().asInt(), graph()); - } else { - assert kind == CiKind.Long; - return Constant.forLong(x().asConstant().asLong() ^ y().asConstant().asLong(), graph()); - } - } else if (y().isConstant()) { - if (kind == CiKind.Int) { - int c = y().asConstant().asInt(); - if (c == 0) { - return x(); - } - } else { - assert kind == CiKind.Long; - long c = y().asConstant().asLong(); - if (c == 0) { - return x(); - } - } - } - return this; - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java Tue Aug 09 23:56:10 2011 +0200 @@ -31,7 +31,7 @@ import com.oracle.max.graal.compiler.util.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiCallingConvention.*; +import com.sun.cri.ci.CiCallingConvention.Type; import com.sun.cri.ri.*; /** diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java Tue Aug 09 23:56:10 2011 +0200 @@ -28,8 +28,8 @@ import com.oracle.max.graal.compiler.alloc.*; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; /** diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRCall.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRCall.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRCall.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,9 +25,9 @@ import java.util.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiTargetMethod.*; +import com.sun.cri.ci.CiTargetMethod.Mark; import com.sun.cri.ri.*; -import com.sun.cri.xir.CiXirAssembler.*; +import com.sun.cri.xir.CiXirAssembler.XirMark; /** * This class represents a call instruction; either to a {@linkplain CiRuntimeCall runtime method}, diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,8 +23,7 @@ package com.oracle.max.graal.compiler.lir; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.value.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -34,7 +33,7 @@ public class LIRDebugInfo { public abstract static class ValueLocator { - public abstract CiValue getLocation(Value value); + public abstract CiValue getLocation(ValueNode value); } public final FrameState state; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java Tue Aug 09 23:56:10 2011 +0200 @@ -32,10 +32,10 @@ import com.oracle.max.graal.compiler.globalstub.*; import com.oracle.max.graal.compiler.ir.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiTargetMethod.*; +import com.sun.cri.ci.CiTargetMethod.Mark; import com.sun.cri.ri.*; +import com.sun.cri.xir.CiXirAssembler.XirMark; import com.sun.cri.xir.*; -import com.sun.cri.xir.CiXirAssembler.*; /** * This class represents a list of LIR instructions and contains factory methods for creating and appending LIR diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRMemoryBarrier.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRMemoryBarrier.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRMemoryBarrier.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.lir; -import com.sun.cri.bytecode.Bytecodes.*; +import com.sun.cri.bytecode.Bytecodes.MemoryBarriers; import com.sun.cri.ci.*; /** diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FrameState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FrameState.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,674 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.base; + +import static com.oracle.max.graal.compiler.value.ValueUtil.*; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.ir.Phi.PhiType; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.compiler.value.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + +/** + * The {@code FrameState} class encapsulates the frame state (i.e. local variables and + * operand stack) at a particular point in the abstract interpretation. + */ +public final class FrameState extends ValueNode implements FrameStateAccess { + + protected final int localsSize; + + protected final int stackSize; + + protected final int locksSize; + + private boolean rethrowException; + + public static final int BEFORE_BCI = -2; + public static final int AFTER_BCI = -3; + + @Input private FrameState outerFrameState; + + @Input private final NodeInputList values; + + @Input private final NodeInputList virtualObjectMappings; + + public FrameState outerFrameState() { + return outerFrameState; + } + + public void setOuterFrameState(FrameState x) { + updateUsages(this.outerFrameState, x); + this.outerFrameState = x; + } + + @Override + public void setValueAt(int i, ValueNode x) { + values.set(i, x); + } + + /** + * The bytecode index to which this frame state applies. This will be {@code -1} + * iff this state is mutable. + */ + public final int bci; + + public final RiMethod method; + + /** + * Creates a {@code FrameState} for the given scope and maximum number of stack and local variables. + * + * @param bci the bytecode index of the frame state + * @param localsSize number of locals + * @param stackSize size of the stack + * @param lockSize number of locks + */ + public FrameState(RiMethod method, int bci, int localsSize, int stackSize, int locksSize, boolean rethrowException, Graph graph) { + super(CiKind.Illegal, graph); + this.method = method; + this.bci = bci; + this.localsSize = localsSize; + this.stackSize = stackSize; + this.locksSize = locksSize; + this.values = new NodeInputList(this, localsSize + stackSize + locksSize); + this.virtualObjectMappings = new NodeInputList(this); + this.rethrowException = rethrowException; + //GraalMetrics.FrameStatesCreated++; + //GraalMetrics.FrameStateValuesCreated += localsSize + stackSize + locksSize; + } + + public FrameState(RiMethod method, int bci, ValueNode[] locals, ValueNode[] stack, int stackSize, ArrayList locks, boolean rethrowException, Graph graph) { + this(method, bci, locals.length, stackSize, locks.size(), rethrowException, graph); + for (int i = 0; i < locals.length; i++) { + setValueAt(i, locals[i]); + } + for (int i = 0; i < stackSize; i++) { + setValueAt(localsSize + i, stack[i]); + } + for (int i = 0; i < locks.size(); i++) { + setValueAt(locals.length + stackSize + i, locks.get(i)); + } + } + + public boolean rethrowException() { + return rethrowException; + } + + public RiMethod method() { + return method; + } + + public void addVirtualObjectMapping(Node virtualObject) { + assert virtualObject instanceof VirtualObjectFieldNode || virtualObject instanceof Phi : virtualObject; + virtualObjectMappings.add(virtualObject); + } + + public int virtualObjectMappingCount() { + return virtualObjectMappings.size(); + } + + public Node virtualObjectMappingAt(int i) { + return virtualObjectMappings.get(i); + } + + public Iterable virtualObjectMappings() { + return virtualObjectMappings; + } + + /** + * Gets a copy of this frame state. + */ + public FrameState duplicate(int bci) { + return duplicate(bci, false); + } + + public FrameState duplicate(int bci, boolean duplicateOuter) { + FrameState other = new FrameState(method, bci, localsSize, stackSize, locksSize, rethrowException, graph()); + other.values.setAll(values); + other.virtualObjectMappings.setAll(virtualObjectMappings); + FrameState outerFrameState = outerFrameState(); + if (duplicateOuter && outerFrameState != null) { + outerFrameState = outerFrameState.duplicate(outerFrameState.bci, duplicateOuter); + } + other.setOuterFrameState(outerFrameState); + return other; + } + + @Override + public FrameState duplicateWithException(int bci, ValueNode exceptionObject) { + return duplicateModified(bci, true, CiKind.Void, exceptionObject); + } + + /** + * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the + * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long + * or double is followed by a null slot. + */ + public FrameState duplicateModified(int bci, boolean rethrowException, CiKind popKind, ValueNode... pushedValues) { + int popSlots = popKind.sizeInSlots(); + int pushSlots = pushedValues.length; + FrameState other = new FrameState(method, bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), rethrowException, graph()); + for (int i = 0; i < localsSize; i++) { + other.setValueAt(i, localAt(i)); + } + for (int i = 0; i < stackSize - popSlots; i++) { + other.setValueAt(localsSize + i, stackAt(i)); + } + int slot = localsSize + stackSize - popSlots; + for (int i = 0; i < pushSlots; i++) { + other.setValueAt(slot++, pushedValues[i]); + } + for (int i = 0; i < locksSize; i++) { + other.setValueAt(localsSize + other.stackSize + i, lockAt(i)); + } + other.virtualObjectMappings.setAll(virtualObjectMappings); + other.setOuterFrameState(outerFrameState()); + return other; + } + + public boolean isCompatibleWith(FrameStateAccess other) { + if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { + return false; + } + for (int i = 0; i < stackSize(); i++) { + ValueNode x = stackAt(i); + ValueNode y = other.stackAt(i); + if (x != y && typeMismatch(x, y)) { + return false; + } + } + for (int i = 0; i < locksSize(); i++) { + if (lockAt(i) != other.lockAt(i)) { + return false; + } + } + if (other.outerFrameState() != outerFrameState()) { + return false; + } + return true; + } + + public boolean equals(FrameStateAccess other) { + if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { + return false; + } + for (int i = 0; i < stackSize(); i++) { + ValueNode x = stackAt(i); + ValueNode y = other.stackAt(i); + if (x != y) { + return false; + } + } + for (int i = 0; i < locksSize(); i++) { + if (lockAt(i) != other.lockAt(i)) { + return false; + } + } + if (other.outerFrameState() != outerFrameState()) { + return false; + } + return true; + } + + /** + * Gets the size of the local variables. + */ + public int localsSize() { + return localsSize; + } + + /** + * Gets the current size (height) of the stack. + */ + public int stackSize() { + return stackSize; + } + + /** + * Gets number of locks held by this frame state. + */ + public int locksSize() { + return locksSize; + } + + /** + * Invalidates the local variable at the specified index. If the specified index refers to a doubleword local, then + * invalidates the high word as well. + * + * @param i the index of the local to invalidate + */ + public void invalidateLocal(int i) { + // note that for double word locals, the high slot should already be null + // unless the local is actually dead and the high slot is being reused; + // in either case, it is not necessary to null the high slot + setValueAt(i, null); + } + + /** + * Stores a given local variable at the specified index. If the value is a {@linkplain CiKind#isDoubleWord() double word}, + * then the next local variable index is also overwritten. + * + * @param i the index at which to store + * @param x the instruction which produces the value for the local + */ + public void storeLocal(int i, ValueNode x) { + assert i < localsSize : "local variable index out of range: " + i; + invalidateLocal(i); + setValueAt(i, x); + if (isDoubleWord(x)) { + // (tw) if this was a double word then kill i+1 + setValueAt(i + 1, null); + } + if (i > 0) { + // if there was a double word at i - 1, then kill it + ValueNode p = localAt(i - 1); + if (isDoubleWord(p)) { + setValueAt(i - 1, null); + } + } + } + + /** + * Gets the value in the local variables at the specified index. + * + * @param i the index into the locals + * @return the instruction that produced the value for the specified local + */ + public ValueNode localAt(int i) { + assert i < localsSize : "local variable index out of range: " + i; + return valueAt(i); + } + + /** + * Get the value on the stack at the specified stack index. + * + * @param i the index into the stack, with {@code 0} being the bottom of the stack + * @return the instruction at the specified position in the stack + */ + public ValueNode stackAt(int i) { + assert i >= 0 && i < (localsSize + stackSize); + return valueAt(localsSize + i); + } + + /** + * Retrieves the lock at the specified index in the lock stack. + * @param i the index into the lock stack + * @return the instruction which produced the object at the specified location in the lock stack + */ + public ValueNode lockAt(int i) { + assert i >= 0; + return valueAt(localsSize + stackSize + i); + } + + /** + * Inserts a phi statement into the stack at the specified stack index. + * @param block the block begin for which we are creating the phi + * @param i the index into the stack for which to create a phi + */ + public Phi setupPhiForStack(Merge block, int i) { + ValueNode p = stackAt(i); + if (p != null) { + if (p instanceof Phi) { + Phi phi = (Phi) p; + if (phi.merge() == block) { + return phi; + } + } + Phi phi = new Phi(p.kind, block, PhiType.Value, graph()); + setValueAt(localsSize + i, phi); + return phi; + } + return null; + } + + /** + * Inserts a phi statement for the local at the specified index. + * @param block the block begin for which we are creating the phi + * @param i the index of the local variable for which to create the phi + */ + public Phi setupPhiForLocal(Merge block, int i) { + ValueNode p = localAt(i); + if (p instanceof Phi) { + Phi phi = (Phi) p; + if (phi.merge() == block) { + return phi; + } + } + Phi phi = new Phi(p.kind, block, PhiType.Value, graph()); + storeLocal(i, phi); + return phi; + } + + /** + * Gets the value at a specified index in the set of operand stack and local values represented by this frame. + * This method should only be used to iterate over all the values in this frame, irrespective of whether + * they are on the stack or in local variables. + * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. + * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. + * + * @param i a value in the range {@code [0 .. valuesSize()]} + * @return the value at index {@code i} which may be {@code null} + */ + public ValueNode valueAt(int i) { + assert i < (localsSize + stackSize + locksSize); + return values.isEmpty() ? null : values.get(i); + } + + /** + * The number of operand stack slots and local variables in this frame. + * This method should typically only be used in conjunction with {@link #valueAt(int)}. + * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. + * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. + * + * @return the number of local variables in this frame + */ + public int valuesSize() { + return localsSize + stackSize; + } + + private void checkSize(FrameStateAccess other) { + if (other.stackSize() != stackSize()) { + throw new CiBailout("stack sizes do not match"); + } else if (other.localsSize() != localsSize) { + throw new CiBailout("local sizes do not match"); + } + } + + public void merge(Merge block, FrameStateAccess other) { + checkSize(other); + for (int i = 0; i < valuesSize(); i++) { + ValueNode x = valueAt(i); + if (x != null) { + ValueNode y = other.valueAt(i); + if (x != y || ((x instanceof Phi) && ((Phi) x).merge() == block)) { + if (typeMismatch(x, y)) { + if ((x instanceof Phi) && ((Phi) x).merge() == block) { + x.replaceAtUsages(null); + x.delete(); + } + setValueAt(i, null); + continue; + } + Phi phi = null; + if (i < localsSize) { + // this a local + phi = setupPhiForLocal(block, i); + } else { + // this is a stack slot + phi = setupPhiForStack(block, i - localsSize); + } + + if (phi.valueCount() == 0) { + int size = block.phiPredecessorCount(); + for (int j = 0; j < size; ++j) { + phi.addInput(x); + } + phi.addInput((x == y) ? phi : y); + } else { + phi.addInput((x == y) ? phi : y); + } + + assert phi.valueCount() == block.phiPredecessorCount() + (block instanceof LoopBegin ? 0 : 1) : "valueCount=" + phi.valueCount() + " predSize= " + block.phiPredecessorCount(); + } + } + } + } + + public Merge block() { + for (Node n : usages()) { + if (n instanceof Merge) { + return (Merge) n; + } + } + return null; + } + + public StateSplit stateSplit() { + for (Node n : usages()) { + if (n instanceof StateSplit) { + return (StateSplit) n; + } + } + return null; + } + + public Iterable innerFrameStates() { + final Iterator iterator = usages().iterator(); + return new Iterable() { + @Override + public Iterator iterator() { + return new Iterator() { + private Node next; + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + @Override + public FrameState next() { + forward(); + if (!hasNext()) { + throw new NoSuchElementException(); + } + FrameState res = (FrameState) next; + next = null; + return res; + } + @Override + public boolean hasNext() { + forward(); + return next != null; + } + private void forward() { + while (!(next instanceof FrameState) && iterator.hasNext()) { + next = iterator.next(); + } + } + }; + } + }; + } + + /** + * The interface implemented by a client of {@link FrameState#forEachPhi(Merge, PhiProcedure)} and + * {@link FrameState#forEachLivePhi(Merge, PhiProcedure)}. + */ + public static interface PhiProcedure { + boolean doPhi(Phi phi); + } + + /** + * Checks whether this frame state has any {@linkplain Phi phi} statements. + */ + public boolean hasPhis() { + for (int i = 0; i < valuesSize(); i++) { + ValueNode value = valueAt(i); + if (value instanceof Phi) { + return true; + } + } + return false; + } + + /** + * The interface implemented by a client of {@link FrameState#forEachLiveStateValue(ValueProcedure)}. + */ + public static interface ValueProcedure { + void doValue(ValueNode value); + } + + /** + * Traverses all {@linkplain ValueNode#isLive() live values} of this frame state. + * + * @param proc the call back called to process each live value traversed + */ + public void forEachLiveStateValue(ValueProcedure proc) { + HashSet vobjs = null; + FrameState current = this; + do { + for (int i = 0; i < current.valuesSize(); i++) { + ValueNode value = current.valueAt(i); + if (value instanceof VirtualObjectNode) { + if (vobjs == null) { + vobjs = new HashSet(); + } + vobjs.add((VirtualObjectNode) value); + } else if (value != null) { + proc.doValue(value); + } + } + current = current.outerFrameState(); + } while (current != null); + + if (vobjs != null) { + // collect all VirtualObjectField instances: + HashMap objectStates = new HashMap(); + current = this; + do { + for (int i = 0; i < current.virtualObjectMappingCount(); i++) { + VirtualObjectFieldNode field = (VirtualObjectFieldNode) current.virtualObjectMappingAt(i); + // null states occur for objects with 0 fields + if (field != null && !objectStates.containsKey(field.object())) { + objectStates.put(field.object(), field); + } + } + current = current.outerFrameState(); + } while (current != null); + + do { + HashSet vobjsCopy = new HashSet(vobjs); + for (VirtualObjectNode vobj : vobjsCopy) { + if (vobj.fields().length > 0) { + boolean[] fieldState = new boolean[vobj.fields().length]; + FloatingNode currentField = objectStates.get(vobj); + assert currentField != null : this; + do { + if (currentField instanceof VirtualObjectFieldNode) { + int index = ((VirtualObjectFieldNode) currentField).index(); + ValueNode value = ((VirtualObjectFieldNode) currentField).input(); + if (!fieldState[index]) { + fieldState[index] = true; + if (value instanceof VirtualObjectNode) { + vobjs.add((VirtualObjectNode) value); + } else { + proc.doValue(value); + } + } + currentField = ((VirtualObjectFieldNode) currentField).lastState(); + } else { + assert currentField instanceof Phi : currentField; + currentField = (FloatingNode) ((Phi) currentField).valueAt(0); + } + } while (currentField != null); + } + vobjs.remove(vobj); + } + } while (!vobjs.isEmpty()); + assert vobjs.isEmpty() : "at FrameState " + this; + } + } + + @Override + public String toString() { + return super.toString(); + } + + public String toDetailedString() { + StringBuilder sb = new StringBuilder(); + String nl = String.format("%n"); + sb.append("[bci: ").append(bci).append("]"); + if (rethrowException()) { + sb.append(" rethrows Exception"); + } + sb.append(nl); + for (int i = 0; i < localsSize(); ++i) { + ValueNode value = localAt(i); + sb.append(String.format(" local[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); + } + for (int i = 0; i < stackSize(); ++i) { + ValueNode value = stackAt(i); + sb.append(String.format(" stack[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); + } + for (int i = 0; i < locksSize(); ++i) { + ValueNode value = lockAt(i); + sb.append(String.format(" lock[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); + } + return sb.toString(); + } + + @Override + public void accept(ValueVisitor v) { + v.visitFrameState(this); + } + + @Override + public String shortName() { + return "FrameState@" + bci; + } + + public void visitFrameState(FrameState i) { + // nothing to do for now + } + + @Override + public Map getDebugProperties() { + Map properties = super.getDebugProperties(); + properties.put("bci", bci); + properties.put("method", CiUtil.format("%H.%n(%p):%r", method, false)); + StringBuilder str = new StringBuilder(); + for (int i = 0; i < localsSize(); i++) { + str.append(i == 0 ? "" : ", ").append(localAt(i) == null ? "_" : localAt(i).id()); + } + properties.put("locals", str.toString()); + str = new StringBuilder(); + for (int i = 0; i < stackSize(); i++) { + str.append(i == 0 ? "" : ", ").append(stackAt(i) == null ? "_" : stackAt(i).id()); + } + properties.put("stack", str.toString()); + str = new StringBuilder(); + for (int i = 0; i < locksSize(); i++) { + str.append(i == 0 ? "" : ", ").append(lockAt(i) == null ? "_" : lockAt(i).id()); + } + properties.put("locks", str.toString()); + properties.put("rethrowException", rethrowException); + return properties; + } + + @Override + public void delete() { + FrameState outerFrameState = outerFrameState(); + super.delete(); + if (outerFrameState != null && outerFrameState.usages().isEmpty()) { + outerFrameState.delete(); + } + } + + @Override + public void setRethrowException(boolean b) { + rethrowException = b; + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/StateSplit.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/StateSplit.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + +/** + * The {@code StateSplit} class is the abstract base class of all instructions + * that store an immutable copy of the frame state. + */ +public abstract class StateSplit extends FixedNodeWithNext { + + @Input private FrameState stateAfter; + + public FrameState stateAfter() { + return stateAfter; + } + + public void setStateAfter(FrameState x) { + updateUsages(stateAfter, x); + stateAfter = x; + } + + /** + * Creates a new state split with the specified value type. + * @param kind the type of the value that this instruction produces + * @param graph + */ + public StateSplit(CiKind kind, Graph graph) { + super(kind, graph); + } + + public boolean needsStateAfter() { + return true; + } + + @Override + public void delete() { + FrameState stateAfter = stateAfter(); + super.delete(); + if (stateAfter != null) { + if (stateAfter.usages().isEmpty()) { + stateAfter.delete(); + } + } + } + + @Override + public Iterable< ? extends Node> dataInputs() { + final Iterator< ? extends Node> dataInputs = super.dataInputs().iterator(); + return new Iterable() { + @Override + public Iterator iterator() { + return new FilteringIterator(dataInputs, FrameState.class); + } + }; + } + + public static final class FilteringIterator implements Iterator { + + private final Iterator< ? extends Node> input; + private Node next; + private Class< ? > clazz; + + public FilteringIterator(Iterator< ? extends Node> input, Class clazz) { + this.input = input; + this.clazz = clazz; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + @Override + public Node next() { + forward(); + if (!hasNext()) { + throw new NoSuchElementException(); + } + Node res = next; + next = null; + return res; + } + + @Override + public boolean hasNext() { + forward(); + return next != null; + } + + private void forward() { + while (next == null && input.hasNext()) { + next = input.next(); + if (clazz.isInstance(next)) { + next = null; + } + } + } + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ValueNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ValueNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + +/** + * This class represents a value within the HIR graph, including local variables, phis, and + * all other instructions. + */ +public abstract class ValueNode extends Node { + + /** + * The kind of this value. This is {@link CiKind#Void} for instructions that produce no value. + * This kind is guaranteed to be a {@linkplain CiKind#stackKind() stack kind}. + */ + @Data public final CiKind kind; + + protected CiValue operand = CiValue.IllegalValue; + + /** + * Creates a new value with the specified kind. + * @param kind the type of this value + * @param inputCount + * @param successorCount + * @param graph + */ + public ValueNode(CiKind kind, Graph graph) { + super(graph); + assert kind != null && kind == kind.stackKind() : kind + " != " + kind.stackKind(); + this.kind = kind; + } + + /** + * Checks whether this value is a constant (i.e. it is of type {@link Constant}. + * @return {@code true} if this value is a constant + */ + public final boolean isConstant() { + return this instanceof Constant; + } + + /** + * Checks whether this value represents the null constant. + * @return {@code true} if this value represents the null constant + */ + public final boolean isNullConstant() { + return this instanceof Constant && ((Constant) this).value.isNull(); + } + + /** + * Convert this value to a constant if it is a constant, otherwise return null. + * @return the {@link CiConstant} represented by this value if it is a constant; {@code null} + * otherwise + */ + public final CiConstant asConstant() { + if (this instanceof Constant) { + return ((Constant) this).value; + } + return null; + } + + /** + * Gets the LIR operand associated with this instruction. + * @return the LIR operand for this instruction + */ + public final CiValue operand() { + return operand; + } + + /** + * Sets the LIR operand associated with this instruction. + * @param operand the operand to associate with this instruction + */ + public final void setOperand(CiValue operand) { + assert this.operand.isIllegal() : "operand cannot be set twice"; + assert operand != null && operand.isLegal() : "operand must be legal"; + assert operand.kind.stackKind() == this.kind; + assert !(this instanceof VirtualObjectNode); + this.operand = operand; + } + + /** + * Clears the LIR operand associated with this instruction. + */ + public final void clearOperand() { + this.operand = CiValue.IllegalValue; + } + + /** + * Computes the exact type of the result of this instruction, if possible. + * @return the exact type of the result of this instruction, if it is known; {@code null} otherwise + */ + public RiType exactType() { + return null; // default: unknown exact type + } + + /** + * Computes the declared type of the result of this instruction, if possible. + * @return the declared type of the result of this instruction, if it is known; {@code null} otherwise + */ + public RiType declaredType() { + return null; // default: unknown declared type + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("#"); + builder.append(id()); + builder.append(' '); + if (id() < 10) { + builder.append(' '); + } + builder.append(getClass().getSimpleName()); + builder.append(" [").append(flagsToString()).append("]"); + return builder.toString(); + } + + public String flagsToString() { + StringBuilder sb = new StringBuilder(); + return sb.toString(); + } + + /** + * This method supports the visitor pattern by accepting a visitor and calling the + * appropriate {@code visit()} method. + * + * @param v the visitor to accept + */ + public void accept(ValueVisitor v) { + throw new IllegalStateException("No visit method for this node (" + this.getClass().getSimpleName() + ")"); + } + + public static final LoweringOp DELEGATE_TO_RUNTIME = new LoweringOp() { + @Override + public void lower(Node n, CiLoweringTool tool) { + tool.getRuntime().lower(n, tool); + } + }; + + public static final LIRGeneratorOp DELEGATE_TO_VALUE_VISITOR = new LIRGeneratorOp() { + @Override + public void generate(Node n, LIRGeneratorTool generator) { + ((ValueNode) n).accept(generator); + } + }; + + @SuppressWarnings("unchecked") + @Override + public T lookup(Class clazz) { + if (clazz == LIRGeneratorOp.class) { + return (T) DELEGATE_TO_VALUE_VISITOR; + } + return super.lookup(clazz); + } + + @Override + public Map getDebugProperties() { + Map properties = super.getDebugProperties(); + properties.put("kind", kind.toString()); + properties.put("operand", operand == null ? "null" : operand.toString()); + return properties; + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/SwitchNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/SwitchNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009, 2010, 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.max.graal.compiler.nodes.cfg; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + +/** + * The {@code Switch} class is the base of both lookup and table switches. + */ +public abstract class SwitchNode extends ControlSplit { + + @Input private ValueNode value; + + public ValueNode value() { + return value; + } + + public void setValue(ValueNode x) { + updateUsages(value, x); + value = x; + } + + /** + * Constructs a new Switch. + * @param value the instruction that provides the value to be switched over + * @param successors the list of successors of this switch + * @param stateAfter the state after the switch + * @param graph + */ + public SwitchNode(ValueNode value, List successors, double[] probability, int inputCount, int successorCount, Graph graph) { + super(CiKind.Illegal, successors, probability, graph); + setValue(value); + } + + /** + * Gets the number of cases that this switch covers (excluding the default case). + * @return the number of cases + */ + public int numberOfCases() { + return blockSuccessorCount() - 1; + } + +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/TableSwitchNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/TableSwitchNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.cfg; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; + +/** + * The {@code TableSwitch} instruction represents a table switch. + */ +public final class TableSwitchNode extends SwitchNode { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + final int lowKey; + + /** + * Constructs a new TableSwitch instruction. + * @param value the instruction producing the value being switched on + * @param successors the list of successors + * @param lowKey the lowest integer key in the table + * @param stateAfter the state after the switch + * @param graph + */ + public TableSwitchNode(ValueNode value, List successors, int lowKey, double[] probability, Graph graph) { + super(value, successors, probability, INPUT_COUNT, SUCCESSOR_COUNT, graph); + this.lowKey = lowKey; + } + + /** + * Gets the lowest key in the table switch (inclusive). + * @return the low key + */ + public int lowKey() { + return lowKey; + } + + /** + * Gets the highest key in the table switch (exclusive). + * @return the high key + */ + public int highKey() { + return lowKey + numberOfCases(); + } + + @Override + public void accept(ValueVisitor v) { + v.visitTableSwitch(this); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/WriteMemoryCheckpointNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/WriteMemoryCheckpointNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.cfg; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +public final class WriteMemoryCheckpointNode extends AbstractMemoryCheckpointNode { + + public WriteMemoryCheckpointNode(Graph graph) { + this(CiKind.Illegal, graph); + } + + public WriteMemoryCheckpointNode(CiKind result, Graph graph) { + super(result, graph); + } + + @Override + public T lookup(Class clazz) { + if (clazz == LIRGeneratorOp.class) { + return null; + } + return super.lookup(clazz); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ShiftNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ShiftNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + +/** + * The {@code ShiftOp} class represents shift operations. + */ +public abstract class ShiftNode extends Binary { + + /** + * Creates a new shift operation. + * @param opcode the opcode of the shift + * @param x the first input value + * @param s the second input value + */ + public ShiftNode(CiKind kind, int opcode, ValueNode x, ValueNode s, Graph graph) { + super(kind, opcode, x, s, graph); + assert x == null || x.kind == kind; + } + + @Override + public void accept(ValueVisitor v) { + v.visitShift(this); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreFieldNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreFieldNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + +/** + * The {@code StoreField} instruction represents a write to a static or instance field. + */ +public final class StoreFieldNode extends AccessField { + + @Input private ValueNode value; + + public ValueNode value() { + return value; + } + + public void setValue(ValueNode x) { + updateUsages(value, x); + value = x; + } + + /** + * Creates a new LoadField instance. + * @param object the receiver object + * @param field the compiler interface field + * @param value the instruction representing the value to store to the field + * @param stateAfter the state after the field access + * @param graph + */ + public StoreFieldNode(ValueNode object, RiField field, ValueNode value, Graph graph) { + super(CiKind.Void, object, field, graph); + setValue(value); + } + + @Override + public void accept(ValueVisitor v) { + v.visitStoreField(this); + } + + @SuppressWarnings("unchecked") + @Override + public T lookup(java.lang.Class clazz) { + if (clazz == LoweringOp.class) { + return (T) DELEGATE_TO_RUNTIME; + } + return super.lookup(clazz); + }; +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreIndexedNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreIndexedNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + +/** + * The {@code StoreIndexed} instruction represents a write to an array element. + */ +public final class StoreIndexedNode extends AccessIndexed { + + @Input private ValueNode value; + + public ValueNode value() { + return value; + } + + public void setValue(ValueNode x) { + updateUsages(value, x); + value = x; + } + + /** + * Creates a new StoreIndexed instruction. + * @param array the instruction producing the array + * @param index the instruction producing the index + * @param length the instruction producing the length + * @param elementKind the element type + * @param value the value to store into the array + * @param stateAfter the state after executing this instruction + * @param graph + */ + public StoreIndexedNode(ValueNode array, ValueNode index, ValueNode length, CiKind elementKind, ValueNode value, Graph graph) { + super(CiKind.Void, array, index, length, elementKind, graph); + setValue(value); + } + + @Override + public void accept(ValueVisitor v) { + v.visitStoreIndexed(this); + } + + @SuppressWarnings("unchecked") + @Override + public T lookup(Class clazz) { + if (clazz == LoweringOp.class) { + return (T) DELEGATE_TO_RUNTIME; + } + return super.lookup(clazz); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/TypeCheckNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/TypeCheckNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + +/** + * The {@code TypeCheck} instruction is the base class of casts and instanceof tests. + */ +public abstract class TypeCheckNode extends BooleanNode { + @Input private ValueNode object; + @Input private ValueNode targetClassInstruction; + + public ValueNode object() { + return object; + } + + public void setObject(ValueNode x) { + updateUsages(object, x); + object = x; + } + + public ValueNode targetClassInstruction() { + return targetClassInstruction; + } + + public void setTargetClassInstruction(ValueNode x) { + updateUsages(targetClassInstruction, x); + targetClassInstruction = x; + } + + /** + * Gets the target class, i.e. the class being cast to, or the class being tested against. + * @return the target class + */ + public RiType targetClass() { + return targetClassInstruction() instanceof Constant ? (RiType) targetClassInstruction().asConstant().asObject() : null; + } + + /** + * Creates a new TypeCheck instruction. + * @param targetClass the class which is being casted to or checked against + * @param object the instruction which produces the object + * @param kind the result type of this instruction + * @param graph + */ + public TypeCheckNode(ValueNode targetClassInstruction, ValueNode object, CiKind kind, Graph graph) { + super(kind, graph); + setObject(object); + setTargetClassInstruction(targetClassInstruction); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnsignedRightShiftNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnsignedRightShiftNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +@NodeInfo(shortName = ">>>") +public final class UnsignedRightShiftNode extends ShiftNode implements Canonicalizable { + + public UnsignedRightShiftNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IUSHR : Bytecodes.LUSHR, x, y, graph); + } + + @Override + public Node canonical(NotifyReProcess reProcess) { + if (y().isConstant()) { + int amount = y().asConstant().asInt(); + int originalAmout = amount; + int mask; + if (kind == CiKind.Int) { + mask = 0x1f; + } else { + assert kind == CiKind.Long; + mask = 0x3f; + } + amount &= mask; + if (x().isConstant()) { + if (kind == CiKind.Int) { + return Constant.forInt(x().asConstant().asInt() >>> amount, graph()); + } else { + assert kind == CiKind.Long; + return Constant.forLong(x().asConstant().asLong() >>> amount, graph()); + } + } + if (amount == 0) { + return x(); + } + if (x() instanceof ShiftNode) { + ShiftNode other = (ShiftNode) x(); + if (other.y().isConstant()) { + int otherAmount = other.y().asConstant().asInt() & mask; + if (other instanceof UnsignedRightShiftNode) { + int total = amount + otherAmount; + if (total != (total & mask)) { + return Constant.forInt(0, graph()); + } + return new UnsignedRightShiftNode(kind, other.x(), Constant.forInt(total, graph()), graph()); + } else if (other instanceof LeftShift && otherAmount == amount) { + if (kind == CiKind.Long) { + return new And(kind, other.x(), Constant.forLong(-1L >>> amount, graph()), graph()); + } else { + assert kind == CiKind.Int; + return new And(kind, other.x(), Constant.forInt(-1 >>> amount, graph()), graph()); + } + } + } + } + if (originalAmout != amount) { + return new UnsignedRightShiftNode(kind, x(), Constant.forInt(amount, graph()), graph()); + } + } + return this; + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnwindNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnwindNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + +/** + * Unwind takes an exception object, destroys the current stack frame and passes the exception object to the system's exception dispatch code. + */ +public final class UnwindNode extends FixedNode { + + @Input private ValueNode exception; + + public ValueNode exception() { + return exception; + } + + public void setException(ValueNode x) { + assert x == null || x.kind == CiKind.Object; + updateUsages(this.exception, x); + this.exception = x; + } + + public UnwindNode(ValueNode exception, Graph graph) { + super(CiKind.Object, graph); + setException(exception); + } + + @Override + public void accept(ValueVisitor v) { + v.visitUnwind(this); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ValueAnchorNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ValueAnchorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + +/** + * The ValueAnchor instruction keeps non-CFG nodes above a certain point in the graph. + */ +public final class ValueAnchorNode extends FixedNodeWithNext { + @Input private ValueNode object; + + public ValueNode object() { + return object; + } + + public void setObject(ValueNode x) { + updateUsages(object, x); + object = x; + } + + public ValueAnchorNode(ValueNode object, Graph graph) { + super(CiKind.Illegal, graph); + setObject(object); + } + + @Override + public void accept(ValueVisitor v) { + v.visitValueAnchor(this); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectFieldNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectFieldNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +public class VirtualObjectFieldNode extends FloatingNode { + + @Input private VirtualObjectNode object; + @Input private FloatingNode lastState; + @Input private ValueNode input; + + public VirtualObjectNode object() { + return object; + } + + public void setObject(VirtualObjectNode x) { + updateUsages(object, x); + object = x; + } + + public FloatingNode lastState() { + return lastState; + } + + public void setLastState(FloatingNode x) { + updateUsages(lastState, x); + lastState = x; + } + + public ValueNode input() { + return input; + } + + public void setInput(ValueNode x) { + updateUsages(input, x); + input = x; + } + + private int index; + + /** + * Constructs a new ArrayLength instruction. + * @param array the instruction producing the array + * @param newFrameState the state after executing this instruction + */ + public VirtualObjectFieldNode(VirtualObjectNode object, FloatingNode lastState, ValueNode input, int index, Graph graph) { + super(CiKind.Int, graph); + this.index = index; + setObject(object); + setLastState(lastState); + setInput(input); + } + + public int index() { + return index; + } + + @Override + public void accept(ValueVisitor v) { + // nothing to do... + } + + @Override + public Map getDebugProperties() { + Map properties = super.getDebugProperties(); + properties.put("index", index); + return properties; + } + + @Override + public String shortName() { + return "VirtualObjectField " + object().fields()[index].name(); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + + +public class VirtualObjectNode extends FloatingNode { + + + + private EscapeField[] fields; + private RiType type; + + public VirtualObjectNode(RiType type, EscapeField[] fields, Graph graph) { + super(CiKind.Int, graph); + this.type = type; + this.fields = fields; + } + + public RiType type() { + return type; + } + + public EscapeField[] fields() { + return fields; + } + + @Override + public void accept(ValueVisitor v) { + // nothing to do... + } + + @Override + public Map getDebugProperties() { + Map properties = super.getDebugProperties(); + properties.put("type", type); + return properties; + } + + @Override + public String shortName() { + return "VirtualObject " + type.name(); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +public final class WriteNode extends AccessNode { + @Input private ValueNode value; + + public ValueNode value() { + return value; + } + + public void setValue(ValueNode x) { + updateUsages(value, x); + value = x; + } + + public WriteNode(CiKind kind, ValueNode object, ValueNode value, LocationNode location, Graph graph) { + super(kind, object, location, graph); + setValue(value); + } + + @Override + public void accept(ValueVisitor v) { + v.visitMemoryWrite(this); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteVectorNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteVectorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +public final class WriteVectorNode extends AccessVectorNode { + @Input private AbstractVectorNode values; + + public AbstractVectorNode values() { + return values; + } + + public void setValues(AbstractVectorNode x) { + updateUsages(values, x); + values = x; + } + + public WriteVectorNode(AbstractVectorNode vector, ValueNode object, LocationNode location, AbstractVectorNode values, Graph graph) { + super(CiKind.Illegal, vector, object, location, graph); + setValues(values); + } + + @Override + public T lookup(Class clazz) { + if (clazz == LIRGeneratorOp.class) { + return null; + } + return super.lookup(clazz); + } + + @Override + public void addToLoop(LoopBegin loop, IdentityHashMap nodes) { + LocationNode newLocation = LocationNode.create(LocationNode.getArrayLocation(location().getValueKind()), location().getValueKind(), location().displacement(), graph()); + ValueNode index = nodes.get(vector()); + ValueNode value = nodes.get(values()); + assert index != null; + assert value != null; + newLocation.setIndex(index); + WriteNode writeNode = new WriteNode(location().getValueKind().stackKind(), object(), value, newLocation, graph()); + loop.loopEnd().replaceAtPredecessors(writeNode); + writeNode.setNext(loop.loopEnd()); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/XorNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/XorNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.extended; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +@NodeInfo(shortName = "^") +public final class XorNode extends Logic implements Canonicalizable { + + public XorNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IXOR : Bytecodes.LXOR, x, y, graph); + } + + @Override + public Node canonical(NotifyReProcess reProcess) { + if (x() == y()) { + if (kind == CiKind.Int) { + return Constant.forInt(0, graph()); + } else { + assert kind == CiKind.Long; + return Constant.forLong(0L, graph()); + } + } + if (x().isConstant() && !y().isConstant()) { + swapOperands(); + } + if (x().isConstant()) { + if (kind == CiKind.Int) { + return Constant.forInt(x().asConstant().asInt() ^ y().asConstant().asInt(), graph()); + } else { + assert kind == CiKind.Long; + return Constant.forLong(x().asConstant().asLong() ^ y().asConstant().asLong(), graph()); + } + } else if (y().isConstant()) { + if (kind == CiKind.Int) { + int c = y().asConstant().asInt(); + if (c == 0) { + return x(); + } + } else { + assert kind == CiKind.Long; + long c = y().asConstant().asLong(); + if (c == 0) { + return x(); + } + } + } + return this; + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/Canonicalizable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/Canonicalizable.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.spi; + +import com.oracle.max.graal.graph.*; + + +public interface Canonicalizable { + Node canonical(NotifyReProcess reProcess); +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeField.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeField.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.spi; + +import com.sun.cri.ci.*; + +public class EscapeField { + + private String name; + private Object representation; + private CiKind kind; + + public EscapeField(String name, Object representation, CiKind kind) { + this.name = name; + this.representation = representation; + this.kind = kind; + } + + public String name() { + return name; + } + + public Object representation() { + return representation; + } + + public CiKind kind() { + return kind; + } + + @Override + public String toString() { + return name(); + } +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeOp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeOp.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.spi; + +import java.util.*; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.graph.*; + + +public abstract class EscapeOp implements Op { + + public abstract boolean canAnalyze(Node node); + + public boolean escape(Node node, Node usage) { + if (usage instanceof IsNonNull) { + IsNonNull x = (IsNonNull) usage; + assert x.object() == node; + return false; + } else if (usage instanceof IsType) { + IsType x = (IsType) usage; + assert x.object() == node; + return false; + } else if (usage instanceof FrameState) { + FrameState x = (FrameState) usage; + assert x.inputContains(node); + return true; + } else if (usage instanceof AccessMonitor) { + AccessMonitor x = (AccessMonitor) usage; + assert x.object() == node; + return false; + } else { + return true; + } + } + + public abstract EscapeField[] fields(Node node); + + public void beforeUpdate(Node node, Node usage) { + if (usage instanceof IsNonNull) { + IsNonNull x = (IsNonNull) usage; + // TODO (ls) not sure about this... + x.replaceAndDelete(Constant.forBoolean(true, node.graph())); + } else if (usage instanceof IsType) { + IsType x = (IsType) usage; + assert x.type() == ((ValueNode) node).exactType(); + // TODO (ls) not sure about this... + x.replaceAndDelete(Constant.forBoolean(true, node.graph())); + } else if (usage instanceof AccessMonitor) { + AccessMonitor x = (AccessMonitor) usage; + x.replaceAndDelete(x.next()); + } + } + + public abstract int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState); + +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorOp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorOp.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.spi; + +import com.oracle.max.graal.graph.*; + +public interface LIRGeneratorOp extends Op { + void generate(Node n, LIRGeneratorTool generator); +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorTool.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorTool.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.spi; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.sun.cri.ci.*; + +public abstract class LIRGeneratorTool extends ValueVisitor { + public abstract CiValue load(ValueNode value); + public abstract CiVariable createResultVariable(ValueNode conv); + public abstract CiValue forceToSpill(CiValue value, CiKind kind, boolean b); + public abstract void emitMove(CiValue tmp, CiValue reg); + public abstract void integerAdd(ValueNode result, ValueNode x, ValueNode y); + public abstract void deoptimizeOn(Condition of); + public abstract CiVariable newVariable(CiKind kind); + public abstract CiTarget target(); + public abstract void emitLea(CiAddress address, CiVariable dest); + public abstract CiValue makeOperand(ValueNode object); + public abstract void emitUnsignedShiftRight(CiValue value, CiValue count, CiValue dst, CiValue tmp); + public abstract void emitAdd(CiValue a, CiValue b, CiValue dest); +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LoweringOp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LoweringOp.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.spi; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +public interface LoweringOp extends Op { + void lower(Node n, CiLoweringTool tool); +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/NotifyReProcess.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/NotifyReProcess.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011, 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.max.graal.compiler.nodes.spi; + +import com.oracle.max.graal.graph.*; + + +public interface NotifyReProcess { + void reProccess(Node n); +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ValueVisitor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ValueVisitor.java Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler.nodes.spi; + +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.cfg.*; +import com.oracle.max.graal.compiler.nodes.extended.*; + +/** + * The {@link ValueVisitor} implements one half of the visitor + * pattern for {@linkplain ValueNode IR values}, allowing clients to implement functionality + * depending on the type of an value without doing type tests. + */ +public abstract class ValueVisitor { + // Checkstyle: stop + public abstract void visitArithmetic(Arithmetic i); + public abstract void visitArrayLength(ArrayLength i); + public abstract void visitMerge(Merge i); + public abstract void visitCheckCast(CheckCast i); + public abstract void visitNormalizeCompare(NormalizeCompare i); + public abstract void visitConstant(Constant i); + public abstract void visitConvert(Convert i); + public abstract void visitConditional(Conditional i); + public abstract void visitExceptionObject(ExceptionObject i); + public abstract void visitEndNode(EndNode i); + public abstract void visitFrameState(FrameState i); + public abstract void visitAnchor(Anchor i); + public abstract void visitIf(If i); + public abstract void visitInvoke(Invoke i); + public abstract void visitLoadField(LoadField i); + public abstract void visitLoadIndexed(LoadIndexed i); + public abstract void visitLocal(Local i); + public abstract void visitLogic(Logic i); + public abstract void visitLookupSwitch(LookupSwitch i); + public abstract void visitMemoryRead(ReadNode i); + public abstract void visitMemoryWrite(WriteNode i); + public abstract void visitMonitorAddress(MonitorAddress monitorAddress); + public abstract void visitMonitorEnter(MonitorEnter i); + public abstract void visitMonitorExit(MonitorExit i); + public abstract void visitNegate(Negate i); + public abstract void visitNewInstance(NewInstance i); + public abstract void visitNewMultiArray(NewMultiArray i); + public abstract void visitNewObjectArray(NewObjectArray i); + public abstract void visitNewTypeArray(NewTypeArray i); + public abstract void visitFixedGuard(FixedGuard fixedGuard); + public abstract void visitPhi(Phi i); + public abstract void visitRegisterFinalizer(RegisterFinalizer i); + public abstract void visitReturn(Return i); + public abstract void visitShift(ShiftNode i); + public abstract void visitStoreField(StoreFieldNode i); + public abstract void visitStoreIndexed(StoreIndexedNode i); + public abstract void visitTableSwitch(TableSwitchNode i); + public abstract void visitDeoptimize(Deoptimize deoptimize); + public abstract void visitUnwind(UnwindNode unwind); + public abstract void visitLoopBegin(LoopBegin loopBegin); + public abstract void visitLoopEnd(LoopEnd loopEnd); + public abstract void visitValueAnchor(ValueAnchorNode valueAnchor); + public abstract void visitGuardNode(GuardNode guardNode); + public abstract void visitMathIntrinsic(MathIntrinsic node); +} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,6 +24,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; @@ -70,12 +71,4 @@ } } } - - public interface NotifyReProcess { - void reProccess(Node n); - } - - public interface Canonicalizable { - Node canonical(NotifyReProcess reProcess); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -30,9 +30,11 @@ import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.ir.Phi.PhiType; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.schedule.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -40,17 +42,17 @@ public class EscapeAnalysisPhase extends Phase { public static class BlockExitState implements MergeableState { - public final Value[] fieldState; - public final VirtualObject virtualObject; + public final ValueNode[] fieldState; + public final VirtualObjectNode virtualObject; public FloatingNode virtualObjectField; - public BlockExitState(EscapeField[] fields, VirtualObject virtualObject) { - this.fieldState = new Value[fields.length]; + public BlockExitState(EscapeField[] fields, VirtualObjectNode virtualObject) { + this.fieldState = new ValueNode[fields.length]; this.virtualObject = virtualObject; this.virtualObjectField = null; for (int i = 0; i < fields.length; i++) { fieldState[i] = Constant.defaultForKind(fields[i].kind(), virtualObject.graph()); - virtualObjectField = new VirtualObjectField(virtualObject, virtualObjectField, fieldState[i], i, virtualObject.graph()); + virtualObjectField = new VirtualObjectFieldNode(virtualObject, virtualObjectField, fieldState[i], i, virtualObject.graph()); } } @@ -61,7 +63,7 @@ } public void updateField(int fieldIndex) { - virtualObjectField = new VirtualObjectField(virtualObject, virtualObjectField, fieldState[fieldIndex], fieldIndex, virtualObject.graph()); + virtualObjectField = new VirtualObjectFieldNode(virtualObject, virtualObjectField, fieldState[fieldIndex], fieldIndex, virtualObject.graph()); } @Override @@ -100,7 +102,7 @@ assert vobjPhi == null || vobjPhi.valueCount() == withStates.size() + 1; for (int i2 = 0; i2 < fieldState.length; i2++) { if (valuePhis[i2] != null) { - virtualObjectField = new VirtualObjectField(virtualObject, virtualObjectField, valuePhis[i2], i2, virtualObject.graph()); + virtualObjectField = new VirtualObjectFieldNode(virtualObject, virtualObjectField, valuePhis[i2], i2, virtualObject.graph()); assert valuePhis[i2].valueCount() == withStates.size() + 1; } } @@ -124,7 +126,7 @@ @Override public void loopEnd(LoopEnd x, BlockExitState loopEndState) { while (!(virtualObjectField instanceof Phi)) { - virtualObjectField = ((VirtualObjectField) virtualObjectField).lastState(); + virtualObjectField = ((VirtualObjectFieldNode) virtualObjectField).lastState(); } ((Phi) virtualObjectField).addInput(loopEndState.virtualObjectField); assert ((Phi) virtualObjectField).valueCount() == 2; @@ -170,7 +172,7 @@ for (int i = 0; i < escapeFields.length; i++) { fields.put(escapeFields[i].representation(), i); } - final VirtualObject virtual = new VirtualObject(((Value) node).exactType(), escapeFields, graph); + final VirtualObjectNode virtual = new VirtualObjectNode(((ValueNode) node).exactType(), escapeFields, graph); if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) { TTY.println("new virtual object: " + virtual); } @@ -225,7 +227,7 @@ double weight = analyze(op, node, exits, invokes); if (exits.size() != 0) { if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) { - TTY.println("%n####### escaping object: %d %s (%s) in %s", node.id(), node.shortName(), ((Value) node).exactType(), compilation.method); + TTY.println("%n####### escaping object: %d %s (%s) in %s", node.id(), node.shortName(), ((ValueNode) node).exactType(), compilation.method); if (GraalOptions.TraceEscapeAnalysis) { TTY.print("%d: new value: %d %s, weight %d, escapes at ", iterations, node.id(), node.shortName(), weight); for (Node n : exits) { @@ -245,7 +247,7 @@ compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "Before escape " + node.id(), graph, true, false)); } if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) { - TTY.println("%n!!!!!!!! non-escaping object: %d %s (%s) in %s", node.id(), node.shortName(), ((Value) node).exactType(), compilation.method); + TTY.println("%n!!!!!!!! non-escaping object: %d %s (%s) in %s", node.id(), node.shortName(), ((ValueNode) node).exactType(), compilation.method); } new EscapementFixup(op, graph, node).apply(); if (compilation.compiler.isObserved()) { @@ -270,7 +272,7 @@ new DeadCodeEliminationPhase().apply(graph); if (node.isDeleted()) { if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) { - TTY.println("%n!!!!!!!! object died while performing escape analysis: %d %s (%s) in %s", node.id(), node.shortName(), ((Value) node).exactType(), compilation.method); + TTY.println("%n!!!!!!!! object died while performing escape analysis: %d %s (%s) in %s", node.id(), node.shortName(), ((ValueNode) node).exactType(), compilation.method); } break; } @@ -307,81 +309,4 @@ return weight; } - public static class EscapeField { - - private String name; - private Object representation; - private CiKind kind; - - public EscapeField(String name, Object representation, CiKind kind) { - this.name = name; - this.representation = representation; - this.kind = kind; - } - - public String name() { - return name; - } - - public Object representation() { - return representation; - } - - public CiKind kind() { - return kind; - } - - @Override - public String toString() { - return name(); - } - } - - public abstract static class EscapeOp implements Op { - - public abstract boolean canAnalyze(Node node); - - public boolean escape(Node node, Node usage) { - if (usage instanceof IsNonNull) { - IsNonNull x = (IsNonNull) usage; - assert x.object() == node; - return false; - } else if (usage instanceof IsType) { - IsType x = (IsType) usage; - assert x.object() == node; - return false; - } else if (usage instanceof FrameState) { - FrameState x = (FrameState) usage; - assert x.inputContains(node); - return true; - } else if (usage instanceof AccessMonitor) { - AccessMonitor x = (AccessMonitor) usage; - assert x.object() == node; - return false; - } else { - return true; - } - } - - public abstract EscapeField[] fields(Node node); - - public void beforeUpdate(Node node, Node usage) { - if (usage instanceof IsNonNull) { - IsNonNull x = (IsNonNull) usage; - // TODO (ls) not sure about this... - x.replaceAndDelete(Constant.forBoolean(true, node.graph())); - } else if (usage instanceof IsType) { - IsType x = (IsType) usage; - assert x.type() == ((Value) node).exactType(); - // TODO (ls) not sure about this... - x.replaceAndDelete(Constant.forBoolean(true, node.graph())); - } else if (usage instanceof AccessMonitor) { - AccessMonitor x = (AccessMonitor) usage; - x.replaceAndDelete(x.next()); - } - } - - public abstract int updateState(Node node, Node current, Map fieldIndex, Value[] fieldState); - - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -37,6 +37,9 @@ import com.oracle.max.graal.compiler.graph.BlockMap.ExceptionBlock; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.cfg.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.compiler.util.LoopUtil.Loop; @@ -87,7 +90,7 @@ private int nextBlockNumber; - private Value methodSynchronizedObject; + private ValueNode methodSynchronizedObject; private CiExceptionHandler unwindHandler; private ExceptionBlock unwindBlock; @@ -340,14 +343,14 @@ int stackSize = newState.stackSize(); for (int i = 0; i < stackSize; i++) { // always insert phis for the stack - Value x = newState.stackAt(i); + ValueNode x = newState.stackAt(i); if (x != null) { newState.setupPhiForStack(loopBegin, i).addInput(x); } } int localsSize = newState.localsSize(); for (int i = 0; i < localsSize; i++) { - Value x = newState.localAt(i); + ValueNode x = newState.localAt(i); if (x != null) { newState.setupPhiForLocal(loopBegin, i).addInput(x); } @@ -378,7 +381,7 @@ return handler.catchTypeCPI() == 0; } - private FixedNode handleException(Value exceptionObject, int bci) { + private FixedNode handleException(ValueNode exceptionObject, int bci) { assert bci == FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI || bci == bci() : "invalid bci"; if (GraalOptions.UseExceptionProbability && method.invocationCount() > GraalOptions.MatureInvocationCount) { @@ -429,7 +432,7 @@ Placeholder p = new Placeholder(graph); p.setStateAfter(frameState.duplicateWithoutStack(bci)); - Value currentExceptionObject; + ValueNode currentExceptionObject; ExceptionObject newObj = null; if (exceptionObject == null) { newObj = new ExceptionObject(graph); @@ -476,19 +479,19 @@ } private void genLoadIndexed(CiKind kind) { - Value index = frameState.ipop(); - Value array = frameState.apop(); - Value length = append(new ArrayLength(array, graph)); - Value v = append(new LoadIndexed(array, index, length, kind, graph)); + ValueNode index = frameState.ipop(); + ValueNode array = frameState.apop(); + ValueNode length = append(new ArrayLength(array, graph)); + ValueNode v = append(new LoadIndexed(array, index, length, kind, graph)); frameState.push(kind.stackKind(), v); } private void genStoreIndexed(CiKind kind) { - Value value = frameState.pop(kind.stackKind()); - Value index = frameState.ipop(); - Value array = frameState.apop(); - Value length = append(new ArrayLength(array, graph)); - StoreIndexed result = new StoreIndexed(array, index, length, kind, value, graph); + ValueNode value = frameState.pop(kind.stackKind()); + ValueNode index = frameState.ipop(); + ValueNode array = frameState.apop(); + ValueNode length = append(new ArrayLength(array, graph)); + StoreIndexedNode result = new StoreIndexedNode(array, index, length, kind, value, graph); append(result); } @@ -504,23 +507,23 @@ break; } case DUP: { - Value w = frameState.xpop(); + ValueNode w = frameState.xpop(); frameState.xpush(w); frameState.xpush(w); break; } case DUP_X1: { - Value w1 = frameState.xpop(); - Value w2 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); frameState.xpush(w1); frameState.xpush(w2); frameState.xpush(w1); break; } case DUP_X2: { - Value w1 = frameState.xpop(); - Value w2 = frameState.xpop(); - Value w3 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); + ValueNode w3 = frameState.xpop(); frameState.xpush(w1); frameState.xpush(w3); frameState.xpush(w2); @@ -528,8 +531,8 @@ break; } case DUP2: { - Value w1 = frameState.xpop(); - Value w2 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); frameState.xpush(w2); frameState.xpush(w1); frameState.xpush(w2); @@ -537,9 +540,9 @@ break; } case DUP2_X1: { - Value w1 = frameState.xpop(); - Value w2 = frameState.xpop(); - Value w3 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); + ValueNode w3 = frameState.xpop(); frameState.xpush(w2); frameState.xpush(w1); frameState.xpush(w3); @@ -548,10 +551,10 @@ break; } case DUP2_X2: { - Value w1 = frameState.xpop(); - Value w2 = frameState.xpop(); - Value w3 = frameState.xpop(); - Value w4 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); + ValueNode w3 = frameState.xpop(); + ValueNode w4 = frameState.xpop(); frameState.xpush(w2); frameState.xpush(w1); frameState.xpush(w4); @@ -561,8 +564,8 @@ break; } case SWAP: { - Value w1 = frameState.xpop(); - Value w2 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); frameState.xpush(w1); frameState.xpush(w2); break; @@ -578,8 +581,8 @@ } private void genArithmeticOp(CiKind result, int opcode, boolean canTrap) { - Value y = frameState.pop(result); - Value x = frameState.pop(result); + ValueNode y = frameState.pop(result); + ValueNode x = frameState.pop(result); boolean isStrictFP = isStrict(method.accessFlags()); Arithmetic v; switch(opcode){ @@ -606,9 +609,9 @@ default: throw new CiBailout("should not reach"); } - Value result1 = append(v); + ValueNode result1 = append(v); if (canTrap) { - append(new ValueAnchor(result1, graph)); + append(new ValueAnchorNode(result1, graph)); } frameState.push(result, result1); } @@ -618,16 +621,16 @@ } private void genShiftOp(CiKind kind, int opcode) { - Value s = frameState.ipop(); - Value x = frameState.pop(kind); - Shift v; + ValueNode s = frameState.ipop(); + ValueNode x = frameState.pop(kind); + ShiftNode v; switch(opcode){ case ISHL: case LSHL: v = new LeftShift(kind, x, s, graph); break; case ISHR: case LSHR: v = new RightShift(kind, x, s, graph); break; case IUSHR: - case LUSHR: v = new UnsignedRightShift(kind, x, s, graph); break; + case LUSHR: v = new UnsignedRightShiftNode(kind, x, s, graph); break; default: throw new CiBailout("should not reach"); } @@ -635,8 +638,8 @@ } private void genLogicOp(CiKind kind, int opcode) { - Value y = frameState.pop(kind); - Value x = frameState.pop(kind); + ValueNode y = frameState.pop(kind); + ValueNode x = frameState.pop(kind); Logic v; switch(opcode){ case IAND: @@ -644,7 +647,7 @@ case IOR: case LOR: v = new Or(kind, x, y, graph); break; case IXOR: - case LXOR: v = new Xor(kind, x, y, graph); break; + case LXOR: v = new XorNode(kind, x, y, graph); break; default: throw new CiBailout("should not reach"); } @@ -652,9 +655,9 @@ } private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { - Value y = frameState.pop(kind); - Value x = frameState.pop(kind); - Value value = append(new NormalizeCompare(opcode, resultKind, x, y, graph)); + ValueNode y = frameState.pop(kind); + ValueNode x = frameState.pop(kind); + ValueNode value = append(new NormalizeCompare(opcode, resultKind, x, y, graph)); if (!resultKind.isVoid()) { frameState.ipush(value); } @@ -668,8 +671,8 @@ private void genIncrement() { int index = stream().readLocalIndex(); int delta = stream().readIncrement(); - Value x = frameState.localAt(index); - Value y = append(Constant.forInt(delta, graph)); + ValueNode x = frameState.localAt(index); + ValueNode y = append(Constant.forInt(delta, graph)); frameState.storeLocal(index, append(new IntegerAdd(CiKind.Int, x, y, graph))); } @@ -677,7 +680,7 @@ appendGoto(createTargetAt(toBCI, frameState)); } - private void ifNode(Value x, Condition cond, Value y) { + private void ifNode(ValueNode x, Condition cond, ValueNode y) { assert !x.isDeleted() && !y.isDeleted(); double probability = method.branchProbability(bci()); if (probability < 0) { @@ -707,26 +710,26 @@ } private void genIfZero(Condition cond) { - Value y = appendConstant(CiConstant.INT_0); - Value x = frameState.ipop(); + ValueNode y = appendConstant(CiConstant.INT_0); + ValueNode x = frameState.ipop(); ifNode(x, cond, y); } private void genIfNull(Condition cond) { - Value y = appendConstant(CiConstant.NULL_OBJECT); - Value x = frameState.apop(); + ValueNode y = appendConstant(CiConstant.NULL_OBJECT); + ValueNode x = frameState.apop(); ifNode(x, cond, y); } private void genIfSame(CiKind kind, Condition cond) { - Value y = frameState.pop(kind); - Value x = frameState.pop(kind); + ValueNode y = frameState.pop(kind); + ValueNode x = frameState.pop(kind); assert !x.isDeleted() && !y.isDeleted(); ifNode(x, cond, y); } private void genThrow(int bci) { - Value exception = frameState.apop(); + ValueNode exception = frameState.apop(); FixedGuard node = new FixedGuard(new IsNonNull(exception, graph), graph); append(node); @@ -742,7 +745,7 @@ int cpi = stream().readCPI(); RiType type = constantPool.lookupType(cpi, CHECKCAST); Constant typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type.isResolved()); - Value object = frameState.apop(); + ValueNode object = frameState.apop(); if (typeInstruction != null) { // InstanceOf instanceOf = new InstanceOf(typeInstruction, object, true, graph); // FixedGuard fixedGuard = new FixedGuard(instanceOf, graph); @@ -760,7 +763,7 @@ int cpi = stream().readCPI(); RiType type = constantPool.lookupType(cpi, INSTANCEOF); Constant typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type.isResolved()); - Value object = frameState.apop(); + ValueNode object = frameState.apop(); if (typeInstruction != null) { frameState.ipush(append(new MaterializeNode(new InstanceOf(typeInstruction, object, false, graph), graph))); } else { @@ -789,7 +792,7 @@ private void genNewObjectArray(int cpi) { RiType type = constantPool.lookupType(cpi, ANEWARRAY); - Value length = frameState.ipop(); + ValueNode length = frameState.ipop(); if (type.isResolved()) { NewArray n = new NewObjectArray(type, length, graph); frameState.apush(append(n)); @@ -804,7 +807,7 @@ private void genNewMultiArray(int cpi) { RiType type = constantPool.lookupType(cpi, MULTIANEWARRAY); int rank = stream().readUByte(bci() + 3); - Value[] dims = new Value[rank]; + ValueNode[] dims = new ValueNode[rank]; for (int i = rank - 1; i >= 0; i--) { dims[i] = frameState.ipop(); } @@ -820,7 +823,7 @@ private void genGetField(int cpi, RiField field) { CiKind kind = field.kind(); - Value receiver = frameState.apop(); + ValueNode receiver = frameState.apop(); if (field.isResolved() && field.holder().isInitialized()) { LoadField load = new LoadField(receiver, field, graph); appendOptimizedLoadField(kind, load); @@ -832,10 +835,10 @@ } private void genPutField(int cpi, RiField field) { - Value value = frameState.pop(field.kind().stackKind()); - Value receiver = frameState.apop(); + ValueNode value = frameState.pop(field.kind().stackKind()); + ValueNode receiver = frameState.apop(); if (field.isResolved() && field.holder().isInitialized()) { - StoreField store = new StoreField(receiver, field, value, graph); + StoreFieldNode store = new StoreFieldNode(receiver, field, value, graph); appendOptimizedStoreField(store); } else { storeResultGraph = false; @@ -853,7 +856,7 @@ if (constantValue != null) { frameState.push(constantValue.kind.stackKind(), appendConstant(constantValue)); } else { - Value container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized); + ValueNode container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized); CiKind kind = field.kind(); if (container != null) { LoadField load = new LoadField(container, field, graph); @@ -867,10 +870,10 @@ private void genPutStatic(int cpi, RiField field) { RiType holder = field.holder(); - Value container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, field.isResolved() && holder.isInitialized()); - Value value = frameState.pop(field.kind().stackKind()); + ValueNode container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, field.isResolved() && holder.isInitialized()); + ValueNode value = frameState.pop(field.kind().stackKind()); if (container != null) { - StoreField store = new StoreField(container, field, value, graph); + StoreFieldNode store = new StoreFieldNode(container, field, value, graph); appendOptimizedStoreField(store); } else { // deopt will be generated by genTypeOrDeopt, not needed here @@ -887,13 +890,13 @@ } } - private void appendOptimizedStoreField(StoreField store) { + private void appendOptimizedStoreField(StoreFieldNode store) { append(store); } private void appendOptimizedLoadField(CiKind kind, LoadField load) { // append the load to the instruction - Value optimized = append(load); + ValueNode optimized = append(load); frameState.push(kind.stackKind(), optimized); } @@ -906,18 +909,18 @@ // of initialization is required), it can be commoned with static field accesses. genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized); } - Value[] args = frameState.popArguments(target.signature().argumentSlots(false)); + ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(false)); appendInvoke(INVOKESTATIC, target, args, cpi, constantPool); } private void genInvokeInterface(RiMethod target, int cpi, RiConstantPool constantPool) { - Value[] args = frameState.popArguments(target.signature().argumentSlots(true)); + ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true)); genInvokeIndirect(INVOKEINTERFACE, target, args, cpi, constantPool); } private void genInvokeVirtual(RiMethod target, int cpi, RiConstantPool constantPool) { - Value[] args = frameState.popArguments(target.signature().argumentSlots(true)); + ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true)); genInvokeIndirect(INVOKEVIRTUAL, target, args, cpi, constantPool); } @@ -925,13 +928,13 @@ private void genInvokeSpecial(RiMethod target, RiType knownHolder, int cpi, RiConstantPool constantPool) { assert target != null; assert target.signature() != null; - Value[] args = frameState.popArguments(target.signature().argumentSlots(true)); + ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true)); invokeDirect(target, args, knownHolder, cpi, constantPool); } - private void genInvokeIndirect(int opcode, RiMethod target, Value[] args, int cpi, RiConstantPool constantPool) { - Value receiver = args[0]; + private void genInvokeIndirect(int opcode, RiMethod target, ValueNode[] args, int cpi, RiConstantPool constantPool) { + ValueNode receiver = args[0]; // attempt to devirtualize the call if (target.isResolved()) { RiType klass = target.holder(); @@ -958,11 +961,11 @@ return target.signature().returnKind(); } - private void invokeDirect(RiMethod target, Value[] args, RiType knownHolder, int cpi, RiConstantPool constantPool) { + private void invokeDirect(RiMethod target, ValueNode[] args, RiType knownHolder, int cpi, RiConstantPool constantPool) { appendInvoke(INVOKESPECIAL, target, args, cpi, constantPool); } - private void appendInvoke(int opcode, RiMethod target, Value[] args, int cpi, RiConstantPool constantPool) { + private void appendInvoke(int opcode, RiMethod target, ValueNode[] args, int cpi, RiConstantPool constantPool) { CiKind resultType = returnKind(target); if (GraalOptions.DeoptALot) { storeResultGraph = false; @@ -972,7 +975,7 @@ frameState.pushReturn(resultType, Constant.defaultForKind(resultType, graph)); } else { Invoke invoke = new Invoke(bci(), opcode, resultType.stackKind(), args, target, target.signature().returnType(method.holder()), graph); - Value result = appendWithBCI(invoke); + ValueNode result = appendWithBCI(invoke); invoke.setExceptionEdge(handleException(null, bci())); // if (invoke.exceptionEdge() == null) { // TTY.println("no exception edge" + unwindHandler); @@ -981,7 +984,7 @@ } } - private RiType getExactType(RiType staticType, Value receiver) { + private RiType getExactType(RiType staticType, ValueNode receiver) { RiType exact = staticType.exactType(); if (exact == null) { exact = receiver.exactType(); @@ -1003,7 +1006,7 @@ append(new RegisterFinalizer(frameState.loadLocal(0), graph)); } - private void genReturn(Value x) { + private void genReturn(ValueNode x) { frameState.clearStack(); if (x != null) { frameState.push(x.kind, x); @@ -1011,7 +1014,7 @@ appendGoto(createTarget(returnBlock(bci()), frameState)); } - private void genMonitorEnter(Value x, int bci) { + private void genMonitorEnter(ValueNode x, int bci) { int lockNumber = frameState.locksSize(); MonitorAddress lockAddress = null; if (runtime.sizeOfBasicObjectLock() != 0) { @@ -1026,7 +1029,7 @@ } } - private void genMonitorExit(Value x) { + private void genMonitorExit(ValueNode x) { int lockNumber = frameState.locksSize() - 1; if (lockNumber < 0) { throw new CiBailout("monitor stack underflow"); @@ -1050,7 +1053,7 @@ private void genTableswitch() { int bci = bci(); - Value value = frameState.ipop(); + ValueNode value = frameState.ipop(); BytecodeTableSwitch ts = new BytecodeTableSwitch(stream(), bci); int max = ts.numberOfCases(); List list = new ArrayList(max + 1); @@ -1064,7 +1067,7 @@ int offset = ts.defaultOffset(); list.add(null); offsetList.add(offset); - TableSwitch tableSwitch = new TableSwitch(value, list, ts.lowKey(), switchProbability(list.size(), bci), graph); + TableSwitchNode tableSwitch = new TableSwitchNode(value, list, ts.lowKey(), switchProbability(list.size(), bci), graph); for (int i = 0; i < offsetList.size(); ++i) { tableSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState)); } @@ -1089,7 +1092,7 @@ private void genLookupswitch() { int bci = bci(); - Value value = frameState.ipop(); + ValueNode value = frameState.ipop(); BytecodeLookupSwitch ls = new BytecodeLookupSwitch(stream(), bci); int max = ls.numberOfCases(); List list = new ArrayList(max + 1); @@ -1116,7 +1119,7 @@ return new Constant(constant, graph); } - private Value append(FixedNode fixed) { + private ValueNode append(FixedNode fixed) { if (fixed instanceof Deoptimize && lastInstr.predecessor() != null) { Node cur = lastInstr; Node prev = cur; @@ -1156,15 +1159,15 @@ return fixed; } - private Value append(FixedNodeWithNext x) { + private ValueNode append(FixedNodeWithNext x) { return appendWithBCI(x); } - private Value append(Value v) { + private ValueNode append(ValueNode v) { return v; } - private Value appendWithBCI(FixedNodeWithNext x) { + private ValueNode appendWithBCI(FixedNodeWithNext x) { assert x.predecessor() == null : "instruction should not have been appended yet"; assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; lastInstr.setNext(x); @@ -1233,7 +1236,7 @@ return result; } - private Value synchronizedObject(FrameStateAccess state, RiMethod target) { + private ValueNode synchronizedObject(FrameStateAccess state, RiMethod target) { if (isStatic(target.accessFlags())) { Constant classConstant = new Constant(target.holder().getEncoding(Representation.JavaClass), graph); return append(classConstant); @@ -1330,7 +1333,7 @@ if (Modifier.isSynchronized(method.accessFlags())) { genMonitorExit(methodSynchronizedObject); } - Unwind unwindNode = new Unwind(frameState.apop(), graph); + UnwindNode unwindNode = new UnwindNode(frameState.apop(), graph); graph.setUnwind(unwindNode); append(unwindNode); } @@ -1340,7 +1343,7 @@ callRegisterFinalizer(); } CiKind returnKind = method.signature().returnKind().stackKind(); - Value x = returnKind == CiKind.Void ? null : frameState.pop(returnKind); + ValueNode x = returnKind == CiKind.Void ? null : frameState.pop(returnKind); assert frameState.stackSize() == 0; if (Modifier.isSynchronized(method.accessFlags())) { @@ -1366,7 +1369,7 @@ if (typeInstruction != null) { FixedNode catchSuccessor = createTarget(blockFromBci[block.handler.handlerBCI()], frameState); FixedNode nextDispatch = createTarget(nextBlock, frameState); - Value exception = frameState.stackAt(0); + ValueNode exception = frameState.stackAt(0); If ifNode = new If(new InstanceOf(typeInstruction, exception, false, graph), 0.5, graph); append(ifNode); ifNode.setTrueSuccessor(catchSuccessor); @@ -1422,15 +1425,15 @@ if (GraalOptions.TraceBytecodeParserLevel >= TRACELEVEL_STATE && !TTY.isSuppressed()) { log.println(String.format("| state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method)); for (int i = 0; i < frameState.localsSize(); ++i) { - Value value = frameState.localAt(i); + ValueNode value = frameState.localAt(i); log.println(String.format("| local[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind.javaName, value)); } for (int i = 0; i < frameState.stackSize(); ++i) { - Value value = frameState.stackAt(i); + ValueNode value = frameState.stackAt(i); log.println(String.format("| stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind.javaName, value)); } for (int i = 0; i < frameState.locksSize(); ++i) { - Value value = frameState.lockAt(i); + ValueNode value = frameState.lockAt(i); log.println(String.format("| lock[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind.javaName, value)); } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -30,7 +30,8 @@ import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction; -import com.oracle.max.graal.compiler.value.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.extensions.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; @@ -407,7 +408,7 @@ public static ThreadLocal> intrinsicLoader = new ThreadLocal>(); - private Graph intrinsicGraph(RiMethod parent, int bci, RiMethod target, List arguments) { + private Graph intrinsicGraph(RiMethod parent, int bci, RiMethod target, List arguments) { ServiceLoader serviceLoader = intrinsicLoader.get(); if (serviceLoader == null) { serviceLoader = ServiceLoader.load(Intrinsifier.class); @@ -434,7 +435,7 @@ boolean withReceiver = !invoke.isStatic(); int argumentCount = method.signature().argumentCount(false); - Value[] parameters = new Value[argumentCount + (withReceiver ? 1 : 0)]; + ValueNode[] parameters = new ValueNode[argumentCount + (withReceiver ? 1 : 0)]; int slot = withReceiver ? 1 : 0; int param = withReceiver ? 1 : 0; for (int i = 0; i < argumentCount; i++) { @@ -484,7 +485,7 @@ ArrayList nodes = new ArrayList(); ArrayList frameStates = new ArrayList(); Return returnNode = null; - Unwind unwindNode = null; + UnwindNode unwindNode = null; StartNode startNode = graph.start(); for (Node node : graph.getNodes()) { if (node instanceof StartNode) { @@ -495,8 +496,8 @@ nodes.add(node); if (node instanceof Return) { returnNode = (Return) node; - } else if (node instanceof Unwind) { - unwindNode = (Unwind) node; + } else if (node instanceof UnwindNode) { + unwindNode = (UnwindNode) node; } else if (node instanceof FrameState) { frameStates.add(node); } @@ -581,7 +582,7 @@ assert exceptionEdge.successors().explicitCount() == 1; ExceptionObject obj = (ExceptionObject) exceptionEdge; - Unwind unwindDuplicate = (Unwind) duplicates.get(unwindNode); + UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); for (Node usage : obj.usages().snapshot()) { usage.replaceFirstInput(obj, unwindDuplicate.exception()); } @@ -592,7 +593,7 @@ } } else { if (unwindNode != null) { - Unwind unwindDuplicate = (Unwind) duplicates.get(unwindNode); + UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); unwindDuplicate.replaceAndDelete(new Deoptimize(DeoptAction.InvalidateRecompile, compilation.graph)); } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoopPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoopPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoopPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -26,6 +26,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.compiler.util.LoopUtil.Loop; @@ -89,8 +90,8 @@ int backIndex = loopBegin.phiPredecessorIndex(loopBegin.loopEnd()); int initIndex = loopBegin.phiPredecessorIndex(loopBegin.forwardEdge()); for (Phi phi : phis) { - Value init = phi.valueAt(initIndex); - Value backEdge = phi.valueAt(backIndex); + ValueNode init = phi.valueAt(initIndex); + ValueNode backEdge = phi.valueAt(backIndex); if (loopNodes.isNew(init) || loopNodes.isNew(backEdge)) { continue; } @@ -101,7 +102,7 @@ } else { continue; } - Value stride; + ValueNode stride; if (binary.x() == phi) { stride = binary.y(); } else if (binary.y() == phi) { @@ -143,8 +144,8 @@ } private void findDerivedInductionVariable(BasicInductionVariable biv, CiKind kind, NodeBitMap loopNodes) { for (Node usage : biv.usages().snapshot()) { - Value scale = scale(usage, biv, loopNodes); - Value offset = null; + ValueNode scale = scale(usage, biv, loopNodes); + ValueNode offset = null; Node node = null; if (scale == null) { if (usage instanceof IntegerAdd) { @@ -177,10 +178,10 @@ } } - private Value scale(Node n, BasicInductionVariable biv, NodeBitMap loopNodes) { + private ValueNode scale(Node n, BasicInductionVariable biv, NodeBitMap loopNodes) { if (n instanceof IntegerMul) { IntegerMul mul = (IntegerMul) n; - Value scale = null; + ValueNode scale = null; if (mul.x() == biv) { scale = mul.y(); } else if (mul.y() == biv) { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,6 +25,7 @@ import java.util.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; @@ -33,12 +34,7 @@ public class LoweringPhase extends Phase { - public static final LoweringOp DELEGATE_TO_RUNTIME = new LoweringOp() { - @Override - public void lower(Node n, CiLoweringTool tool) { - tool.getRuntime().lower(n, tool); - } - }; + private final RiRuntime runtime; @@ -114,8 +110,4 @@ } } } - - public interface LoweringOp extends Op { - void lower(Node n, CiLoweringTool tool); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/MemoryPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/MemoryPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/MemoryPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -28,7 +28,10 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.ir.Phi.*; +import com.oracle.max.graal.compiler.ir.Phi.PhiType; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.cfg.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; @@ -151,7 +154,7 @@ Merge m = (Merge) block.firstNode(); if (original instanceof Phi && ((Phi) original).merge() == m) { Phi phi = (Phi) original; - phi.addInput((Value) newValue); + phi.addInput((ValueNode) newValue); if (GraalOptions.TraceMemoryMaps) { TTY.println("Add new input to phi " + original.id()); } @@ -160,9 +163,9 @@ } else { Phi phi = new Phi(CiKind.Illegal, m, PhiType.Memory, m.graph()); for (int i = 0; i < mergeOperationCount + 1; ++i) { - phi.addInput((Value) original); + phi.addInput((ValueNode) original); } - phi.addInput((Value) newValue); + phi.addInput((ValueNode) newValue); if (GraalOptions.TraceMemoryMaps) { TTY.println("Creating new phi " + phi.id()); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -25,6 +25,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.graph.*; public class ReadEliminationPhase extends Phase { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,10 +27,12 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.phases.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; -import com.oracle.max.graal.graph.NodeClass.*; +import com.oracle.max.graal.graph.NodeClass.NodeClassIterator; +import com.oracle.max.graal.graph.NodeClass.Position; import com.oracle.max.graal.graph.collections.*; @@ -129,7 +131,7 @@ } public static boolean isBlockEnd(Node n) { - return trueSuccessorCount(n) > 1 || n instanceof Return || n instanceof Unwind || n instanceof Deoptimize; + return trueSuccessorCount(n) > 1 || n instanceof Return || n instanceof UnwindNode || n instanceof Deoptimize; } private void print() { @@ -152,7 +154,7 @@ // Identify blocks. for (Node n : graph.getNodes()) { - if (n instanceof EndNode || n instanceof Return || n instanceof Unwind || n instanceof LoopEnd || n instanceof Deoptimize) { + if (n instanceof EndNode || n instanceof Return || n instanceof UnwindNode || n instanceof LoopEnd || n instanceof Deoptimize) { Block block = null; Node currentNode = n; while (nodeToBlock.get(currentNode) == null) { @@ -335,7 +337,7 @@ Block block; if (latestBlock == null) { block = earliestBlock(n); - } else if (GraalOptions.ScheduleOutOfLoops && !(n instanceof VirtualObjectField) && !(n instanceof VirtualObject)) { + } else if (GraalOptions.ScheduleOutOfLoops && !(n instanceof VirtualObjectFieldNode) && !(n instanceof VirtualObjectNode)) { block = scheduleOutOfLoops(n, latestBlock, earliestBlock(n)); } else { block = latestBlock; @@ -565,7 +567,7 @@ pred = usage.block.end(); } int index = phi.merge().phiPredecessorIndex(pred); - phi.setValueAt(index, (Value) patch); + phi.setValueAt(index, (ValueNode) patch); } else { usage.node.replaceFirstInput(original, patch); } @@ -627,8 +629,8 @@ } private boolean noRematerialization(Node n) { - return n instanceof Local || n instanceof LocationNode || n instanceof Constant || n instanceof StateSplit || n instanceof FrameState || n instanceof VirtualObject || - n instanceof VirtualObjectField; + return n instanceof Local || n instanceof LocationNode || n instanceof Constant || n instanceof StateSplit || n instanceof FrameState || n instanceof VirtualObjectNode || + n instanceof VirtualObjectFieldNode; } private double liveRange(Block from, Set usages) { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64GlobalStubEmitter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64GlobalStubEmitter.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64GlobalStubEmitter.java Tue Aug 09 23:56:10 2011 +0200 @@ -28,15 +28,20 @@ import com.oracle.max.asm.*; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.asm.target.amd64.AMD64Assembler.*; +import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag; import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.asm.*; import com.oracle.max.graal.compiler.globalstub.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiRegister.*; +import com.sun.cri.ci.CiRegister.RegisterFlag; import com.sun.cri.ri.*; import com.sun.cri.xir.*; -import com.sun.cri.xir.CiXirAssembler.*; +import com.sun.cri.xir.CiXirAssembler.XirConstant; +import com.sun.cri.xir.CiXirAssembler.XirConstantOperand; +import com.sun.cri.xir.CiXirAssembler.XirOperand; +import com.sun.cri.xir.CiXirAssembler.XirParameter; +import com.sun.cri.xir.CiXirAssembler.XirRegister; +import com.sun.cri.xir.CiXirAssembler.XirTemp; public class AMD64GlobalStubEmitter implements GlobalStubEmitter { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Tue Aug 09 23:56:10 2011 +0200 @@ -33,20 +33,24 @@ import com.oracle.max.asm.*; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.asm.target.amd64.AMD64Assembler.*; +import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag; import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.LIRGenerator.*; +import com.oracle.max.graal.compiler.gen.LIRGenerator.DeoptimizationStub; import com.oracle.max.graal.compiler.globalstub.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.lir.FrameMap.StackBlock; import com.oracle.max.graal.compiler.lir.*; -import com.oracle.max.graal.compiler.lir.FrameMap.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiAddress.*; -import com.sun.cri.ci.CiTargetMethod.*; +import com.sun.cri.ci.CiAddress.Scale; +import com.sun.cri.ci.CiTargetMethod.JumpTable; +import com.sun.cri.ci.CiTargetMethod.Mark; import com.sun.cri.xir.*; -import com.sun.cri.xir.CiXirAssembler.*; +import com.sun.cri.xir.CiXirAssembler.RuntimeCallInformation; +import com.sun.cri.xir.CiXirAssembler.XirInstruction; +import com.sun.cri.xir.CiXirAssembler.XirLabel; +import com.sun.cri.xir.CiXirAssembler.XirMark; /** * This class implements the x86-specific code generation for LIR. diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Tue Aug 09 23:56:10 2011 +0200 @@ -30,6 +30,8 @@ import com.oracle.max.graal.compiler.globalstub.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -62,7 +64,7 @@ } @Override - protected boolean canStoreAsConstant(Value v, CiKind kind) { + protected boolean canStoreAsConstant(ValueNode v, CiKind kind) { if (kind == CiKind.Short || kind == CiKind.Char) { // there is no immediate move of word values in asemblerI486.?pp return false; @@ -71,7 +73,7 @@ } @Override - public boolean canInlineAsConstant(Value v) { + public boolean canInlineAsConstant(ValueNode v) { if (!v.isConstant()) { return false; } @@ -130,7 +132,7 @@ setResult(x, reg); } - public boolean livesLonger(Value x, Value y) { + public boolean livesLonger(ValueNode x, ValueNode y) { // TODO(tw): Estimate which value will live longer. return false; } @@ -375,7 +377,7 @@ } @Override - public void visitShift(Shift x) { + public void visitShift(ShiftNode x) { // count must always be in rcx CiValue count = makeOperand(x.y()); boolean mustLoadCount = !count.isConstant() || x.kind == CiKind.Long; @@ -460,7 +462,7 @@ } @Override - public void visitValueAnchor(ValueAnchor valueAnchor) { + public void visitValueAnchor(ValueAnchorNode valueAnchor) { // nothing to do for ValueAnchors } @@ -499,4 +501,14 @@ return cond; } } + + @Override + public void emitMove(CiValue src, CiValue dst) { + lir().move(src, dst); + } + + @Override + public void emitLea(CiAddress address, CiVariable dest) { + lir().lea(address, dest); + } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/GraphUtil.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/GraphUtil.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/GraphUtil.java Tue Aug 09 23:56:10 2011 +0200 @@ -28,10 +28,11 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.ir.Phi.PhiType; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; -import com.oracle.max.graal.graph.NodeClass.*; +import com.oracle.max.graal.graph.NodeClass.NodeClassIterator; +import com.oracle.max.graal.graph.NodeClass.Position; import com.oracle.max.graal.graph.collections.*; import com.oracle.max.graal.graph.collections.NodeWorkList.InfiniteWorkException; @@ -128,7 +129,7 @@ public static interface ColorSplitingLambda { void fixSplit(Node oldNode, Node newNode, T color); void fixNode(Node node, T color); - Value fixPhiInput(Value input, T color); + ValueNode fixPhiInput(ValueNode input, T color); boolean explore(Node n); List parentColors(T color); Merge merge(T color); @@ -151,11 +152,11 @@ Phi phi = (Phi) node; Merge merge = phi.merge(); for (int i = 0; i < phi.valueCount(); i++) { - Value v = phi.valueAt(i); + ValueNode v = phi.valueAt(i); if (v != null) { T color = internalColoring.get(merge.phiPredecessorAt(i)); if (color != null) { - Value replace = lambda.fixPhiInput(v, color); + ValueNode replace = lambda.fixPhiInput(v, color); if (replace != v) { phi.setValueAt(i, replace); } else { @@ -179,7 +180,7 @@ Phi phi = (Phi) usage; Merge merge = phi.merge(); for (int i = 0; i < phi.valueCount(); i++) { - Value v = phi.valueAt(i); + ValueNode v = phi.valueAt(i); if (v == node) { T color = internalColoring.get(merge.phiPredecessorAt(i)); if (color != null) { @@ -229,10 +230,10 @@ colorQueue.offer(color); continue; } - Phi phi = new Phi(((Value) node).kind, lambda.merge(color), PhiType.Value, node.graph()); + Phi phi = new Phi(((ValueNode) node).kind, lambda.merge(color), PhiType.Value, node.graph()); for (T parentColor : parentColors) { Node input = newNodes.get(parentColor); - phi.addInput((Value) input); + phi.addInput((ValueNode) input); } newNode = phi; } else { @@ -258,11 +259,11 @@ Phi phi = (Phi) usage; Merge merge = phi.merge(); for (int i = 0; i < phi.valueCount(); i++) { - Value v = phi.valueAt(i); + ValueNode v = phi.valueAt(i); if (v == node) { T uColor = internalColoring.get(merge.endAt(i)); if (uColor == color) { - phi.setValueAt(i, (Value) newNode); + phi.setValueAt(i, (ValueNode) newNode); } } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,14 +27,15 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.ir.Phi.*; +import com.oracle.max.graal.compiler.ir.Phi.PhiType; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.GraphUtil.ColorSplitingLambda; import com.oracle.max.graal.compiler.util.GraphUtil.ColoringLambda; -import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; -import com.oracle.max.graal.graph.NodeClass.*; +import com.oracle.max.graal.graph.NodeClass.NodeClassIterator; +import com.oracle.max.graal.graph.NodeClass.Position; import com.oracle.max.graal.graph.collections.*; import com.sun.cri.ci.*; @@ -249,7 +250,7 @@ //rewire phi usage in peeled part int backIndex = loopBegin.phiPredecessorIndex(loopBegin.loopEnd()); for (Phi phi : loopBegin.phis()) { - Value backValue = phi.valueAt(backIndex); + ValueNode backValue = phi.valueAt(backIndex); if (loop.nodes().isMarked(backValue) && peeling.peeledNodes.isNotNewNotMarked(backValue)) { for (Node usage : phi.usages().snapshot()) { if (peeling.peeledNodes.isNotNewMarked(usage)) { @@ -332,7 +333,7 @@ for (Entry entry : peeling.phis.entries()) { Phi phi = (Phi) entry.getKey(); Placeholder p = entry.getValue(); - Value init = phi.valueAt(phiInitIndex); + ValueNode init = phi.valueAt(phiInitIndex); p.replaceAndDelete(init); for (Entry dataEntry : peeling.dataOut.entries()) { if (dataEntry.getValue() == p) { @@ -343,7 +344,7 @@ for (Entry entry : peeling.phiInits.entries()) { Phi phi = (Phi) entry.getKey(); Node newInit = entry.getValue(); - phi.setValueAt(phiInitIndex, (Value) newInit); + phi.setValueAt(phiInitIndex, (ValueNode) newInit); } if (from == loopBegin.loopEnd()) { @@ -351,7 +352,7 @@ iv.peelOneIteration(); } } - NodeMap> newExitValues = graph.createNodeMap(); + NodeMap> newExitValues = graph.createNodeMap(); List exitPoints = new LinkedList(); for (Node exit : peeling.unaffectedExits) { exitPoints.add(exit); @@ -384,12 +385,12 @@ for (Entry dataEntry : peeling.dataOut.entries()) { Node originalValue = dataEntry.getKey(); Node newValue = dataEntry.getValue(); - NodeMap phiMap = newExitValues.get(originalValue); + NodeMap phiMap = newExitValues.get(originalValue); if (phiMap == null) { phiMap = graph.createNodeMap(); newExitValues.set(originalValue, phiMap); } - Value backValue = null; + ValueNode backValue = null; if (inversion && originalValue instanceof Phi && ((Phi) originalValue).merge() == loopBegin) { backValue = ((Phi) originalValue).valueAt(phiBackIndex); if (peeling.peeledNodes.isNotNewMarked(backValue)) { @@ -399,9 +400,9 @@ if (backValue != null) { phiMap.set(original, backValue); } else { - phiMap.set(original, (Value) originalValue); + phiMap.set(original, (ValueNode) originalValue); } - phiMap.set(newExit, (Value) newValue); + phiMap.set(newExit, (ValueNode) newValue); } } @@ -414,11 +415,11 @@ exitMergesPhis.markAll(merge.phis()); } for (Entry entry : peeling.dataOut.entries()) { - Value originalValue = (Value) entry.getKey(); + ValueNode originalValue = (ValueNode) entry.getKey(); if (originalValue instanceof Phi && ((Phi) originalValue).merge() == loopBegin) { continue; } - Value newValue = (Value) entry.getValue(); + ValueNode newValue = (ValueNode) entry.getValue(); Phi phi = null; for (Node usage : originalValue.usages().snapshot()) { if (exitMergesPhis.isMarked(usage) || ( @@ -430,7 +431,7 @@ phi = new Phi(originalValue.kind, loopBegin, PhiType.Value, graph); phi.addInput(newValue); phi.addInput(originalValue); - NodeMap exitMap = newExitValues.get(originalValue); + NodeMap exitMap = newExitValues.get(originalValue); for (Node exit : peeling.unaffectedExits) { exitMap.set(exit, phi); } @@ -441,9 +442,9 @@ } } - for (Entry> entry : newExitValues.entries()) { - Value original = (Value) entry.getKey(); - NodeMap pointToValue = entry.getValue(); + for (Entry> entry : newExitValues.entries()) { + ValueNode original = (ValueNode) entry.getKey(); + NodeMap pointToValue = entry.getValue(); for (Node exit : exitPoints) { Node valueAtExit = pointToValue.get(exit); if (valueAtExit == null) { @@ -455,7 +456,7 @@ replaceValuesAtLoopExits(newExitValues, loop, exitPoints, peeling.exitFrameStates); } - private static void replaceValuesAtLoopExits(final NodeMap> newExitValues, Loop loop, List exitPoints, final NodeBitMap exitFrameStates) { + private static void replaceValuesAtLoopExits(final NodeMap> newExitValues, Loop loop, List exitPoints, final NodeBitMap exitFrameStates) { Graph graph = loop.loopBegin().graph(); final NodeMap colors = graph.createNodeMap(); @@ -517,17 +518,17 @@ assert color != null; this.fixNode(newNode, color); } - private Value getValueAt(Node point, NodeMap valueMap, CiKind kind) { - Value value = valueMap.get(point); + private ValueNode getValueAt(Node point, NodeMap valueMap, CiKind kind) { + ValueNode value = valueMap.get(point); if (value != null) { return value; } Merge merge = (Merge) point; - ArrayList values = new ArrayList(merge.phiPredecessorCount()); - Value v = null; + ArrayList values = new ArrayList(merge.phiPredecessorCount()); + ValueNode v = null; boolean createPhi = false; for (EndNode end : merge.cfgPredecessors()) { - Value valueAt = getValueAt(colors.get(end), valueMap, kind); + ValueNode valueAt = getValueAt(colors.get(end), valueMap, kind); if (v == null) { v = valueAt; } else if (v != valueAt) { @@ -587,20 +588,20 @@ if (input == null || newExitValues.isNew(input)) { continue; } - NodeMap valueMap = newExitValues.get(input); + NodeMap valueMap = newExitValues.get(input); if (valueMap != null) { - Value replacement = getValueAt(color, valueMap, ((Value) input).kind); + ValueNode replacement = getValueAt(color, valueMap, ((ValueNode) input).kind); node.getNodeClass().set(node, pos, replacement); } } } } @Override - public Value fixPhiInput(Value input, Node color) { + public ValueNode fixPhiInput(ValueNode input, Node color) { if (newExitValues.isNew(input)) { return input; } - NodeMap valueMap = newExitValues.get(input); + NodeMap valueMap = newExitValues.get(input); if (valueMap != null) { return getValueAt(color, valueMap, input.kind); } @@ -701,7 +702,7 @@ int backIndex = loopBegin.phiPredecessorIndex(loopBegin.loopEnd()); int fowardIndex = loopBegin.phiPredecessorIndex(loopBegin.forwardEdge()); for (Phi phi : loopBegin.phis()) { - Value backValue = phi.valueAt(backIndex); + ValueNode backValue = phi.valueAt(backIndex); if (marked.isMarked(backValue)) { phiInits.set(phi, duplicates.get(backValue)); } else if (from == loopBegin.loopEnd()) { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,6 +27,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -370,7 +371,7 @@ * Determines if the kinds of two given IR nodes are equal at the {@linkplain #archKind(CiKind) architecture} * level in the context of the {@linkplain GraalCompilation#compilation()} compilation. */ - public static boolean archKindsEqual(Value i, Value other) { + public static boolean archKindsEqual(ValueNode i, ValueNode other) { return archKindsEqual(i.kind, other.kind); } @@ -417,12 +418,12 @@ /** * Converts a given instruction to a value string. The representation of an instruction as * a value is formed by concatenating the {@linkplain com.sun.cri.ci.CiKind#typeChar character} denoting its - * {@linkplain Value#kind kind} and its {@linkplain Value#id()}. For example, {@code "i13"}. + * {@linkplain ValueNode#kind kind} and its {@linkplain ValueNode#id()}. For example, {@code "i13"}. * * @param value the instruction to convert to a value string. If {@code value == null}, then "-" is returned. * @return the instruction representation as a string */ - public static String valueString(Value value) { + public static String valueString(ValueNode value) { return (value == null) ? "-" : ("" + value.kind.typeChar + value.id()); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java Tue Aug 09 21:50:58 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,693 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler.value; - -import static com.oracle.max.graal.compiler.value.ValueUtil.*; - -import java.util.*; - -import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.ir.Phi.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - -/** - * The {@code FrameState} class encapsulates the frame state (i.e. local variables and - * operand stack) at a particular point in the abstract interpretation. - */ -public final class FrameState extends Value implements FrameStateAccess { - - protected final int localsSize; - - protected final int stackSize; - - protected final int locksSize; - - private boolean rethrowException; - - public static final int BEFORE_BCI = -2; - public static final int AFTER_BCI = -3; - - @Input private FrameState outerFrameState; - - @Input private final NodeInputList values; - - @Input private final NodeInputList virtualObjectMappings; - - public FrameState outerFrameState() { - return outerFrameState; - } - - public void setOuterFrameState(FrameState x) { - updateUsages(this.outerFrameState, x); - this.outerFrameState = x; - } - - @Override - public void setValueAt(int i, Value x) { - values.set(i, x); - } - - /** - * The bytecode index to which this frame state applies. This will be {@code -1} - * iff this state is mutable. - */ - public final int bci; - - public final RiMethod method; - - /** - * Creates a {@code FrameState} for the given scope and maximum number of stack and local variables. - * - * @param bci the bytecode index of the frame state - * @param localsSize number of locals - * @param stackSize size of the stack - * @param lockSize number of locks - */ - public FrameState(RiMethod method, int bci, int localsSize, int stackSize, int locksSize, boolean rethrowException, Graph graph) { - super(CiKind.Illegal, graph); - this.method = method; - this.bci = bci; - this.localsSize = localsSize; - this.stackSize = stackSize; - this.locksSize = locksSize; - this.values = new NodeInputList(this, localsSize + stackSize + locksSize); - this.virtualObjectMappings = new NodeInputList(this); - this.rethrowException = rethrowException; - GraalMetrics.FrameStatesCreated++; - GraalMetrics.FrameStateValuesCreated += localsSize + stackSize + locksSize; - } - - FrameState(RiMethod method, int bci, Value[] locals, Value[] stack, int stackSize, ArrayList locks, boolean rethrowException, Graph graph) { - this(method, bci, locals.length, stackSize, locks.size(), rethrowException, graph); - for (int i = 0; i < locals.length; i++) { - setValueAt(i, locals[i]); - } - for (int i = 0; i < stackSize; i++) { - setValueAt(localsSize + i, stack[i]); - } - for (int i = 0; i < locks.size(); i++) { - setValueAt(locals.length + stackSize + i, locks.get(i)); - } - } - - public boolean rethrowException() { - return rethrowException; - } - - public RiMethod method() { - return method; - } - - public void addVirtualObjectMapping(Node virtualObject) { - assert virtualObject instanceof VirtualObjectField || virtualObject instanceof Phi : virtualObject; - virtualObjectMappings.add(virtualObject); - } - - public int virtualObjectMappingCount() { - return virtualObjectMappings.size(); - } - - public Node virtualObjectMappingAt(int i) { - return virtualObjectMappings.get(i); - } - - public Iterable virtualObjectMappings() { - return virtualObjectMappings; - } - - /** - * Gets a copy of this frame state. - */ - public FrameState duplicate(int bci) { - return duplicate(bci, false); - } - - public FrameState duplicate(int bci, boolean duplicateOuter) { - FrameState other = new FrameState(method, bci, localsSize, stackSize, locksSize, rethrowException, graph()); - other.values.setAll(values); - other.virtualObjectMappings.setAll(virtualObjectMappings); - FrameState outerFrameState = outerFrameState(); - if (duplicateOuter && outerFrameState != null) { - outerFrameState = outerFrameState.duplicate(outerFrameState.bci, duplicateOuter); - } - other.setOuterFrameState(outerFrameState); - return other; - } - - @Override - public FrameState duplicateWithException(int bci, Value exceptionObject) { - return duplicateModified(bci, true, CiKind.Void, exceptionObject); - } - - /** - * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the - * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long - * or double is followed by a null slot. - */ - public FrameState duplicateModified(int bci, boolean rethrowException, CiKind popKind, Value... pushedValues) { - int popSlots = popKind.sizeInSlots(); - int pushSlots = pushedValues.length; - FrameState other = new FrameState(method, bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), rethrowException, graph()); - for (int i = 0; i < localsSize; i++) { - other.setValueAt(i, localAt(i)); - } - for (int i = 0; i < stackSize - popSlots; i++) { - other.setValueAt(localsSize + i, stackAt(i)); - } - int slot = localsSize + stackSize - popSlots; - for (int i = 0; i < pushSlots; i++) { - other.setValueAt(slot++, pushedValues[i]); - } - for (int i = 0; i < locksSize; i++) { - other.setValueAt(localsSize + other.stackSize + i, lockAt(i)); - } - other.virtualObjectMappings.setAll(virtualObjectMappings); - other.setOuterFrameState(outerFrameState()); - return other; - } - - public boolean isCompatibleWith(FrameStateAccess other) { - if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { - return false; - } - for (int i = 0; i < stackSize(); i++) { - Value x = stackAt(i); - Value y = other.stackAt(i); - if (x != y && typeMismatch(x, y)) { - return false; - } - } - for (int i = 0; i < locksSize(); i++) { - if (lockAt(i) != other.lockAt(i)) { - return false; - } - } - if (other.outerFrameState() != outerFrameState()) { - return false; - } - return true; - } - - public boolean equals(FrameStateAccess other) { - if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { - return false; - } - for (int i = 0; i < stackSize(); i++) { - Value x = stackAt(i); - Value y = other.stackAt(i); - if (x != y) { - return false; - } - } - for (int i = 0; i < locksSize(); i++) { - if (lockAt(i) != other.lockAt(i)) { - return false; - } - } - if (other.outerFrameState() != outerFrameState()) { - return false; - } - return true; - } - - /** - * Gets the size of the local variables. - */ - public int localsSize() { - return localsSize; - } - - /** - * Gets the current size (height) of the stack. - */ - public int stackSize() { - return stackSize; - } - - /** - * Gets number of locks held by this frame state. - */ - public int locksSize() { - return locksSize; - } - - /** - * Invalidates the local variable at the specified index. If the specified index refers to a doubleword local, then - * invalidates the high word as well. - * - * @param i the index of the local to invalidate - */ - public void invalidateLocal(int i) { - // note that for double word locals, the high slot should already be null - // unless the local is actually dead and the high slot is being reused; - // in either case, it is not necessary to null the high slot - setValueAt(i, null); - } - - /** - * Stores a given local variable at the specified index. If the value is a {@linkplain CiKind#isDoubleWord() double word}, - * then the next local variable index is also overwritten. - * - * @param i the index at which to store - * @param x the instruction which produces the value for the local - */ - public void storeLocal(int i, Value x) { - assert i < localsSize : "local variable index out of range: " + i; - invalidateLocal(i); - setValueAt(i, x); - if (isDoubleWord(x)) { - // (tw) if this was a double word then kill i+1 - setValueAt(i + 1, null); - } - if (i > 0) { - // if there was a double word at i - 1, then kill it - Value p = localAt(i - 1); - if (isDoubleWord(p)) { - setValueAt(i - 1, null); - } - } - } - - /** - * Gets the value in the local variables at the specified index. - * - * @param i the index into the locals - * @return the instruction that produced the value for the specified local - */ - public Value localAt(int i) { - assert i < localsSize : "local variable index out of range: " + i; - return valueAt(i); - } - - /** - * Get the value on the stack at the specified stack index. - * - * @param i the index into the stack, with {@code 0} being the bottom of the stack - * @return the instruction at the specified position in the stack - */ - public Value stackAt(int i) { - assert i >= 0 && i < (localsSize + stackSize); - return valueAt(localsSize + i); - } - - /** - * Retrieves the lock at the specified index in the lock stack. - * @param i the index into the lock stack - * @return the instruction which produced the object at the specified location in the lock stack - */ - public Value lockAt(int i) { - assert i >= 0; - return valueAt(localsSize + stackSize + i); - } - - /** - * Inserts a phi statement into the stack at the specified stack index. - * @param block the block begin for which we are creating the phi - * @param i the index into the stack for which to create a phi - */ - public Phi setupPhiForStack(Merge block, int i) { - Value p = stackAt(i); - if (p != null) { - if (p instanceof Phi) { - Phi phi = (Phi) p; - if (phi.merge() == block) { - return phi; - } - } - Phi phi = new Phi(p.kind, block, PhiType.Value, graph()); - setValueAt(localsSize + i, phi); - return phi; - } - return null; - } - - /** - * Inserts a phi statement for the local at the specified index. - * @param block the block begin for which we are creating the phi - * @param i the index of the local variable for which to create the phi - */ - public Phi setupPhiForLocal(Merge block, int i) { - Value p = localAt(i); - if (p instanceof Phi) { - Phi phi = (Phi) p; - if (phi.merge() == block) { - return phi; - } - } - Phi phi = new Phi(p.kind, block, PhiType.Value, graph()); - storeLocal(i, phi); - return phi; - } - - /** - * Gets the value at a specified index in the set of operand stack and local values represented by this frame. - * This method should only be used to iterate over all the values in this frame, irrespective of whether - * they are on the stack or in local variables. - * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. - * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. - * - * @param i a value in the range {@code [0 .. valuesSize()]} - * @return the value at index {@code i} which may be {@code null} - */ - public Value valueAt(int i) { - assert i < (localsSize + stackSize + locksSize); - return values.isEmpty() ? null : values.get(i); - } - - /** - * The number of operand stack slots and local variables in this frame. - * This method should typically only be used in conjunction with {@link #valueAt(int)}. - * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. - * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. - * - * @return the number of local variables in this frame - */ - public int valuesSize() { - return localsSize + stackSize; - } - - private void checkSize(FrameStateAccess other) { - if (other.stackSize() != stackSize()) { - throw new CiBailout("stack sizes do not match"); - } else if (other.localsSize() != localsSize) { - throw new CiBailout("local sizes do not match"); - } - } - - public void merge(Merge block, FrameStateAccess other) { - checkSize(other); - for (int i = 0; i < valuesSize(); i++) { - Value x = valueAt(i); - if (x != null) { - Value y = other.valueAt(i); - if (x != y || ((x instanceof Phi) && ((Phi) x).merge() == block)) { - if (typeMismatch(x, y)) { - if ((x instanceof Phi) && ((Phi) x).merge() == block) { - x.replaceAtUsages(null); - x.delete(); - } - setValueAt(i, null); - continue; - } - Phi phi = null; - if (i < localsSize) { - // this a local - phi = setupPhiForLocal(block, i); - } else { - // this is a stack slot - phi = setupPhiForStack(block, i - localsSize); - } - - if (phi.valueCount() == 0) { - int size = block.phiPredecessorCount(); - for (int j = 0; j < size; ++j) { - phi.addInput(x); - } - phi.addInput((x == y) ? phi : y); - } else { - phi.addInput((x == y) ? phi : y); - } - - assert phi.valueCount() == block.phiPredecessorCount() + (block instanceof LoopBegin ? 0 : 1) : "valueCount=" + phi.valueCount() + " predSize= " + block.phiPredecessorCount(); - } - } - } - } - - public Merge block() { - for (Node n : usages()) { - if (n instanceof Merge) { - return (Merge) n; - } - } - return null; - } - - public StateSplit stateSplit() { - for (Node n : usages()) { - if (n instanceof StateSplit) { - return (StateSplit) n; - } - } - return null; - } - - public Iterable innerFrameStates() { - final Iterator iterator = usages().iterator(); - return new Iterable() { - @Override - public Iterator iterator() { - return new Iterator() { - private Node next; - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - @Override - public FrameState next() { - forward(); - if (!hasNext()) { - throw new NoSuchElementException(); - } - FrameState res = (FrameState) next; - next = null; - return res; - } - @Override - public boolean hasNext() { - forward(); - return next != null; - } - private void forward() { - while (!(next instanceof FrameState) && iterator.hasNext()) { - next = iterator.next(); - } - } - }; - } - }; - } - - /** - * The interface implemented by a client of {@link FrameState#forEachPhi(Merge, PhiProcedure)} and - * {@link FrameState#forEachLivePhi(Merge, PhiProcedure)}. - */ - public static interface PhiProcedure { - boolean doPhi(Phi phi); - } - - /** - * Checks whether this frame state has any {@linkplain Phi phi} statements. - */ - public boolean hasPhis() { - for (int i = 0; i < valuesSize(); i++) { - Value value = valueAt(i); - if (value instanceof Phi) { - return true; - } - } - return false; - } - - /** - * The interface implemented by a client of {@link FrameState#forEachLiveStateValue(ValueProcedure)}. - */ - public static interface ValueProcedure { - void doValue(Value value); - } - - /** - * Traverses all {@linkplain Value#isLive() live values} of this frame state. - * - * @param proc the call back called to process each live value traversed - */ - public void forEachLiveStateValue(ValueProcedure proc) { - HashSet vobjs = null; - FrameState current = this; - do { - for (int i = 0; i < current.valuesSize(); i++) { - Value value = current.valueAt(i); - if (value instanceof VirtualObject) { - if (vobjs == null) { - vobjs = new HashSet(); - } - vobjs.add((VirtualObject) value); - } else if (value != null) { - proc.doValue(value); - } - } - current = current.outerFrameState(); - } while (current != null); - - if (vobjs != null) { - // collect all VirtualObjectField instances: - HashMap objectStates = new HashMap(); - current = this; - do { - for (int i = 0; i < current.virtualObjectMappingCount(); i++) { - VirtualObjectField field = (VirtualObjectField) current.virtualObjectMappingAt(i); - // null states occur for objects with 0 fields - if (field != null && !objectStates.containsKey(field.object())) { - objectStates.put(field.object(), field); - } - } - current = current.outerFrameState(); - } while (current != null); - - do { - HashSet vobjsCopy = new HashSet(vobjs); - for (VirtualObject vobj : vobjsCopy) { - if (vobj.fields().length > 0) { - boolean[] fieldState = new boolean[vobj.fields().length]; - FloatingNode currentField = objectStates.get(vobj); - assert currentField != null : this; - do { - if (currentField instanceof VirtualObjectField) { - int index = ((VirtualObjectField) currentField).index(); - Value value = ((VirtualObjectField) currentField).input(); - if (!fieldState[index]) { - fieldState[index] = true; - if (value instanceof VirtualObject) { - vobjs.add((VirtualObject) value); - } else { - proc.doValue(value); - } - } - currentField = ((VirtualObjectField) currentField).lastState(); - } else { - assert currentField instanceof Phi : currentField; - currentField = (FloatingNode) ((Phi) currentField).valueAt(0); - } - } while (currentField != null); - } - vobjs.remove(vobj); - } - } while (!vobjs.isEmpty()); - if (!vobjs.isEmpty()) { - for (VirtualObject obj : vobjs) { - TTY.println("+" + obj); - } - for (Node vobj : virtualObjectMappings()) { - if (vobj instanceof VirtualObjectField) { - TTY.println("-" + ((VirtualObjectField) vobj).object()); - } else { - TTY.println("-" + vobj); - } - } - for (Node n : this.usages()) { - TTY.println("usage: " + n); - } - } - assert vobjs.isEmpty() : "at FrameState " + this; - } - } - - @Override - public String toString() { - return super.toString(); - } - - public String toDetailedString() { - StringBuilder sb = new StringBuilder(); - String nl = String.format("%n"); - sb.append("[bci: ").append(bci).append("]"); - if (rethrowException()) { - sb.append(" rethrows Exception"); - } - sb.append(nl); - for (int i = 0; i < localsSize(); ++i) { - Value value = localAt(i); - sb.append(String.format(" local[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); - } - for (int i = 0; i < stackSize(); ++i) { - Value value = stackAt(i); - sb.append(String.format(" stack[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); - } - for (int i = 0; i < locksSize(); ++i) { - Value value = lockAt(i); - sb.append(String.format(" lock[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); - } - return sb.toString(); - } - - @Override - public void accept(ValueVisitor v) { - v.visitFrameState(this); - } - - @Override - public void print(LogStream out) { - out.print("FrameState"); - } - - @Override - public String shortName() { - return "FrameState@" + bci; - } - - public void visitFrameState(FrameState i) { - // nothing to do for now - } - - @Override - public Map getDebugProperties() { - Map properties = super.getDebugProperties(); - properties.put("bci", bci); - properties.put("method", CiUtil.format("%H.%n(%p):%r", method, false)); - StringBuilder str = new StringBuilder(); - for (int i = 0; i < localsSize(); i++) { - str.append(i == 0 ? "" : ", ").append(localAt(i) == null ? "_" : localAt(i).id()); - } - properties.put("locals", str.toString()); - str = new StringBuilder(); - for (int i = 0; i < stackSize(); i++) { - str.append(i == 0 ? "" : ", ").append(stackAt(i) == null ? "_" : stackAt(i).id()); - } - properties.put("stack", str.toString()); - str = new StringBuilder(); - for (int i = 0; i < locksSize(); i++) { - str.append(i == 0 ? "" : ", ").append(lockAt(i) == null ? "_" : lockAt(i).id()); - } - properties.put("locks", str.toString()); - properties.put("rethrowException", rethrowException); - return properties; - } - - @Override - public void delete() { - FrameState outerFrameState = outerFrameState(); - super.delete(); - if (outerFrameState != null && outerFrameState.usages().isEmpty()) { - outerFrameState.delete(); - } - } - - @Override - public void setRethrowException(boolean b) { - rethrowException = b; - } -} diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateAccess.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateAccess.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateAccess.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.value; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; public interface FrameStateAccess { @@ -36,20 +36,20 @@ boolean rethrowException(); - Value valueAt(int i); + ValueNode valueAt(int i); - Value localAt(int i); + ValueNode localAt(int i); - Value lockAt(int i); + ValueNode lockAt(int i); - Value stackAt(int i); + ValueNode stackAt(int i); - void setValueAt(int j, Value v); + void setValueAt(int j, ValueNode v); void setRethrowException(boolean b); - Value outerFrameState(); + ValueNode outerFrameState(); - FrameState duplicateWithException(int bci, Value exceptionObject); + FrameState duplicateWithException(int bci, ValueNode exceptionObject); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateBuilder.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateBuilder.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateBuilder.java Tue Aug 09 23:56:10 2011 +0200 @@ -29,6 +29,7 @@ import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.ir.Phi.PhiType; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -38,9 +39,9 @@ private final Graph graph; - private final Value[] locals; - private final Value[] stack; - private final ArrayList locks; + private final ValueNode[] locals; + private final ValueNode[] stack; + private final ArrayList locks; private int stackIndex; private boolean rethrowException; @@ -50,10 +51,10 @@ public FrameStateBuilder(FrameState fs) { this.method = fs.method; this.graph = fs.graph(); - this.locals = new Value[method.maxLocals()]; + this.locals = new ValueNode[method.maxLocals()]; int stackSize = Math.max(1, method.maxStackSize()); - this.stack = new Value[stackSize]; - this.locks = new ArrayList(); + this.stack = new ValueNode[stackSize]; + this.locks = new ArrayList(); this.initializeFrom(fs); } @@ -61,10 +62,10 @@ assert graph != null; this.method = method; this.graph = graph; - this.locals = new Value[method.maxLocals()]; + this.locals = new ValueNode[method.maxLocals()]; // we always need at least one stack slot (for exceptions) int stackSize = Math.max(1, method.maxStackSize()); - this.stack = new Value[stackSize]; + this.stack = new ValueNode[stackSize]; int javaIndex = 0; int index = 0; @@ -90,7 +91,7 @@ javaIndex += kind.sizeInSlots(); index++; } - this.locks = new ArrayList(); + this.locks = new ArrayList(); } @Override @@ -120,8 +121,8 @@ return new FrameState(method, bci, locals, stack, stackIndex, locks, rethrowException, graph); } - public FrameState duplicateWithException(int bci, Value exceptionObject) { - FrameState frameState = new FrameState(method, bci, locals, new Value[]{exceptionObject}, 1, locks, true, graph); + public FrameState duplicateWithException(int bci, ValueNode exceptionObject) { + FrameState frameState = new FrameState(method, bci, locals, new ValueNode[]{exceptionObject}, 1, locks, true, graph); frameState.setOuterFrameState(outerFrameState()); return frameState; } @@ -131,7 +132,7 @@ * @param kind the type expected for this instruction * @param x the instruction to push onto the stack */ - public void push(CiKind kind, Value x) { + public void push(CiKind kind, ValueNode x) { assert kind != CiKind.Void; xpush(assertKind(kind, x)); if (kind.sizeInSlots() == 2) { @@ -143,7 +144,7 @@ * Pushes a value onto the stack without checking the type. * @param x the instruction to push onto the stack */ - public void xpush(Value x) { + public void xpush(ValueNode x) { assert x == null || !x.isDeleted(); stack[stackIndex++] = x; } @@ -152,7 +153,7 @@ * Pushes a value onto the stack and checks that it is an int. * @param x the instruction to push onto the stack */ - public void ipush(Value x) { + public void ipush(ValueNode x) { xpush(assertInt(x)); } @@ -160,7 +161,7 @@ * Pushes a value onto the stack and checks that it is a float. * @param x the instruction to push onto the stack */ - public void fpush(Value x) { + public void fpush(ValueNode x) { xpush(assertFloat(x)); } @@ -168,7 +169,7 @@ * Pushes a value onto the stack and checks that it is an object. * @param x the instruction to push onto the stack */ - public void apush(Value x) { + public void apush(ValueNode x) { xpush(assertObject(x)); } @@ -176,7 +177,7 @@ * Pushes a value onto the stack and checks that it is a word. * @param x the instruction to push onto the stack */ - public void wpush(Value x) { + public void wpush(ValueNode x) { xpush(assertWord(x)); } @@ -184,7 +185,7 @@ * Pushes a value onto the stack and checks that it is a JSR return address. * @param x the instruction to push onto the stack */ - public void jpush(Value x) { + public void jpush(ValueNode x) { xpush(assertJsr(x)); } @@ -193,7 +194,7 @@ * * @param x the instruction to push onto the stack */ - public void lpush(Value x) { + public void lpush(ValueNode x) { xpush(assertLong(x)); xpush(null); } @@ -202,12 +203,12 @@ * Pushes a value onto the stack and checks that it is a double. * @param x the instruction to push onto the stack */ - public void dpush(Value x) { + public void dpush(ValueNode x) { xpush(assertDouble(x)); xpush(null); } - public void pushReturn(CiKind kind, Value x) { + public void pushReturn(CiKind kind, ValueNode x) { if (kind != CiKind.Void) { push(kind.stackKind(), x); } @@ -218,7 +219,7 @@ * @param kind the expected type * @return the instruction on the top of the stack */ - public Value pop(CiKind kind) { + public ValueNode pop(CiKind kind) { assert kind != CiKind.Void; if (kind.sizeInSlots() == 2) { xpop(); @@ -230,8 +231,8 @@ * Pops a value off of the stack without checking the type. * @return x the instruction popped off the stack */ - public Value xpop() { - Value result = stack[--stackIndex]; + public ValueNode xpop() { + ValueNode result = stack[--stackIndex]; assert result == null || !result.isDeleted(); return result; } @@ -240,7 +241,7 @@ * Pops a value off of the stack and checks that it is an int. * @return x the instruction popped off the stack */ - public Value ipop() { + public ValueNode ipop() { return assertInt(xpop()); } @@ -248,7 +249,7 @@ * Pops a value off of the stack and checks that it is a float. * @return x the instruction popped off the stack */ - public Value fpop() { + public ValueNode fpop() { return assertFloat(xpop()); } @@ -256,7 +257,7 @@ * Pops a value off of the stack and checks that it is an object. * @return x the instruction popped off the stack */ - public Value apop() { + public ValueNode apop() { return assertObject(xpop()); } @@ -264,7 +265,7 @@ * Pops a value off of the stack and checks that it is a word. * @return x the instruction popped off the stack */ - public Value wpop() { + public ValueNode wpop() { return assertWord(xpop()); } @@ -272,7 +273,7 @@ * Pops a value off of the stack and checks that it is a JSR return address. * @return x the instruction popped off the stack */ - public Value jpop() { + public ValueNode jpop() { return assertJsr(xpop()); } @@ -280,7 +281,7 @@ * Pops a value off of the stack and checks that it is a long. * @return x the instruction popped off the stack */ - public Value lpop() { + public ValueNode lpop() { assertHigh(xpop()); return assertLong(xpop()); } @@ -289,7 +290,7 @@ * Pops a value off of the stack and checks that it is a double. * @return x the instruction popped off the stack */ - public Value dpop() { + public ValueNode dpop() { assertHigh(xpop()); return assertDouble(xpop()); } @@ -299,9 +300,9 @@ * @param size the number of arguments off of the stack * @return an array containing the arguments off of the stack */ - public Value[] popArguments(int size) { + public ValueNode[] popArguments(int size) { int base = stackIndex - size; - Value[] r = new Value[size]; + ValueNode[] r = new ValueNode[size]; for (int i = 0; i < size; ++i) { assert stack[base + i] != null || stack[base + i - 1].kind.jvmSlots == 2; r[i] = stack[base + i]; @@ -311,7 +312,7 @@ } public CiKind peekKind() { - Value top = stackAt(stackSize() - 1); + ValueNode top = stackAt(stackSize() - 1); if (top == null) { top = stackAt(stackSize() - 2); assert top != null; @@ -342,8 +343,8 @@ * @param i the index of the local variable to load * @return the instruction that produced the specified local */ - public Value loadLocal(int i) { - Value x = locals[i]; + public ValueNode loadLocal(int i) { + ValueNode x = locals[i]; if (x != null) { if (x instanceof Phi) { assert ((Phi) x).type() == PhiType.Value; @@ -363,7 +364,7 @@ * @param i the index at which to store * @param x the instruction which produces the value for the local */ - public void storeLocal(int i, Value x) { + public void storeLocal(int i, ValueNode x) { locals[i] = x; if (isDoubleWord(x)) { // (tw) if this was a double word then kill i+1 @@ -371,7 +372,7 @@ } if (i > 0) { // if there was a double word at i - 1, then kill it - Value p = locals[i - 1]; + ValueNode p = locals[i - 1]; if (isDoubleWord(p)) { locals[i - 1] = null; } @@ -383,7 +384,7 @@ * @param scope the IRScope in which this locking operation occurs * @param obj the object being locked */ - public void lock(Value obj) { + public void lock(ValueNode obj) { locks.add(obj); } @@ -400,7 +401,7 @@ * @param i the index into the stack, with {@code 0} being the bottom of the stack * @return the instruction at the specified position in the stack */ - public final Value stackAt(int i) { + public final ValueNode stackAt(int i) { return stack[i]; } @@ -410,7 +411,7 @@ * @param i the index into the locals * @return the instruction that produced the value for the specified local */ - public final Value localAt(int i) { + public final ValueNode localAt(int i) { return locals[i]; } @@ -419,7 +420,7 @@ * @param i the index into the lock stack * @return the instruction which produced the object at the specified location in the lock stack */ - public final Value lockAt(int i) { + public final ValueNode lockAt(int i) { return locks.get(i); } @@ -446,31 +447,31 @@ return stackIndex; } - public Iterator locals() { + public Iterator locals() { return new ValueArrayIterator(locals); } - public Iterator stack() { + public Iterator stack() { return new ValueArrayIterator(locals); } - public List locks() { + public List locks() { return Collections.unmodifiableList(locks); } - private static class ValueArrayIterator implements Iterator { - private final Value[] array; + private static class ValueArrayIterator implements Iterator { + private final ValueNode[] array; private int index; private int length; - public ValueArrayIterator(Value[] array, int length) { + public ValueArrayIterator(ValueNode[] array, int length) { assert length <= array.length; this.array = array; this.index = 0; } - public ValueArrayIterator(Value[] array) { + public ValueArrayIterator(ValueNode[] array) { this(array, array.length); } @@ -480,7 +481,7 @@ } @Override - public Value next() { + public ValueNode next() { return array[index++]; } @@ -498,7 +499,7 @@ } @Override - public Value valueAt(int i) { + public ValueNode valueAt(int i) { if (i < locals.length) { return locals[i]; } else if (i < locals.length + stackIndex) { @@ -509,7 +510,7 @@ } @Override - public void setValueAt(int i, Value v) { + public void setValueAt(int i, ValueNode v) { if (i < locals.length) { locals[i] = v; } else if (i < locals.length + stackIndex) { @@ -525,7 +526,7 @@ } public FrameState duplicateWithoutStack(int bci) { - FrameState frameState = new FrameState(method, bci, locals, new Value[0], 0, locks, false, graph); + FrameState frameState = new FrameState(method, bci, locals, new ValueNode[0], 0, locks, false, graph); frameState.setOuterFrameState(outerFrameState()); return frameState; } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/ValueUtil.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/ValueUtil.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/ValueUtil.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,62 +22,62 @@ */ package com.oracle.max.graal.compiler.value; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.ci.*; public class ValueUtil { - public static Value assertKind(CiKind kind, Value x) { + public static ValueNode assertKind(CiKind kind, ValueNode x) { assert x != null && (x.kind == kind) : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.kind); return x; } - public static Value assertLong(Value x) { + public static ValueNode assertLong(ValueNode x) { assert x != null && (x.kind == CiKind.Long); return x; } - public static Value assertJsr(Value x) { + public static ValueNode assertJsr(ValueNode x) { assert x != null && (x.kind == CiKind.Jsr); return x; } - public static Value assertInt(Value x) { + public static ValueNode assertInt(ValueNode x) { assert x != null && (x.kind == CiKind.Int); return x; } - public static Value assertFloat(Value x) { + public static ValueNode assertFloat(ValueNode x) { assert x != null && (x.kind == CiKind.Float); return x; } - public static Value assertObject(Value x) { + public static ValueNode assertObject(ValueNode x) { assert x != null && (x.kind == CiKind.Object); return x; } - public static Value assertWord(Value x) { + public static ValueNode assertWord(ValueNode x) { assert x != null && (x.kind == CiKind.Word); return x; } - public static Value assertDouble(Value x) { + public static ValueNode assertDouble(ValueNode x) { assert x != null && (x.kind == CiKind.Double); return x; } - public static void assertHigh(Value x) { + public static void assertHigh(ValueNode x) { assert x == null; } - public static boolean typeMismatch(Value x, Value y) { + public static boolean typeMismatch(ValueNode x, ValueNode y) { return y == null || !Util.archKindsEqual(x, y); } - public static boolean isDoubleWord(Value x) { + public static boolean isDoubleWord(ValueNode x) { return x != null && x.kind.isDoubleWord(); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAddNode.java --- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAddNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAddNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,30 +22,31 @@ */ package com.oracle.max.graal.examples.intrinsics; -import com.oracle.max.graal.compiler.gen.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @NodeInfo(shortName = "[+]") public final class SafeAddNode extends IntegerArithmeticNode { - public SafeAddNode(Value x, Value y, Graph graph) { + public SafeAddNode(ValueNode x, ValueNode y, Graph graph) { super(CiKind.Int, Bytecodes.LADD, x, y, graph); } @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { + if (clazz == LIRGeneratorOp.class) { return (T) GENERATOR_OP; } return super.lookup(clazz); } - private static final LIRGenerator.LIRGeneratorOp GENERATOR_OP = new LIRGenerator.LIRGeneratorOp() { + private static final LIRGeneratorOp GENERATOR_OP = new LIRGeneratorOp() { @Override - public void generate(Node n, LIRGenerator generator) { + public void generate(Node n, LIRGeneratorTool generator) { SafeAddNode add = (SafeAddNode) n; generator.integerAdd(add, add.x(), add.y()); generator.deoptimizeOn(Condition.OF); diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/opt/OptimizerImpl.java --- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/opt/OptimizerImpl.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/opt/OptimizerImpl.java Tue Aug 09 23:56:10 2011 +0200 @@ -24,6 +24,7 @@ import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.examples.intrinsics.*; import com.oracle.max.graal.extensions.*; @@ -78,8 +79,8 @@ if (ifNode.compare() instanceof Compare) { Compare compare = (Compare) ifNode.compare(); Condition cond = compare.condition(); - Value x = compare.x(); - Value y = compare.y(); + ValueNode x = compare.x(); + ValueNode y = compare.y(); if (ifNode.trueSuccessor() == pred) { cond = cond.negate(); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotField.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotField.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotField.java Tue Aug 09 23:56:10 2011 +0200 @@ -27,8 +27,7 @@ import com.oracle.max.graal.compiler.*; import com.sun.cri.ci.*; -import com.sun.cri.ri.RiField; -import com.sun.cri.ri.RiType; +import com.sun.cri.ri.*; /** * Represents a field in a HotSpot type. diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java Tue Aug 09 23:56:10 2011 +0200 @@ -30,7 +30,8 @@ import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.ir.Conditional.ConditionalStructure; -import com.oracle.max.graal.compiler.value.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.runtime.nodes.*; import com.sun.cri.bytecode.*; @@ -270,8 +271,8 @@ field.setNext(null); memoryRead.setNext(next); field.replaceAndDelete(memoryRead); - } else if (n instanceof StoreField) { - StoreField field = (StoreField) n; + } else if (n instanceof StoreFieldNode) { + StoreFieldNode field = (StoreFieldNode) n; if (field.isVolatile()) { return; } @@ -304,8 +305,8 @@ loadIndexed.setNext(null); memoryRead.setNext(next); loadIndexed.replaceAndDelete(memoryRead); - } else if (n instanceof StoreIndexed) { - StoreIndexed storeIndexed = (StoreIndexed) n; + } else if (n instanceof StoreIndexedNode) { + StoreIndexedNode storeIndexed = (StoreIndexedNode) n; Graph graph = storeIndexed.graph(); Anchor anchor = new Anchor(graph); GuardNode boundsCheck = createBoundsCheck(storeIndexed, tool); @@ -315,8 +316,8 @@ CiKind elementKind = storeIndexed.elementKind(); LocationNode arrayLocation = createArrayLocation(graph, elementKind); arrayLocation.setIndex(storeIndexed.index()); - Value value = storeIndexed.value(); - Value array = storeIndexed.array(); + ValueNode value = storeIndexed.value(); + ValueNode array = storeIndexed.array(); if (elementKind == CiKind.Object && !value.isNullConstant()) { // Store check! if (array.exactType() != null) { @@ -379,7 +380,7 @@ } } - private ReadNode readArrayElementKlass(Graph graph, Value array) { + private ReadNode readArrayElementKlass(Graph graph, ValueNode array) { ReadNode arrayKlass = readHub(graph, array); ReadNode arrayElementKlass = new ReadNode(CiKind.Object, arrayKlass, LocationNode.create(LocationNode.FINAL_LOCATION, CiKind.Object, config.arrayClassElementOffset, graph), graph); return arrayElementKlass; @@ -416,9 +417,9 @@ Local srcPos = new Local(CiKind.Int, 1, graph); Local dest = new Local(CiKind.Object, 2, graph); Local destPos = new Local(CiKind.Int, 3, graph); - Value length = new Local(CiKind.Int, 4, graph); - src.setDeclaredType(((Value) parameters.get(0)).declaredType()); - dest.setDeclaredType(((Value) parameters.get(2)).declaredType()); + ValueNode length = new Local(CiKind.Int, 4, graph); + src.setDeclaredType(((ValueNode) parameters.get(0)).declaredType()); + dest.setDeclaredType(((ValueNode) parameters.get(2)).declaredType()); if (src.declaredType() == null || dest.declaredType() == null) { return null; @@ -483,11 +484,11 @@ Invoke newInvoke = null; if (componentType == CiKind.Object) { - Value srcClass = readHub(graph, src); - Value destClass = readHub(graph, dest); + ValueNode srcClass = readHub(graph, src); + ValueNode destClass = readHub(graph, dest); If elementClassIf = new If(new Compare(srcClass, Condition.EQ, destClass, graph), 0.5, graph); ifNode.setFalseSuccessor(elementClassIf); - newInvoke = new Invoke(bci, Bytecodes.INVOKESTATIC, CiKind.Void, new Value[]{src, srcPos, dest, destPos, length}, method, method.signature().returnType(method.holder()), graph); + newInvoke = new Invoke(bci, Bytecodes.INVOKESTATIC, CiKind.Void, new ValueNode[]{src, srcPos, dest, destPos, length}, method, method.signature().returnType(method.holder()), graph); newInvoke.setCanInline(false); newInvoke.setStateAfter(stateAfter); elementClassIf.setFalseSuccessor(newInvoke); @@ -627,7 +628,7 @@ return intrinsicGraphs.get(method); } - private ReadNode readHub(Graph graph, Value value) { + private ReadNode readHub(Graph graph, ValueNode value) { return new ReadNode(CiKind.Object, value, LocationNode.create(LocationNode.FINAL_LOCATION, CiKind.Object, config.hubOffset, graph), graph); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotTargetMethod.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotTargetMethod.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotTargetMethod.java Tue Aug 09 23:56:10 2011 +0200 @@ -26,7 +26,9 @@ import com.oracle.max.graal.runtime.logging.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiTargetMethod.*; +import com.sun.cri.ci.CiTargetMethod.ExceptionHandler; +import com.sun.cri.ci.CiTargetMethod.Mark; +import com.sun.cri.ci.CiTargetMethod.Site; /** * CiTargetMethod augmented with HotSpot-specific information. diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java Tue Aug 09 23:56:10 2011 +0200 @@ -30,13 +30,16 @@ import java.util.concurrent.*; import com.oracle.max.asm.target.amd64.*; +import com.sun.cri.ci.CiAddress.Scale; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiAddress.*; -import com.sun.cri.ci.CiRegister.*; +import com.sun.cri.ci.CiRegister.RegisterFlag; import com.sun.cri.ri.*; -import com.sun.cri.ri.RiType.*; +import com.sun.cri.ri.RiType.Representation; import com.sun.cri.xir.*; -import com.sun.cri.xir.CiXirAssembler.*; +import com.sun.cri.xir.CiXirAssembler.XirLabel; +import com.sun.cri.xir.CiXirAssembler.XirMark; +import com.sun.cri.xir.CiXirAssembler.XirOperand; +import com.sun.cri.xir.CiXirAssembler.XirParameter; public class HotSpotXirGenerator implements RiXirGenerator { diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/ArrayWriteBarrier.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/ArrayWriteBarrier.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/ArrayWriteBarrier.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,23 +22,23 @@ */ package com.oracle.max.graal.runtime.nodes; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class ArrayWriteBarrier extends WriteBarrier { - @Input private Value object; + @Input private ValueNode object; @Input private LocationNode location; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(this.object, x); this.object = x; } @@ -52,7 +52,7 @@ location = x; } - public ArrayWriteBarrier(Value object, LocationNode index, Graph graph) { + public ArrayWriteBarrier(ValueNode object, LocationNode index, Graph graph) { super(graph); this.setObject(object); this.setLocation(index); @@ -62,22 +62,17 @@ @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { - return (T) new LIRGenerator.LIRGeneratorOp() { + if (clazz == LIRGeneratorOp.class) { + return (T) new LIRGeneratorOp() { @Override - public void generate(Node n, LIRGenerator generator) { + public void generate(Node n, LIRGeneratorTool generator) { assert n == ArrayWriteBarrier.this; CiVariable temp = generator.newVariable(CiKind.Word); - generator.lir().lea(location().createAddress(generator, object()), temp); + generator.emitLea(location().createAddress(generator, object()), temp); ArrayWriteBarrier.this.generateBarrier(temp, generator); } }; } return super.lookup(clazz); } - - @Override - public void print(LogStream out) { - out.print("field write barrier ").print(object()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/CurrentThread.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/CurrentThread.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/CurrentThread.java Tue Aug 09 23:56:10 2011 +0200 @@ -23,9 +23,8 @@ package com.oracle.max.graal.runtime.nodes; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -42,21 +41,16 @@ @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { - return (T) new LIRGenerator.LIRGeneratorOp() { + if (clazz == LIRGeneratorOp.class) { + return (T) new LIRGeneratorOp() { @Override - public void generate(Node n, LIRGenerator generator) { + public void generate(Node n, LIRGeneratorTool generator) { CurrentThread conv = (CurrentThread) n; CiValue result = generator.createResultVariable(conv); - generator.lir().move(new CiAddress(CiKind.Object, AMD64.r15.asValue(CiKind.Word), threadObjectOffset), result); + generator.emitMove(new CiAddress(CiKind.Object, AMD64.r15.asValue(CiKind.Word), threadObjectOffset), result); } }; } return super.lookup(clazz); } - - @Override - public void print(LogStream out) { - out.print("currentThread"); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FPConversionNode.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FPConversionNode.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FPConversionNode.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,30 +22,27 @@ */ package com.oracle.max.graal.runtime.nodes; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; -import com.oracle.max.graal.compiler.gen.LIRGenerator.LIRGeneratorOp; import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.NotifyReProcess; -import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class FPConversionNode extends FloatingNode implements Canonicalizable { - @Input private Value value; + @Input private ValueNode value; - public Value value() { + public ValueNode value() { return value; } - public void setValue(Value x) { + public void setValue(ValueNode x) { updateUsages(value, x); value = x; } - public FPConversionNode(CiKind kind, Value value, Graph graph) { + public FPConversionNode(CiKind kind, ValueNode value, Graph graph) { super(kind, graph); this.setValue(value); } @@ -59,20 +56,15 @@ return super.lookup(clazz); } - @Override - public void print(LogStream out) { - out.print("fp conversion node ").print(value()); - } - private static final LIRGeneratorOp LIRGEN = new LIRGeneratorOp() { @Override - public void generate(Node n, LIRGenerator generator) { + public void generate(Node n, LIRGeneratorTool generator) { FPConversionNode conv = (FPConversionNode) n; CiValue reg = generator.createResultVariable(conv); CiValue value = generator.load(conv.value()); CiValue tmp = generator.forceToSpill(value, conv.kind, false); - generator.lir().move(tmp, reg); + generator.emitMove(tmp, reg); } }; diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FieldWriteBarrier.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FieldWriteBarrier.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FieldWriteBarrier.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,26 +22,25 @@ */ package com.oracle.max.graal.runtime.nodes; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class FieldWriteBarrier extends WriteBarrier { - @Input private Value object; + @Input private ValueNode object; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } - public FieldWriteBarrier(Value object, Graph graph) { + public FieldWriteBarrier(ValueNode object, Graph graph) { super(graph); this.setObject(object); } @@ -50,22 +49,17 @@ @SuppressWarnings("unchecked") @Override public T lookup(Class clazz) { - if (clazz == LIRGenerator.LIRGeneratorOp.class) { - return (T) new LIRGenerator.LIRGeneratorOp() { + if (clazz == LIRGeneratorOp.class) { + return (T) new LIRGeneratorOp() { @Override - public void generate(Node n, LIRGenerator generator) { + public void generate(Node n, LIRGeneratorTool generator) { assert n == FieldWriteBarrier.this; CiVariable temp = generator.newVariable(CiKind.Word); - generator.lir().move(generator.makeOperand(object()), temp); + generator.emitMove(generator.makeOperand(object()), temp); FieldWriteBarrier.this.generateBarrier(temp, generator); } }; } return super.lookup(clazz); } - - @Override - public void print(LogStream out) { - out.print("field write barrier ").print(object()); - } } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeLoad.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeLoad.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeLoad.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.max.graal.runtime.nodes; -import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.phases.*; -import com.oracle.max.graal.compiler.phases.LoweringPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -33,29 +32,29 @@ */ public class UnsafeLoad extends StateSplit { - @Input private Value object; + @Input private ValueNode object; - @Input private Value offset; + @Input private ValueNode offset; - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } - public Value offset() { + public ValueNode offset() { return offset; } - public void setOffset(Value x) { + public void setOffset(ValueNode x) { updateUsages(offset, x); offset = x; } - public UnsafeLoad(Value object, Value offset, CiKind kind, Graph graph) { + public UnsafeLoad(ValueNode object, ValueNode offset, CiKind kind, Graph graph) { super(kind, graph); setObject(object); setOffset(offset); @@ -65,7 +64,7 @@ @Override public T lookup(Class clazz) { if (clazz == LoweringOp.class) { - return (T) LoweringPhase.DELEGATE_TO_RUNTIME; + return (T) DELEGATE_TO_RUNTIME; } return super.lookup(clazz); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeStore.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeStore.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeStore.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.max.graal.runtime.nodes; -import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.phases.*; -import com.oracle.max.graal.compiler.phases.LoweringPhase.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -33,40 +32,38 @@ */ public class UnsafeStore extends StateSplit { - @Input private Value object; - - @Input private Value offset; + @Input private ValueNode object; + @Input private ValueNode offset; + @Input private ValueNode value; - @Input private Value value; - - public Value object() { + public ValueNode object() { return object; } - public void setObject(Value x) { + public void setObject(ValueNode x) { updateUsages(object, x); object = x; } - public Value offset() { + public ValueNode offset() { return offset; } - public void setOffset(Value x) { + public void setOffset(ValueNode x) { updateUsages(offset, x); offset = x; } - public Value value() { + public ValueNode value() { return value; } - public void setValue(Value x) { + public void setValue(ValueNode x) { updateUsages(value, x); value = x; } - public UnsafeStore(Value object, Value offset, Value value, CiKind kind, Graph graph) { + public UnsafeStore(ValueNode object, ValueNode offset, ValueNode value, CiKind kind, Graph graph) { super(kind, graph); setObject(object); setOffset(offset); @@ -77,7 +74,7 @@ @Override public T lookup(Class clazz) { if (clazz == LoweringOp.class) { - return (T) LoweringPhase.DELEGATE_TO_RUNTIME; + return (T) DELEGATE_TO_RUNTIME; } return super.lookup(clazz); } diff -r 391302094f86 -r 6b841b6b2437 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/WriteBarrier.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/WriteBarrier.java Tue Aug 09 21:50:58 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/WriteBarrier.java Tue Aug 09 23:56:10 2011 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.max.graal.runtime.nodes; -import com.oracle.max.graal.compiler.gen.*; import com.oracle.max.graal.compiler.ir.*; -import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.runtime.*; import com.sun.cri.ci.*; @@ -37,17 +36,17 @@ } - protected void generateBarrier(CiValue temp, LIRGenerator generator) { + protected void generateBarrier(CiValue temp, LIRGeneratorTool generator) { HotSpotVMConfig config = CompilerImpl.getInstance().getConfig(); - generator.lir().unsignedShiftRight(temp, CiConstant.forInt(config.cardtableShift), temp, CiValue.IllegalValue); + generator.emitUnsignedShiftRight(temp, CiConstant.forInt(config.cardtableShift), temp, CiValue.IllegalValue); long startAddress = config.cardtableStartAddress; int displacement = 0; if (((int) startAddress) == startAddress) { displacement = (int) startAddress; } else { - generator.lir().add(temp, CiConstant.forLong(config.cardtableStartAddress), temp); + generator.emitAdd(temp, CiConstant.forLong(config.cardtableStartAddress), temp); } - generator.lir().move(CiConstant.FALSE, new CiAddress(CiKind.Boolean, temp, displacement), (LIRDebugInfo) null); + generator.emitMove(CiConstant.FALSE, new CiAddress(CiKind.Boolean, temp, displacement)); } } diff -r 391302094f86 -r 6b841b6b2437 runbatik.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/runbatik.sh Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,20 @@ +#!/bin/bash +if [ -z "${JDK7}" ]; then + echo "JDK7 is not defined." + exit 1; +fi +if [ -z "${MAXINE}" ]; then + echo "MAXINE is not defined. It must point to a maxine repository directory." + exit 1; +fi +if [ -z "${GRAAL}" ]; then + echo "GRAAL is not defined. It must point to a maxine repository directory." + exit 1; +fi +if [ -z "${DACAPO}" ]; then + echo "DACAPO is not defined. It must point to a Dacapo benchmark directory." + exit 1; +fi +COMMAND="${JDK7}/bin/java -client -d64 -graal -Xms1g -Xmx2g -esa -classpath ${DACAPO}/dacapo-9.12-bach.jar -XX:-GraalBailoutIsFatal -G:-QuietBailout $* Harness --preserve -n 20 batik" +echo $COMMAND +$COMMAND diff -r 391302094f86 -r 6b841b6b2437 runtradebeans.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/runtradebeans.sh Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,20 @@ +#!/bin/bash +if [ -z "${JDK7}" ]; then + echo "JDK7 is not defined." + exit 1; +fi +if [ -z "${MAXINE}" ]; then + echo "MAXINE is not defined. It must point to a maxine repository directory." + exit 1; +fi +if [ -z "${GRAAL}" ]; then + echo "GRAAL is not defined. It must point to a maxine repository directory." + exit 1; +fi +if [ -z "${DACAPO}" ]; then + echo "DACAPO is not defined. It must point to a Dacapo benchmark directory." + exit 1; +fi +COMMAND="${JDK7}/bin/java -client -d64 -graal -Xms1g -Xmx2g -esa -classpath ${DACAPO}/dacapo-9.12-bach.jar -XX:-GraalBailoutIsFatal -G:-QuietBailout $* Harness --preserve -n 20 tradebeans" +echo $COMMAND +$COMMAND diff -r 391302094f86 -r 6b841b6b2437 runxalan.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/runxalan.sh Tue Aug 09 23:56:10 2011 +0200 @@ -0,0 +1,20 @@ +#!/bin/bash +if [ -z "${JDK7}" ]; then + echo "JDK7 is not defined." + exit 1; +fi +if [ -z "${MAXINE}" ]; then + echo "MAXINE is not defined. It must point to a maxine repository directory." + exit 1; +fi +if [ -z "${GRAAL}" ]; then + echo "GRAAL is not defined. It must point to a maxine repository directory." + exit 1; +fi +if [ -z "${DACAPO}" ]; then + echo "DACAPO is not defined. It must point to a Dacapo benchmark directory." + exit 1; +fi +COMMAND="${JDK7}/bin/java -client -d64 -graal -Xms1g -Xmx2g -esa -classpath ${DACAPO}/dacapo-9.12-bach.jar -XX:-GraalBailoutIsFatal -G:-QuietBailout $* Harness --preserve -n 20 xalan" +echo $COMMAND +$COMMAND