# HG changeset patch # User Thomas Wuerthinger # Date 1312929269 -7200 # Node ID d683f8a40c05ef24a4cd0553949ec96874f8bee3 # Parent 6b841b6b2437c53262d6c5449dd57c18e984df51 Second round of refactoring. diff -r 6b841b6b2437 -r d683f8a40c05 .test.txt.swo Binary file .test.txt.swo has changed diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ComputeLinearScanOrder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ComputeLinearScanOrder.java Wed Aug 10 00:34:29 2011 +0200 @@ -0,0 +1,357 @@ +/* + * 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.alloc; + +import java.util.*; + +import com.oracle.max.graal.compiler.*; +import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.graph.*; + +public final class ComputeLinearScanOrder { + + private final int maxBlockId; // the highest blockId of a block + private int numBlocks; // total number of blocks (smaller than maxBlockId) + + List linearScanOrder; // the resulting list of blocks in correct order + List codeEmittingOrder; + + final BitMap visitedBlocks; // used for recursive processing of blocks + final BitMap activeBlocks; // used for recursive processing of blocks + final BitMap dominatorBlocks; // temporary BitMap used for computation of dominator + final int[] forwardBranches; // number of incoming forward branches for each block + final List workList; // temporary list (used in markLoops and computeOrder) + final LIRBlock[] loopHeaders; + + // accessors for visitedBlocks and activeBlocks + void initVisited() { + activeBlocks.clearAll(); + visitedBlocks.clearAll(); + } + + boolean isVisited(LIRBlock b) { + return visitedBlocks.get(b.blockID()); + } + + boolean isActive(LIRBlock b) { + return activeBlocks.get(b.blockID()); + } + + void setVisited(LIRBlock b) { + assert !isVisited(b) : "already set"; + visitedBlocks.set(b.blockID()); + } + + void setActive(LIRBlock b) { + assert !isActive(b) : "already set"; + activeBlocks.set(b.blockID()); + } + + void clearActive(LIRBlock b) { + assert isActive(b) : "not already"; + activeBlocks.clear(b.blockID()); + } + + // accessors for forwardBranches + void incForwardBranches(LIRBlock b) { + forwardBranches[b.blockID()]++; + } + + int decForwardBranches(LIRBlock b) { + return --forwardBranches[b.blockID()]; + } + + // accessors for final result + public List linearScanOrder() { + return linearScanOrder; + } + + public ComputeLinearScanOrder(int maxBlockId, int loopCount, LIRBlock startBlock) { + loopHeaders = new LIRBlock[loopCount]; + + this.maxBlockId = maxBlockId; + visitedBlocks = new BitMap(maxBlockId); + activeBlocks = new BitMap(maxBlockId); + dominatorBlocks = new BitMap(maxBlockId); + forwardBranches = new int[maxBlockId]; + workList = new ArrayList(8); + + countEdges(startBlock, null); + computeOrder(startBlock); + printBlocks(); + } + + /** + * Traverses the CFG to analyze block and edge info. The analysis performed is: + * + * 1. Count of total number of blocks. + * 2. Count of all incoming edges and backward incoming edges. + * 3. Number loop header blocks. + * 4. Create a list with all loop end blocks. + */ + void countEdges(LIRBlock cur, LIRBlock parent) { + if (GraalOptions.TraceLinearScanLevel >= 3) { + TTY.println("Counting edges for block B%d%s", cur.blockID(), parent == null ? "" : " coming from B" + parent.blockID()); + } + + if (isActive(cur)) { + return; + } + + // increment number of incoming forward branches + incForwardBranches(cur); + + if (isVisited(cur)) { + if (GraalOptions.TraceLinearScanLevel >= 3) { + TTY.println("block already visited"); + } + return; + } + + numBlocks++; + setVisited(cur); + setActive(cur); + + // recursive call for all successors + int i; + for (i = cur.numberOfSux() - 1; i >= 0; i--) { + countEdges(cur.suxAt(i), cur); + } + + clearActive(cur); + + if (GraalOptions.TraceLinearScanLevel >= 3) { + TTY.println("Finished counting edges for block B%d", cur.blockID()); + } + } + + int computeWeight(LIRBlock cur) { + + // limit loop-depth to 15 bit (only for security reason, it will never be so big) + int weight = (cur.loopDepth() & 0x7FFF) << 16; + + int curBit = 15; + + // this is necessary for the (very rare) case that two successive blocks have + // the same loop depth, but a different loop index (can happen for endless loops + // with exception handlers) +// if (!cur.isLinearScanLoopHeader()) { +// weight |= 1 << curBit; +// } +// curBit--; + + // loop end blocks (blocks that end with a backward branch) are added + // after all other blocks of the loop. + if (!cur.isLinearScanLoopEnd()) { + weight |= 1 << curBit; + } + curBit--; + + // critical edge split blocks are preferred because then they have a greater + // probability to be completely empty + //if (cur.isCriticalEdgeSplit()) { + // weight |= 1 << curBit; + //} + //curBit--; + + // exceptions should not be thrown in normal control flow, so these blocks + // are added as late as possible +// if (!(cur.end() instanceof Throw) && (singleSux == null || !(singleSux.end() instanceof Throw))) { +// weight |= 1 << curBit; +// } +// curBit--; +// if (!(cur.end() instanceof Return) && (singleSux == null || !(singleSux.end() instanceof Return))) { +// weight |= 1 << curBit; +// } +// curBit--; + + // exceptions handlers are added as late as possible + if (!cur.isExceptionEntry()) { + weight |= 1 << curBit; + } + curBit--; + + // guarantee that weight is > 0 + weight |= 1; + + assert curBit >= 0 : "too many flags"; + assert weight > 0 : "weight cannot become negative"; + + return weight; + } + + private boolean readyForProcessing(LIRBlock cur) { + // Discount the edge just traveled. + // When the number drops to zero, all forward branches were processed + if (decForwardBranches(cur) != 0) { + return false; + } + + assert !linearScanOrder.contains(cur) : "block already processed (block can be ready only once)"; + assert !workList.contains(cur) : "block already in work-list (block can be ready only once)"; + return true; + } + + private void sortIntoWorkList(LIRBlock cur) { + assert !workList.contains(cur) : "block already in work list"; + + int curWeight = computeWeight(cur); + + // the linearScanNumber is used to cache the weight of a block + cur.setLinearScanNumber(curWeight); + + if (GraalOptions.StressLinearScan) { + workList.add(0, cur); + return; + } + + workList.add(null); // provide space for new element + + int insertIdx = workList.size() - 1; + while (insertIdx > 0 && workList.get(insertIdx - 1).linearScanNumber() > curWeight) { + workList.set(insertIdx, workList.get(insertIdx - 1)); + insertIdx--; + } + workList.set(insertIdx, cur); + + if (GraalOptions.TraceLinearScanLevel >= 3) { + TTY.println("Sorted B%d into worklist. new worklist:", cur.blockID()); + for (int i = 0; i < workList.size(); i++) { + TTY.println(String.format("%8d B%02d weight:%6x", i, workList.get(i).blockID(), workList.get(i).linearScanNumber())); + } + } + + for (int i = 0; i < workList.size(); i++) { + assert workList.get(i).linearScanNumber() > 0 : "weight not set"; + assert i == 0 || workList.get(i - 1).linearScanNumber() <= workList.get(i).linearScanNumber() : "incorrect order in worklist"; + } + } + + private void appendBlock(LIRBlock cur) { + if (GraalOptions.TraceLinearScanLevel >= 3) { + TTY.println("appending block B%d (weight 0x%06x) to linear-scan order", cur.blockID(), cur.linearScanNumber()); + } + assert !linearScanOrder.contains(cur) : "cannot add the same block twice"; + + // currently, the linear scan order and code emit order are equal. + // therefore the linearScanNumber and the weight of a block must also + // be equal. + cur.setLinearScanNumber(linearScanOrder.size()); + linearScanOrder.add(cur); + + if (!cur.isLinearScanLoopHeader() || !GraalOptions.OptReorderLoops) { + codeEmittingOrder.add(cur); + + if (cur.isLinearScanLoopEnd() && GraalOptions.OptReorderLoops) { + LIRBlock loopHeader = loopHeaders[cur.loopIndex()]; + assert loopHeader != null; + codeEmittingOrder.add(loopHeader); + + for (LIRBlock succ : loopHeader.blockSuccessors()) { + if (succ.loopDepth() == loopHeader.loopDepth()) { + succ.setAlign(true); + } + } + } + } else { + loopHeaders[cur.loopIndex()] = cur; + } + } + + private void computeOrder(LIRBlock startBlock) { + if (GraalOptions.TraceLinearScanLevel >= 3) { + TTY.println("----- computing final block order"); + } + + // the start block is always the first block in the linear scan order + linearScanOrder = new ArrayList(numBlocks); + + codeEmittingOrder = new ArrayList(numBlocks); + + // start processing with standard entry block + assert workList.isEmpty() : "list must be empty before processing"; + + assert readyForProcessing(startBlock); + sortIntoWorkList(startBlock); + + do { + LIRBlock cur = workList.remove(workList.size() - 1); + appendBlock(cur); + + int i; + int numSux = cur.numberOfSux(); + // changed loop order to get "intuitive" order of if- and else-blocks + for (i = 0; i < numSux; i++) { + LIRBlock sux = cur.suxAt(i); + if (readyForProcessing(sux)) { + sortIntoWorkList(sux); + } + } + } while (workList.size() > 0); + } + + public void printBlocks() { + if (GraalOptions.TraceLinearScanLevel >= 2) { + TTY.println("----- loop information:"); + for (LIRBlock cur : linearScanOrder) { + TTY.print(String.format("%4d: B%02d: ", cur.linearScanNumber(), cur.blockID())); + TTY.println(String.format(" . loopIndex: %2d, loopDepth: %2d", cur.loopIndex(), cur.loopDepth())); + } + } + + if (GraalOptions.TraceLinearScanLevel >= 1) { + TTY.println("----- linear-scan block order:"); + for (LIRBlock cur : linearScanOrder) { + TTY.print(String.format("%4d: B%02d loop: %2d depth: %2d", cur.linearScanNumber(), cur.blockID(), cur.loopIndex(), cur.loopDepth())); + + TTY.print(cur.isLinearScanLoopHeader() ? " lh" : " "); + TTY.print(cur.isLinearScanLoopEnd() ? " le" : " "); + + TTY.print(" dom: null "); + + + if (cur.numberOfPreds() > 0) { + TTY.print(" preds: "); + for (int j = 0; j < cur.numberOfPreds(); j++) { + LIRBlock pred = cur.predAt(j); + TTY.print("B%d ", pred.blockID()); + } + } + if (cur.numberOfSux() > 0) { + TTY.print(" sux: "); + for (int j = 0; j < cur.numberOfSux(); j++) { + LIRBlock sux = cur.suxAt(j); + TTY.print("B%d ", sux.blockID()); + } + } + TTY.println(); + } + } + } + + public List codeEmittingOrder() { + return codeEmittingOrder; + } +} diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,8 +26,8 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.graph.*; -import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.compiler.nodes.calc.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.ci.*; diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java Wed Aug 10 00:34:29 2011 +0200 @@ -25,8 +25,8 @@ import java.util.*; 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.calc.*; /** * This class optimizes moves, particularly those that result from eliminating SSA form. diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Wed Aug 10 00:34:29 2011 +0200 @@ -35,12 +35,12 @@ import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.gen.*; import com.oracle.max.graal.compiler.graph.*; -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.nodes.calc.*; +import com.oracle.max.graal.compiler.nodes.virtual.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.extensions.*; @@ -838,8 +838,8 @@ 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) { - Phi phi = (Phi) instr; + if (instr instanceof PhiNode) { + PhiNode phi = (PhiNode) instr; TTY.println("phi block begin: " + phi.merge()); TTY.println("pred count on blockbegin: " + phi.merge().phiPredecessorCount()); TTY.println("phi values: " + phi.valueCount()); @@ -1887,9 +1887,9 @@ return ciObj; } else if (value != null && value.operand() != CiValue.IllegalValue) { CiValue operand = value.operand(); - Constant con = null; - if (value instanceof Constant) { - con = (Constant) value; + ConstantNode con = null; + if (value instanceof ConstantNode) { + con = (ConstantNode) value; } assert con == null || operand.isVariable() || operand.isConstant() || operand.isIllegal() : "Constant instructions have only constant operands (or illegal if constant is optimized away)"; @@ -1923,7 +1923,7 @@ assert false : "must not reach here"; return operand; } else { - assert value instanceof Constant; + assert value instanceof ConstantNode; assert operand.isConstant() : "operand must be constant"; return operand; } @@ -2008,8 +2008,8 @@ } currentField = ((VirtualObjectFieldNode) currentField).lastState(); } else { - assert currentField instanceof Phi : currentField; - currentField = (FloatingNode) ((Phi) currentField).valueAt(0); + assert currentField instanceof PhiNode : currentField; + currentField = (FloatingNode) ((PhiNode) currentField).valueAt(0); } } while (currentField != null); } diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/BlockPrinter.java Wed Aug 10 00:34:29 2011 +0200 @@ -23,14 +23,13 @@ package com.oracle.max.graal.compiler.debug; 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.graph.*; /** - * Prints a listing for a {@linkplain Merge block}. + * Prints a listing for a {@linkplain MergeNode block}. */ public class BlockPrinter implements BlockClosure { @@ -45,7 +44,7 @@ public void apply(Block block) { if (cfgOnly) { if (block.getInstructions().size() > 0) { - ip.printInstruction((FixedNodeWithNext) block.getInstructions().get(0)); + ip.printInstruction((FixedWithNextNode) block.getInstructions().get(0)); } else { ip.out().println("Empty block"); } @@ -62,8 +61,8 @@ ip.printInstructionListingHeader(); for (Node i : block.getInstructions()) { - if (i instanceof FixedNodeWithNext) { - ip.printInstructionListing((FixedNodeWithNext) i); + if (i instanceof FixedWithNextNode) { + ip.printInstructionListing((FixedWithNextNode) i); } } out.println(); @@ -87,8 +86,8 @@ i++; } else { i += value.kind.sizeInSlots(); - if (value instanceof Phi) { - Phi phi = (Phi) value; + if (value instanceof PhiNode) { + PhiNode phi = (PhiNode) value; if (phi.operand() != null) { out.print(" "); out.print(phi.operand().toString()); diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Wed Aug 10 00:34:29 2011 +0200 @@ -29,7 +29,6 @@ import com.oracle.max.graal.compiler.alloc.*; import com.oracle.max.graal.compiler.alloc.Interval.UsePosList; import com.oracle.max.graal.compiler.graph.*; -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.*; @@ -409,8 +408,8 @@ out.println("HIR"); out.disableIndentation(); for (Node i : block.getInstructions()) { - if (i instanceof FixedNodeWithNext) { - printInstructionHIR((FixedNodeWithNext) i); + if (i instanceof FixedWithNextNode) { + printInstructionHIR((FixedWithNextNode) i); } } out.enableIndentation(); @@ -515,7 +514,7 @@ * * @param i the instruction for which HIR will be printed */ - private void printInstructionHIR(FixedNodeWithNext i) { + private void printInstructionHIR(FixedWithNextNode i) { out.print("bci ").print(-1).println(COLUMN_END); if (i.operand().isLegal()) { out.print("result ").print(new CFGOperandFormatter(false).format(i.operand())).println(COLUMN_END); diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,9 +26,7 @@ import java.util.regex.*; 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.graph.*; import com.oracle.max.graal.graphviz.*; @@ -100,10 +98,10 @@ printer.addOmittedClass(FrameState.class); } printer.addClassColor(StartNode.class, "snow3"); - printer.addClassColor(LoopBegin.class, "skyblue"); - printer.addClassColor(LoopEnd.class, "skyblue3"); + printer.addClassColor(LoopBeginNode.class, "skyblue"); + printer.addClassColor(LoopEndNode.class, "skyblue3"); printer.addClassColor(UnwindNode.class, "red"); - printer.addClassColor(Return.class, "indianred1"); + printer.addClassColor(ReturnNode.class, "indianred1"); printer.begin(name); printer.print(graph, true); printer.end(); diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Wed Aug 10 00:34:29 2011 +0200 @@ -28,8 +28,8 @@ 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.nodes.loop.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.compiler.util.LoopUtil.Loop; @@ -272,7 +272,7 @@ Block block = nodeToBlock == null ? null : nodeToBlock.get(node); if (block != null) { stream.printf("

%d

%n", block.blockID()); - if (!(node instanceof Phi || node instanceof FrameState || node instanceof Local || node instanceof LoopCounter) && !block.getInstructions().contains(node)) { + if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof LocalNode || node instanceof LoopCounterNode) && !block.getInstructions().contains(node)) { stream.println("

true

"); } } else { @@ -386,7 +386,7 @@ // if this is the first block: add all locals to this block if (block.getInstructions().size() > 0 && block.getInstructions().get(0) == graph.start()) { for (Node node : graph.getNodes()) { - if (node instanceof Local) { + if (node instanceof LocalNode) { nodes.add(node); } } @@ -397,9 +397,9 @@ if (node instanceof StateSplit && ((StateSplit) node).stateAfter() != null) { nodes.add(((StateSplit) node).stateAfter()); } - if (node instanceof Merge) { + if (node instanceof MergeNode) { for (Node usage : node.usages()) { - if (usage instanceof Phi || usage instanceof LoopCounter) { + if (usage instanceof PhiNode || usage instanceof LoopCounterNode) { nodes.add(usage); } } diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/InstructionPrinter.java Wed Aug 10 00:34:29 2011 +0200 @@ -24,13 +24,12 @@ 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(ValueNode) printing} - * an {@link FixedNodeWithNext} as an expression or statement. + * an {@link FixedWithNextNode} as an expression or statement. * * @author Doug Simon */ diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Wed Aug 10 00:34:29 2011 +0200 @@ -37,14 +37,14 @@ import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.globalstub.*; 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.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.DeoptimizeNode.DeoptAction; 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.base.PhiNode.PhiType; +import com.oracle.max.graal.compiler.nodes.calc.*; import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.java.*; import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; @@ -321,18 +321,18 @@ } @Override - public void visitMerge(Merge x) { - if (x.next() instanceof LoopBegin) { - moveToPhi((LoopBegin) x.next(), x); + public void visitMerge(MergeNode x) { + if (x.next() instanceof LoopBeginNode) { + moveToPhi((LoopBeginNode) x.next(), x); } } @Override - public void visitArrayLength(ArrayLength x) { + public void visitArrayLength(ArrayLengthNode x) { emitArrayLength(x); } - public CiValue emitArrayLength(ArrayLength x) { + public CiValue emitArrayLength(ArrayLengthNode x) { XirArgument array = toXirArgument(x.array()); XirSnippet snippet = xir.genArrayLength(site(x), array); emitXir(snippet, x, stateFor(x), null, true); @@ -343,7 +343,7 @@ CiCallingConvention args = compilation.frameMap().incomingArguments(); int bci = 0; if (Modifier.isSynchronized(compilation.method.accessFlags())) { - bci = FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI; + bci = FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI; } boolean withReceiver = !Modifier.isStatic(compilation.method.accessFlags()); @@ -357,8 +357,8 @@ FrameState fs = new FrameState(compilation.method, bci, compilation.method.maxLocals(), 0, 0, false, compilation.graph); for (Node node : compilation.graph.start().usages()) { - if (node instanceof Local) { - Local local = (Local) node; + if (node instanceof LocalNode) { + LocalNode local = (LocalNode) node; int i = local.index(); fs.storeLocal(argumentSlots[i], local); @@ -388,14 +388,14 @@ } @Override - public void visitCheckCast(CheckCast x) { + public void visitCheckCast(CheckCastNode x) { XirArgument obj = toXirArgument(x.object()); XirSnippet snippet = xir.genCheckCast(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass()); emitXir(snippet, x, stateFor(x), null, true); } @Override - public void visitMonitorEnter(MonitorEnter x) { + public void visitMonitorEnter(MonitorEnterNode x) { XirArgument obj = toXirArgument(x.object()); XirArgument lockAddress = toXirArgument(x.lockAddress()); XirSnippet snippet = xir.genMonitorEnter(site(x), obj, lockAddress); @@ -403,7 +403,7 @@ } @Override - public void visitMonitorExit(MonitorExit x) { + public void visitMonitorExit(MonitorExitNode x) { XirArgument obj = toXirArgument(x.object()); XirArgument lockAddress = toXirArgument(x.lockAddress()); XirSnippet snippet = xir.genMonitorExit(site(x), obj, lockAddress); @@ -421,27 +421,27 @@ } @Override - public void visitNewInstance(NewInstance x) { + public void visitNewInstance(NewInstanceNode x) { XirSnippet snippet = xir.genNewInstance(site(x), x.instanceClass()); emitXir(snippet, x, stateFor(x), null, true); } @Override - public void visitNewTypeArray(NewTypeArray x) { + public void visitNewTypeArray(NewTypeArrayNode x) { XirArgument length = toXirArgument(x.length()); XirSnippet snippet = xir.genNewArray(site(x), length, x.elementKind(), null, null); emitXir(snippet, x, stateFor(x), null, true); } @Override - public void visitNewObjectArray(NewObjectArray x) { + public void visitNewObjectArray(NewObjectArrayNode x) { XirArgument length = toXirArgument(x.length()); XirSnippet snippet = xir.genNewArray(site(x), length, CiKind.Object, x.elementType(), x.exactType()); emitXir(snippet, x, stateFor(x), null, true); } @Override - public void visitNewMultiArray(NewMultiArray x) { + public void visitNewMultiArray(NewMultiArrayNode x) { XirArgument[] dims = new XirArgument[x.dimensionCount()]; for (int i = 0; i < dims.length; i++) { @@ -460,7 +460,7 @@ @Override - public void visitConstant(Constant x) { + public void visitConstant(ConstantNode x) { if (!canInlineAsConstant(x)) { CiValue res = x.operand(); if (!(res.isLegal())) { @@ -476,7 +476,7 @@ } @Override - public void visitExceptionObject(ExceptionObject x) { + public void visitExceptionObject(ExceptionObjectNode x) { XirSnippet snippet = xir.genExceptionObject(site(x)); emitXir(snippet, x, null, null, true); // lastState = lastState.duplicateWithException(lastState.bci, x); @@ -489,19 +489,19 @@ } @Override - public void visitAnchor(Anchor x) { + public void visitAnchor(AnchorNode x) { setNoResult(x); } @Override - public void visitIf(If x) { + public void visitIf(IfNode x) { assert x.defaultSuccessor() == x.falseSuccessor() : "wrong destination"; emitBooleanBranch(x.compare(), getLIRBlock(x.trueSuccessor()), getLIRBlock(x.falseSuccessor()), null); } public void emitBranch(BooleanNode n, Condition cond, LIRBlock trueSuccessor, LIRBlock falseSucc) { - if (n instanceof Compare) { - Compare compare = (Compare) n; + if (n instanceof CompareNode) { + CompareNode compare = (CompareNode) n; if (compare.x().kind.isFloat() || compare.x().kind.isDouble()) { LIRBlock unorderedSuccBlock = falseSucc; if (compare.unorderedIsTrue()) { @@ -517,20 +517,20 @@ public void emitBooleanBranch(BooleanNode node, LIRBlock trueSuccessor, LIRBlock falseSuccessor, LIRDebugInfo info) { if (node instanceof NegateBooleanNode) { emitBooleanBranch(((NegateBooleanNode) node).value(), falseSuccessor, trueSuccessor, info); - } else if (node instanceof IsNonNull) { - emitIsNonNullBranch((IsNonNull) node, trueSuccessor, falseSuccessor); - } else if (node instanceof Compare) { - emitCompare((Compare) node, trueSuccessor, falseSuccessor); - } else if (node instanceof InstanceOf) { + } else if (node instanceof IsNonNullNode) { + emitIsNonNullBranch((IsNonNullNode) node, trueSuccessor, falseSuccessor); + } else if (node instanceof CompareNode) { + emitCompare((CompareNode) node, trueSuccessor, falseSuccessor); + } else if (node instanceof InstanceOfNode) { emitInstanceOf((TypeCheckNode) node, trueSuccessor, falseSuccessor, info); - } else if (node instanceof Constant) { - emitConstantBranch(((Constant) node).asConstant().asBoolean(), trueSuccessor, falseSuccessor, info); + } else if (node instanceof ConstantNode) { + emitConstantBranch(((ConstantNode) node).asConstant().asBoolean(), trueSuccessor, falseSuccessor, info); } else { throw Util.unimplemented(node.toString()); } } - private void emitIsNonNullBranch(IsNonNull node, LIRBlock trueSuccessor, LIRBlock falseSuccessor) { + private void emitIsNonNullBranch(IsNonNullNode node, LIRBlock trueSuccessor, LIRBlock falseSuccessor) { Condition cond = Condition.NE; if (trueSuccessor == null) { cond = cond.negate(); @@ -580,7 +580,7 @@ } } - public void emitCompare(Compare compare, LIRBlock trueSuccessorBlock, LIRBlock falseSuccessorBlock) { + public void emitCompare(CompareNode compare, LIRBlock trueSuccessorBlock, LIRBlock falseSuccessorBlock) { CiKind kind = compare.x().kind; Condition cond = compare.condition(); @@ -623,16 +623,16 @@ } } - protected FrameState stateBeforeInvokeReturn(Invoke invoke) { + protected FrameState stateBeforeInvokeReturn(InvokeNode invoke) { return invoke.stateAfter().duplicateModified(invoke.bci, invoke.stateAfter().rethrowException(), invoke.kind); } - protected FrameState stateBeforeInvokeWithArguments(Invoke invoke) { + protected FrameState stateBeforeInvokeWithArguments(InvokeNode invoke) { return invoke.stateAfter().duplicateModified(invoke.bci, invoke.stateAfter().rethrowException(), invoke.kind, invoke.arguments().toArray(new ValueNode[0])); } @Override - public void visitInvoke(Invoke x) { + public void visitInvoke(InvokeNode x) { RiMethod target = x.target(); LIRDebugInfo info = stateFor(x, stateBeforeInvokeWithArguments(x)); LIRDebugInfo info2 = stateFor(x, stateBeforeInvokeReturn(x)); @@ -695,13 +695,13 @@ } } - private CiKind[] getSignature(Invoke x) { + private CiKind[] getSignature(InvokeNode x) { CiKind receiver = x.isStatic() ? null : x.target.holder().kind(); return Util.signatureToKinds(x.target.signature(), receiver); } @Override - public void visitMonitorAddress(MonitorAddress x) { + public void visitMonitorAddress(MonitorAddressNode x) { CiValue result = createResultVariable(x); lir.monitorAddress(x.monitorIndex(), result); } @@ -710,7 +710,7 @@ * For note on volatile fields, see {@link #visitStoreField(StoreField)}. */ @Override - public void visitLoadField(LoadField x) { + public void visitLoadField(LoadFieldNode x) { RiField field = x.field(); LIRDebugInfo info = stateFor(x); XirArgument receiver = toXirArgument(x.object()); @@ -723,7 +723,7 @@ } @Override - public void visitLoadIndexed(LoadIndexed x) { + public void visitLoadIndexed(LoadIndexedNode x) { XirArgument array = toXirArgument(x.array()); XirArgument index = toXirArgument(x.index()); XirArgument length = toXirArgument(x.length()); @@ -750,14 +750,14 @@ } @Override - public void visitLocal(Local x) { + public void visitLocal(LocalNode x) { if (x.operand().isIllegal()) { createResultVariable(x); } } @Override - public void visitLookupSwitch(LookupSwitch x) { + public void visitLookupSwitch(LookupSwitchNode x) { CiValue tag = load(x.value()); setNoResult(x); @@ -785,7 +785,7 @@ } @Override - public void visitFixedGuard(FixedGuard fixedGuard) { + public void visitFixedGuard(FixedGuardNode fixedGuard) { for (Node n : fixedGuard.inputs()) { if (n != null) { emitGuardComp((BooleanNode) n); @@ -794,20 +794,20 @@ } public void emitGuardComp(BooleanNode comp) { - if (comp instanceof IsNonNull) { - IsNonNull x = (IsNonNull) comp; + if (comp instanceof IsNonNullNode) { + IsNonNullNode x = (IsNonNullNode) comp; CiValue value = load(x.object()); LIRDebugInfo info = stateFor(x); lir.nullCheck(value, info); - } else if (comp instanceof IsType) { - IsType x = (IsType) comp; + } else if (comp instanceof IsTypeNode) { + IsTypeNode x = (IsTypeNode) comp; load(x.object()); LIRDebugInfo info = stateFor(x); XirArgument clazz = toXirArgument(x.type().getEncoding(Representation.ObjectHub)); XirSnippet typeCheck = xir.genTypeCheck(site(x), toXirArgument(x.object()), clazz, x.type()); emitXir(typeCheck, x, info, compilation.method, false); } else { - if (comp instanceof Constant && comp.asConstant().asBoolean()) { + if (comp instanceof ConstantNode && comp.asConstant().asBoolean()) { // Nothing to emit. } else { DeoptimizationStub stub = createDeoptStub(); @@ -836,12 +836,12 @@ @Override - public void visitPhi(Phi i) { + public void visitPhi(PhiNode i) { Util.shouldNotReachHere(); } @Override - public void visitReturn(Return x) { + public void visitReturn(ReturnNode x) { if (x.kind.isVoid()) { XirSnippet epilogue = xir.genEpilogue(site(x), compilation.method); if (epilogue != null) { @@ -1093,9 +1093,9 @@ } @Override - public void visitDeoptimize(Deoptimize deoptimize) { + public void visitDeoptimize(DeoptimizeNode deoptimize) { assert lastState != null : "deoptimize always needs a state"; - assert lastState.bci != FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI : "bci must not be -1 for deopt framestate"; + assert lastState.bci != FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI : "bci must not be -1 for deopt framestate"; DeoptimizationStub stub = new DeoptimizationStub(deoptimize.action(), lastState); addDeoptimizationStub(stub); lir.branch(Condition.TRUE, stub.label, stub.info); @@ -1150,7 +1150,7 @@ return operand; } - private CiVariable loadConstant(Constant x) { + private CiVariable loadConstant(ConstantNode x) { return loadConstant(x.asConstant(), x.kind); } @@ -1185,7 +1185,7 @@ } @Override - public void visitRegisterFinalizer(RegisterFinalizer x) { + public void visitRegisterFinalizer(RegisterFinalizerNode x) { CiValue receiver = load(x.object()); LIRDebugInfo info = stateFor(x); callRuntime(CiRuntimeCall.RegisterFinalizer, info, receiver); @@ -1375,7 +1375,7 @@ return result; } - SwitchRange[] createLookupRanges(LookupSwitch x) { + SwitchRange[] createLookupRanges(LookupSwitchNode x) { // we expect the keys to be sorted by increasing value List res = new ArrayList(x.numberOfCases()); int len = x.numberOfCases(); @@ -1536,7 +1536,7 @@ @Override - public void visitLoopEnd(LoopEnd x) { + public void visitLoopEnd(LoopEndNode x) { setNoResult(x); moveToPhi(x.loopBegin(), x); if (GraalOptions.GenSafepoints) { @@ -1545,22 +1545,22 @@ lir.jump(getLIRBlock(x.loopBegin())); } - private void moveToPhi(Merge merge, Node pred) { + private void moveToPhi(MergeNode merge, Node pred) { if (GraalOptions.TraceLIRGeneratorLevel >= 1) { TTY.println("MOVE TO PHI from " + pred + " to " + merge); } int nextSuccIndex = merge.phiPredecessorIndex(pred); PhiResolver resolver = new PhiResolver(this); - for (Phi phi : merge.phis()) { + for (PhiNode phi : merge.phis()) { if (phi.type() == PhiType.Value) { ValueNode curVal = phi.valueAt(nextSuccIndex); if (curVal != null && curVal != phi) { - if (curVal instanceof Phi) { - operandForPhi((Phi) curVal); + if (curVal instanceof PhiNode) { + operandForPhi((PhiNode) curVal); } CiValue operand = curVal.operand(); if (operand.isIllegal()) { - assert curVal instanceof Constant || curVal instanceof Local : "these can be produced lazily" + curVal + "/" + phi; + assert curVal instanceof ConstantNode || curVal instanceof LocalNode : "these can be produced lazily" + curVal + "/" + phi; operand = operandForInstruction(curVal); } resolver.move(operand, operandForPhi(phi)); @@ -1584,10 +1584,10 @@ CiValue operandForInstruction(ValueNode x) { CiValue operand = x.operand(); if (operand.isIllegal()) { - if (x instanceof Constant) { + if (x instanceof ConstantNode) { x.setOperand(x.asConstant()); } else { - assert x instanceof Phi || x instanceof Local : "only for Phi and Local : " + x; + assert x instanceof PhiNode || x instanceof LocalNode : "only for Phi and Local : " + x; // allocate a variable for this local or phi createResultVariable(x); } @@ -1595,7 +1595,7 @@ return x.operand(); } - private CiValue operandForPhi(Phi phi) { + private CiValue operandForPhi(PhiNode phi) { assert phi.type() == PhiType.Value : "wrong phi type: " + phi.id(); if (phi.operand().isIllegal()) { // allocate a variable for this phi @@ -1661,9 +1661,9 @@ 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) { + } else if (value instanceof PhiNode && ((PhiNode) value).type() == PhiType.Value) { // phi's are special - operandForPhi((Phi) value); + operandForPhi((PhiNode) value); } else if (value.operand().isIllegal()) { // instruction doesn't have an operand yet CiValue operand = makeOperand(value); @@ -1685,7 +1685,7 @@ return new LIRDebugInfo(state); } - List visitInvokeArguments(CiCallingConvention cc, Invoke x, List pointerSlots) { + List visitInvokeArguments(CiCallingConvention cc, InvokeNode x, List pointerSlots) { // for each argument, load it into the correct location List argList = new ArrayList(); int j = 0; @@ -1730,10 +1730,10 @@ } CiValue operand = instruction.operand(); if (operand.isIllegal()) { - if (instruction instanceof Phi) { + if (instruction instanceof PhiNode) { // a phi may not have an operand yet if it is for an exception block - operand = operandForPhi((Phi) instruction); - } else if (instruction instanceof Constant) { + operand = operandForPhi((PhiNode) instruction); + } else if (instruction instanceof ConstantNode) { operand = operandForInstruction(instruction); } } @@ -1858,7 +1858,7 @@ public abstract Condition floatingPointCondition(Condition cond); @Override - public void visitConditional(Conditional conditional) { + public void visitConditional(ConditionalNode conditional) { BooleanNode condition = conditional.condition(); LIRGenerator generator = this; @@ -1874,8 +1874,8 @@ negate = !negate; condition = ((NegateBooleanNode) condition).value(); } - if (condition instanceof Compare) { - Compare compare = (Compare) condition; + if (condition instanceof CompareNode) { + CompareNode compare = (CompareNode) condition; ValueNode x = compare.x(); ValueNode y = compare.y(); cond = compare.condition(); @@ -1890,14 +1890,14 @@ } else { right = generator.makeOperand(y); } - } else if (condition instanceof IsNonNull) { - IsNonNull isNonNull = (IsNonNull) condition; + } else if (condition instanceof IsNonNullNode) { + IsNonNullNode isNonNull = (IsNonNullNode) condition; left = generator.load(isNonNull.object()); right = CiConstant.NULL_OBJECT; cond = Condition.NE; - } else if (condition instanceof Constant) { + } else if (condition instanceof ConstantNode) { generator.lir().move(condition.asConstant(), generator.createResultVariable(conditional)); - } else if (condition instanceof InstanceOf) { + } else if (condition instanceof InstanceOfNode) { if (conditional instanceof MaterializeNode && !negate) { generator.emitMaterializeInstanceOf((MaterializeNode) conditional, conditional, null); } else { diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,11 +26,11 @@ import java.util.*; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.sun.cri.ci.*; /** - * Converts {@link Phi} instructions into moves. + * Converts {@link PhiNode} instructions into moves. * * Resolves cycles: *
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiSimplifier.java	Wed Aug 10 00:34:29 2011 +0200
@@ -22,7 +22,6 @@
  */
 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.*;
@@ -40,17 +39,17 @@
         cannotSimplify = graph.createNodeBitMap();
 
         for (Node n : graph.getNodes()) {
-            if (n instanceof Phi) {
-                simplify((Phi) n);
+            if (n instanceof PhiNode) {
+                simplify((PhiNode) n);
             }
         }
     }
 
     private ValueNode simplify(ValueNode x) {
-        if (x == null || !(x instanceof Phi)) {
+        if (x == null || !(x instanceof PhiNode)) {
             return x;
         }
-        Phi phi = (Phi) x;
+        PhiNode phi = (PhiNode) x;
 
         if (phi.valueCount() == 1 && !cannotSimplify.isMarked(phi)) {
             ValueNode result = phi.valueAt(0);
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/BlockMap.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/BlockMap.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/BlockMap.java	Wed Aug 10 00:34:29 2011 +0200
@@ -28,7 +28,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.sun.cri.bytecode.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
@@ -121,7 +121,7 @@
         public boolean isLoopHeader;
         public int blockID;
 
-        public FixedNodeWithNext firstInstruction;
+        public FixedWithNextNode firstInstruction;
 
         final HashSet successors = new LinkedHashSet();
         private boolean visited;
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/CompilerGraph.java	Wed Aug 10 00:34:29 2011 +0200
@@ -22,8 +22,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.compiler.nodes.base.*;
 import com.oracle.max.graal.graph.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
@@ -32,7 +31,7 @@
 public class CompilerGraph extends Graph {
 
     private RiRuntime runtime;
-    private Return returnSingleton;
+    private ReturnNode returnSingleton;
     private UnwindNode unwindSingleton;
     private CiAssumptions assumptions = new CiAssumptions();
 
@@ -40,12 +39,12 @@
         this.runtime = runtime;
     }
 
-    public void setReturn(Return returnNode) {
+    public void setReturn(ReturnNode returnNode) {
         assert returnSingleton == null;
         returnSingleton = returnNode;
     }
 
-    public Return getReturn() {
+    public ReturnNode getReturn() {
         return returnSingleton;
     }
 
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java	Wed Aug 10 00:34:29 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.alloc.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.nodes.base.*;
 import com.oracle.max.graal.compiler.observer.*;
@@ -289,7 +289,7 @@
         return maxLocks;
     }
 
-    public FixedNodeWithNext getHIRStartBlock() {
-        return (FixedNodeWithNext) compilation.graph.start().successors().first();
+    public FixedWithNextNode getHIRStartBlock() {
+        return (FixedWithNextNode) compilation.graph.start().successors().first();
     }
 }
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/MergeableState.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/MergeableState.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/MergeableState.java	Wed Aug 10 00:34:29 2011 +0200
@@ -24,12 +24,12 @@
 
 import java.util.*;
 
-import com.oracle.max.graal.compiler.ir.*;
+import com.oracle.max.graal.compiler.nodes.base.*;
 
 public interface MergeableState  {
     T clone();
-    boolean merge(Merge merge, Collection withStates);
-    void loopBegin(LoopBegin loopBegin);
-    void loopEnd(LoopEnd loopEnd, T loopEndState);
+    boolean merge(MergeNode merge, Collection withStates);
+    void loopBegin(LoopBeginNode loopBegin);
+    void loopEnd(LoopEndNode loopEnd, T loopEndState);
     void afterSplit(FixedNode node);
 }
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/PostOrderNodeIterator.java	Wed Aug 10 00:34:29 2011 +0200
@@ -24,8 +24,7 @@
 
 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.base.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.graph.collections.*;
 
@@ -50,30 +49,30 @@
         FixedNode current = start;
 
         do {
-            if (current instanceof Invoke) {
-                invoke((Invoke) current);
+            if (current instanceof InvokeNode) {
+                invoke((InvokeNode) current);
                 queueSuccessors(current);
                 current = nextQueuedNode();
-            } else if (current instanceof LoopBegin) {
-                state.loopBegin((LoopBegin) current);
+            } else if (current instanceof LoopBeginNode) {
+                state.loopBegin((LoopBeginNode) current);
                 nodeStates.put(current, state);
                 state = state.clone();
-                loopBegin((LoopBegin) current);
-                current = ((LoopBegin) current).next();
+                loopBegin((LoopBeginNode) current);
+                current = ((LoopBeginNode) current).next();
                 assert current != null;
-            } else if (current instanceof LoopEnd) {
-                T loopBeginState = nodeStates.get(((LoopEnd) current).loopBegin());
+            } else if (current instanceof LoopEndNode) {
+                T loopBeginState = nodeStates.get(((LoopEndNode) current).loopBegin());
                 if (loopBeginState != null) {
-                    loopBeginState.loopEnd((LoopEnd) current, state);
+                    loopBeginState.loopEnd((LoopEndNode) current, state);
                 }
-                loopEnd((LoopEnd) current);
+                loopEnd((LoopEndNode) current);
                 current = nextQueuedNode();
-            } else if (current instanceof Merge) {
-                merge((Merge) current);
-                current = ((Merge) current).next();
+            } else if (current instanceof MergeNode) {
+                merge((MergeNode) current);
+                current = ((MergeNode) current).next();
                 assert current != null;
-            } else if (current instanceof FixedNodeWithNext) {
-                FixedNode next = ((FixedNodeWithNext) current).next();
+            } else if (current instanceof FixedWithNextNode) {
+                FixedNode next = ((FixedWithNextNode) current).next();
                 node(current);
                 current = next;
                 assert current != null;
@@ -81,17 +80,17 @@
                 end((EndNode) current);
                 queueMerge((EndNode) current);
                 current = nextQueuedNode();
-            } else if (current instanceof Deoptimize) {
-                deoptimize((Deoptimize) current);
+            } else if (current instanceof DeoptimizeNode) {
+                deoptimize((DeoptimizeNode) current);
                 current = nextQueuedNode();
-            } else if (current instanceof Return) {
-                returnNode((Return) current);
+            } else if (current instanceof ReturnNode) {
+                returnNode((ReturnNode) current);
                 current = nextQueuedNode();
             } else if (current instanceof UnwindNode) {
                 unwind((UnwindNode) current);
                 current = nextQueuedNode();
-            } else if (current instanceof ControlSplit) {
-                controlSplit((ControlSplit) current);
+            } else if (current instanceof ControlSplitNode) {
+                controlSplit((ControlSplitNode) current);
                 queueSuccessors(current);
                 current = nextQueuedNode();
             } else {
@@ -113,8 +112,8 @@
         int maxIterations = nodeQueue.size();
         while (maxIterations-- > 0) {
             FixedNode node = nodeQueue.removeFirst();
-            if (node instanceof Merge) {
-                Merge merge = (Merge) node;
+            if (node instanceof MergeNode) {
+                MergeNode merge = (MergeNode) node;
                 state = nodeStates.get(merge.endAt(0)).clone();
                 ArrayList states = new ArrayList(merge.endCount() - 1);
                 for (int i = 1; i < merge.endCount(); i++) {
@@ -143,7 +142,7 @@
         assert !nodeStates.containsKey(end);
         nodeStates.put(end, state);
         visitedEnds.mark(end);
-        Merge merge = end.merge();
+        MergeNode merge = end.merge();
         boolean endsVisited = true;
         for (int i = 0; i < merge.endCount(); i++) {
             if (!visitedEnds.isMarked(merge.endAt(i))) {
@@ -162,31 +161,31 @@
         node(endNode);
     }
 
-    protected void merge(Merge merge) {
+    protected void merge(MergeNode merge) {
         node(merge);
     }
 
-    protected void loopBegin(LoopBegin loopBegin) {
+    protected void loopBegin(LoopBeginNode loopBegin) {
         node(loopBegin);
     }
 
-    protected void loopEnd(LoopEnd loopEnd) {
+    protected void loopEnd(LoopEndNode loopEnd) {
         node(loopEnd);
     }
 
-    protected void deoptimize(Deoptimize deoptimize) {
+    protected void deoptimize(DeoptimizeNode deoptimize) {
         node(deoptimize);
     }
 
-    protected void controlSplit(ControlSplit controlSplit) {
+    protected void controlSplit(ControlSplitNode controlSplit) {
         node(controlSplit);
     }
 
-    protected void returnNode(Return returnNode) {
+    protected void returnNode(ReturnNode returnNode) {
         node(returnNode);
     }
 
-    protected void invoke(Invoke invoke) {
+    protected void invoke(InvokeNode invoke) {
         node(invoke);
     }
 
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public abstract class AbstractMemoryCheckpointNode extends StateSplit {
-
-    @Input    private final NodeInputList mergedNodes = new NodeInputList(this);
-
-    private static final int SUCCESSOR_COUNT = 0;
-    private static final int INPUT_COUNT = 0;
-
-    public AbstractMemoryCheckpointNode(Graph graph) {
-        this(CiKind.Illegal, graph);
-    }
-
-    public AbstractMemoryCheckpointNode(CiKind result, Graph graph) {
-        super(result, graph);
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map debugProperties = super.getDebugProperties();
-        debugProperties.put("memoryCheckpoint", "true");
-        return debugProperties;
-    }
-
-    public NodeInputList mergedNodes() {
-        return mergedNodes;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public abstract class AbstractVectorNode extends StateSplit {
-    @Input private AbstractVectorNode vector;
-
-    public AbstractVectorNode vector() {
-        return vector;
-    }
-
-    public void setVector(AbstractVectorNode x) {
-        updateUsages(vector, x);
-        vector = x;
-    }
-
-    public AbstractVectorNode(CiKind kind, AbstractVectorNode vector, Graph graph) {
-        super(kind, graph);
-        setVector(vector);
-    }
-
-    protected static AbstractVectorNode findCommonNode(AbstractVectorNode left, AbstractVectorNode right, List leftList, List rightList) {
-        Set occured = new HashSet();
-        AbstractVectorNode common = null;
-        AbstractVectorNode cur = left;
-        while (cur != null) {
-            occured.add(cur);
-            cur = cur.vector();
-        }
-
-        cur = right;
-        while (cur != null) {
-            if (occured.contains(cur)) {
-                common = cur;
-                break;
-            }
-            cur = cur.vector();
-        }
-
-        fillUntil(left, cur, leftList);
-        fillUntil(right, cur, rightList);
-        return common;
-    }
-
-    private static void fillUntil(AbstractVectorNode left, AbstractVectorNode until, List leftList) {
-        AbstractVectorNode cur = left;
-        while (cur != null && cur != until) {
-            leftList.add(cur);
-            cur = cur.vector();
-        }
-    }
-
-    public void addToLoop(LoopBegin loop, IdentityHashMap nodes) {
-        throw new IllegalStateException("unimplemented");
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * This the base class of all array operations.
- */
-public abstract class AccessArray extends StateSplit {
-
-    @Input    private ValueNode array;
-
-    public ValueNode array() {
-        return array;
-    }
-
-    public void setArray(ValueNode x) {
-        updateUsages(array, x);
-        array = x;
-    }
-
-    /**
-     * Creates a new AccessArray instruction.
-     * @param kind the type of the result of this instruction
-     * @param array the instruction that produces the array object value
-     * @param graph
-     */
-    public AccessArray(CiKind kind, ValueNode array, Graph graph) {
-        super(kind, graph);
-        setArray(array);
-    }
-
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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.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.*;
-
-/**
- * The base class of all instructions that access fields.
- */
-public abstract class AccessField extends StateSplit {
-
-    @Input    private ValueNode object;
-
-    public ValueNode object() {
-        return object;
-    }
-
-    public void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
-    }
-
-    protected final RiField field;
-
-    /**
-     * Constructs a new access field object.
-     * @param kind the result kind of the access
-     * @param object the instruction producing the receiver object
-     * @param field the compiler interface representation of the field
-     * @param graph
-     */
-    public AccessField(CiKind kind, ValueNode object, RiField field, Graph graph) {
-        super(kind, graph);
-        this.field = field;
-        setObject(object);
-        assert field.isResolved();
-        assert field.holder().isInitialized();
-    }
-
-    /**
-     * Gets the compiler interface field for this field access.
-     * @return the compiler interface field for this field access
-     */
-    public RiField field() {
-        return field;
-    }
-
-    /**
-     * Checks whether this field access is an access to a static field.
-     * @return {@code true} if this field access is to a static field
-     */
-    public boolean isStatic() {
-        return Modifier.isStatic(field.accessFlags());
-    }
-
-    /**
-     * Checks whether this field is declared volatile.
-     * @return {@code true} if the field is resolved and declared volatile
-     */
-    public boolean isVolatile() {
-        return Modifier.isVolatile(field.accessFlags());
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("field", field);
-        return properties;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code AccessIndexed} class is the base class of instructions that read or write
- * elements of an array.
- */
-public abstract class AccessIndexed extends AccessArray {
-
-    @Input    private ValueNode index;
-
-    @Input    private ValueNode length;
-
-    public ValueNode index() {
-        return index;
-    }
-
-    public void setIndex(ValueNode x) {
-        updateUsages(index, x);
-        index = x;
-    }
-
-    public ValueNode length() {
-        return length;
-    }
-
-    public void setLength(ValueNode x) {
-        updateUsages(length, x);
-        length = x;
-    }
-
-    private final CiKind elementType;
-
-    /**
-     * Create an new AccessIndexed instruction.
-     * @param kind the result kind of the access
-     * @param array the instruction producing the array
-     * @param index the instruction producing the index
-     * @param length the instruction producing the length (used in bounds check elimination?)
-     * @param elementKind the type of the elements of the array
-     * @param graph
-     */
-    protected AccessIndexed(CiKind kind, ValueNode array, ValueNode index, ValueNode length, CiKind elementKind, Graph graph) {
-        super(kind, array, graph);
-        setIndex(index);
-        setLength(length);
-        this.elementType = elementKind;
-    }
-
-    /**
-     * Gets the element type of the array.
-     * @return the element type
-     */
-    public CiKind elementKind() {
-        return elementType;
-    }
-
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code AccessMonitor} instruction is the base class of both monitor acquisition and release.
- */
-public abstract class AccessMonitor extends AbstractMemoryCheckpointNode {
-
-    @Input    private ValueNode object;
-
-    @Input    private ValueNode lockAddress;
-
-    public ValueNode object() {
-        return object;
-    }
-
-    public void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
-    }
-
-    public ValueNode lockAddress() {
-        return lockAddress;
-    }
-
-    public void setLockAddress(ValueNode x) {
-        updateUsages(lockAddress, x);
-        lockAddress = x;
-    }
-
-    /**
-     * The lock number of this monitor access.
-     */
-    public final int lockNumber;
-
-    /**
-     * Creates a new AccessMonitor instruction.
-     *
-     * @param object the instruction producing the object
-     * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
-     * @param lockNumber the number of the lock being acquired
-     * @param graph
-     */
-    public AccessMonitor(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) {
-        super(CiKind.Illegal, graph);
-        this.lockNumber = lockNumber;
-        setObject(object);
-        setLockAddress(lockAddress);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public abstract class AccessNode extends AbstractMemoryCheckpointNode {
-    @Input private ValueNode object;
-    @Input private GuardNode guard;
-    @Input private LocationNode location;
-    @Input private final NodeInputList dependencies = new NodeInputList(this);
-
-    public ValueNode object() {
-        return object;
-    }
-
-    public void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
-    }
-
-    public GuardNode guard() {
-        return guard;
-    }
-
-    public void setGuard(GuardNode x) {
-        updateUsages(guard, x);
-        guard = x;
-    }
-
-    public LocationNode location() {
-        return location;
-    }
-
-    public void setLocation(LocationNode x) {
-        updateUsages(location, x);
-        location = x;
-    }
-
-    public AccessNode(CiKind kind, ValueNode object, LocationNode location, Graph graph) {
-        super(kind, graph);
-        setLocation(location);
-        setObject(object);
-    }
-
-    public void addDependency(Node x) {
-        dependencies.add(x);
-    }
-
-    public NodeInputList dependencies() {
-        return dependencies;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public abstract class AccessVectorNode extends AbstractVectorNode {
-    @Input private ValueNode object;
-    @Input private LocationNode location;
-    @Input private final NodeInputList dependencies = new NodeInputList(this);
-
-    public ValueNode object() {
-        return object;
-    }
-
-    public void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
-    }
-
-    public LocationNode location() {
-        return location;
-    }
-
-    public void setLocation(LocationNode x) {
-        updateUsages(location, x);
-        location = x;
-    }
-
-    public AccessVectorNode(CiKind kind, AbstractVectorNode vector, ValueNode object, LocationNode location, Graph graph) {
-        super(kind, vector, graph);
-        setObject(object);
-        setLocation(location);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code Anchor} instruction represents the end of a block with an unconditional jump to another block.
- */
-public final class Anchor extends FixedNodeWithNext {
-
-    @Input private final NodeInputList guards = new NodeInputList(this);
-
-    public Anchor(Graph graph) {
-        super(CiKind.Illegal, graph);
-    }
-
-    public void addGuard(GuardNode x) {
-        guards.add(x);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitAnchor(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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 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 And extends Logic implements Canonicalizable {
-
-    public And(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.IAND : Bytecodes.LAND, x, y, graph);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x() == y()) {
-            return x();
-        }
-        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 == -1) {
-                    return x();
-                }
-                if (c == 0) {
-                    return Constant.forInt(0, graph());
-                }
-            } else {
-                assert kind == CiKind.Long;
-                long c = y().asConstant().asLong();
-                if (c == -1) {
-                    return x();
-                }
-                if (c == 0) {
-                    return Constant.forLong(0, graph());
-                }
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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.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 ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc.
- */
-public abstract class Arithmetic extends Binary {
-
-    private final boolean isStrictFP;
-
-    /**
-     * Creates a new arithmetic operation.
-     * @param opcode the bytecode opcode
-     * @param kind the result kind of the operation
-     * @param x the first input instruction
-     * @param y the second input instruction
-     * @param isStrictFP indicates this operation has strict rounding semantics
-     */
-    public Arithmetic(CiKind kind, int opcode, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
-        super(kind, opcode, x, y, graph);
-        this.isStrictFP = isStrictFP;
-    }
-
-    /**
-     * Checks whether this instruction has strict fp semantics.
-     * @return {@code true} if this instruction has strict fp semantics
-     */
-    public boolean isStrictFP() {
-        return isStrictFP;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitArithmetic(this);
-    }
-
-    public boolean isCommutative() {
-        return Bytecodes.isCommutative(opcode);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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.graph.*;
-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 ArrayLength} instruction gets the length of an array.
- */
-public final class ArrayLength extends FloatingNode implements Canonicalizable {
-
-    @Input private ValueNode array;
-
-    public ValueNode array() {
-        return array;
-    }
-
-    public void setArray(ValueNode x) {
-        updateUsages(array, x);
-        array = x;
-    }
-
-    /**
-     * Constructs a new ArrayLength instruction.
-     *
-     * @param array the instruction producing the array
-     * @param newFrameState the state after executing this instruction
-     */
-    public ArrayLength(ValueNode array, Graph graph) {
-        super(CiKind.Int, graph);
-        setArray(array);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitArrayLength(this);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (array() instanceof NewArray) {
-            ValueNode length = ((NewArray) array()).dimension(0);
-            assert length != null;
-            return length;
-        }
-        CiConstant constantValue = null;
-        if (array().isConstant()) {
-            constantValue = array().asConstant();
-            if (constantValue != null && constantValue.isNonNull()) {
-                if (graph() instanceof CompilerGraph) {
-                    RiRuntime runtime = ((CompilerGraph) graph()).runtime();
-                    return Constant.forInt(runtime.getArrayLength(constantValue), graph());
-                }
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +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.ir.Phi.PhiType;
-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.*;
-
-
-/**
- * LinearInductionVariable that is computed in the loops thanks to Phi(init, this + stride).
- * This will keep at least one register busy in the whole loop body
- */
-public class BasicInductionVariable extends LinearInductionVariable implements Canonicalizable{
-    public static final BIVLoweringOp LOWERING = new BIVLoweringOp();
-    @Input private LoopCounter loopCounter;
-
-    public BasicInductionVariable(CiKind kind, ValueNode init, ValueNode stride, LoopCounter counter, Graph graph) {
-        super(kind, init, stride, graph);
-        setLoopCounter(counter);
-    }
-
-    public LoopCounter loopCounter() {
-        return loopCounter;
-    }
-
-    public void setLoopCounter(LoopCounter loopCounter) {
-        updateUsages(this.loopCounter, loopCounter);
-        this.loopCounter = loopCounter;
-    }
-
-    public ValueNode init() {
-        return a();
-    }
-
-    public void setInit(ValueNode init) {
-        setA(init);
-    }
-
-    public ValueNode stride() {
-        return b();
-    }
-
-    public void setStride(ValueNode stride) {
-        setB(stride);
-    }
-
-    @Override
-    public LoopBegin loopBegin() {
-        return loopCounter().loopBegin();
-    }
-
-    @Override
-    public void peelOneIteration() {
-        this.setInit(IntegerArithmeticNode.add(init(), stride()));
-    }
-
-    /**
-     * Will lessen the register pressure but augment the code complexity with a multiplication.
-     * @return the new DerivedInductionVariable
-     */
-    public DerivedInductionVariable toDerivedInductionVariable() {
-        DerivedInductionVariable newDIV = new DerivedInductionVariable(kind, init(), stride(), loopCounter(), graph());
-        this.replaceAndDelete(newDIV);
-        return newDIV;
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (this.init().isConstant() && this.init().asConstant().asLong() == 0
-                        && this.stride().isConstant() && this.stride().asConstant().asLong() == 1) {
-            return this.loopCounter();
-        }
-        return this;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LoweringOp.class) {
-            return (T) LOWERING;
-        }
-        return super.lookup(clazz);
-    }
-
-    public static class BIVLoweringOp implements LoweringOp {
-        @Override
-        public void lower(Node n, CiLoweringTool tool) {
-            BasicInductionVariable biv = (BasicInductionVariable) n;
-            Phi phi = this.ivToPhi(biv.loopBegin(), biv.init(), biv.stride(), biv.kind);
-            biv.replaceAtNonIVUsages(phi);
-        }
-
-        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);
-            phi.addInput(after);
-            return phi;
-        }
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.bytecode.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code Op2} class is the base of arithmetic and logic operations with two inputs.
- */
-public abstract class Binary extends FloatingNode {
-
-    @Input private ValueNode x;
-    @Input private ValueNode y;
-    @Data public final int opcode;
-
-    public ValueNode x() {
-        return x;
-    }
-
-    public void setX(ValueNode x) {
-        updateUsages(this.x, x);
-        this.x = x;
-    }
-
-    public ValueNode y() {
-        return y;
-    }
-
-    public void setY(ValueNode x) {
-        updateUsages(y, x);
-        this.y = x;
-    }
-
-    /**
-     * Creates a new Op2 instance.
-     * @param kind the result type of this instruction
-     * @param opcode the bytecode opcode
-     * @param x the first input instruction
-     * @param y the second input instruction
-     */
-    public Binary(CiKind kind, int opcode, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, graph);
-        this.opcode = opcode;
-        setX(x);
-        setY(y);
-    }
-
-    /**
-     * Swaps the operands of this instruction. This is only legal for commutative operations.
-     */
-    public void swapOperands() {
-        assert Bytecodes.isCommutative(opcode);
-        ValueNode t = x();
-        setX(y());
-        setY(t);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BlockClosure.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BlockClosure.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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 com.oracle.max.graal.compiler.schedule.*;
-
-/**
- * The {@code BlockClosure} interface represents a closure for iterating over blocks.
- */
-public interface BlockClosure {
-    void apply(Block block);
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BlockList.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BlockList.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +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.*;
-
-/**
- * The {@code BlockList} class implements a specialized list data structure for representing
- * the predecessor and successor lists of basic blocks.
- */
-public class BlockList implements Iterable {
-
-    private Merge[] array;
-    private int cursor;
-
-    BlockList(int sizeHint) {
-        if (sizeHint > 0) {
-            array = new Merge[sizeHint];
-        } else {
-            array = new Merge[2];
-        }
-    }
-
-    public void remove(int index) {
-        if (index < 0 || index >= cursor) {
-            throw new IndexOutOfBoundsException();
-        }
-        for (int i = index; i < cursor; i++) {
-            array[i] = array[i + 1];
-        }
-        cursor--;
-    }
-
-    public void remove(Merge block) {
-        int j = 0;
-        for (int i = 0; i < cursor; i++) {
-            if (i != j) {
-                array[j] = array[i];
-            }
-            if (array[i] != block) {
-                j++;
-            }
-        }
-        cursor = j;
-    }
-
-    public void exchange(int index1, int index2) {
-        if (index1 < 0 || index1 >= cursor) {
-            throw new IndexOutOfBoundsException();
-        }
-        if (index2 < 0 || index2 >= cursor) {
-            throw new IndexOutOfBoundsException();
-        }
-        Merge t = array[index2];
-        array[index2] = array[index1];
-        array[index1] = t;
-    }
-
-    public void insert(int index, Merge block) {
-        if (index < 0 || index >= cursor) {
-            throw new IndexOutOfBoundsException();
-        }
-        growOne();
-        for (int i = cursor; i > index; i--) {
-            array[i] = array[i - 1];
-        }
-        array[cursor++] = block;
-    }
-
-    public void append(Merge block) {
-        growOne();
-        array[cursor++] = block;
-    }
-
-    public Merge get(int index) {
-        if (index < 0 || index >= cursor) {
-            throw new IndexOutOfBoundsException();
-        }
-        return array[index];
-    }
-
-    public void replace(Merge oldBlock, Merge newBlock) {
-        for (int i = 0; i < cursor; i++) {
-            if (array[i] == oldBlock) {
-                array[i] = newBlock;
-            }
-        }
-    }
-
-    public boolean checkForSameBlock() {
-        if (cursor == 0) {
-            return true;
-        }
-        Merge b = array[0];
-        for (int i = 1; i < cursor; i++) {
-            if (array[i] != b) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    public Iterator iterator() {
-        return new Iter();
-    }
-
-    private void growOne() {
-        if (cursor == array.length) {
-            array = Arrays.copyOf(array, array.length * 3);
-        }
-    }
-
-    private class Iter implements Iterator {
-        private int pos;
-
-        public boolean hasNext() {
-            return pos < cursor;
-        }
-
-        public Merge next() {
-            return array[pos++];
-        }
-
-        public void remove() {
-            BlockList.this.remove(pos);
-        }
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BooleanNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BooleanNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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.graph.*;
-import com.sun.cri.ci.*;
-
-
-public abstract class BooleanNode extends FloatingNode {
-
-    public BooleanNode(CiKind kind, Graph graph) {
-        super(kind, graph);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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.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 ValueNode value;
-
-    public ValueNode value() {
-        return value;
-    }
-
-    public void setValue(ValueNode x) {
-        updateUsages(value, x);
-        value = x;
-    }
-
-    public CastNode(CiKind kind, ValueNode n, Graph graph) {
-        super(kind, graph);
-        setValue(n);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LIRGeneratorOp.class) {
-            return (T) new LIRGeneratorOp() {
-                @Override
-                public void generate(Node n, LIRGeneratorTool generator) {
-                    CastNode conv = (CastNode) n;
-                    conv.setOperand(generator.load(conv.value()));
-                }
-            };
-        }
-        return super.lookup(clazz);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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.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.*;
-import com.sun.cri.ri.*;
-
-/**
- * The {@code CheckCast} instruction represents a {@link Bytecodes#CHECKCAST}.
- */
-public final class CheckCast extends TypeCheckNode implements Canonicalizable {
-
-    /**
-     * Creates a new CheckCast instruction.
-     *
-     * @param targetClass the class being cast to
-     * @param object the instruction producing the object
-     * @param graph
-     */
-    public CheckCast(ValueNode targetClassInstruction, ValueNode object, Graph graph) {
-        super(targetClassInstruction, object, CiKind.Object, graph);
-    }
-
-    /**
-     * Gets the declared type of the result of this instruction.
-     *
-     * @return the declared type of the result
-     */
-    @Override
-    public RiType declaredType() {
-        return targetClass();
-    }
-
-    /**
-     * Gets the exact type of the result of this instruction.
-     *
-     * @return the exact type of the result
-     */
-    @Override
-    public RiType exactType() {
-        return targetClass().isResolved() ? targetClass().exactType() : null;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitCheckCast(this);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (object().exactType() != null) {
-            return object();
-        }
-        CiConstant constant = object().asConstant();
-        if (constant != null) {
-            assert constant.kind == CiKind.Object;
-            if (constant.isNull()) {
-                return object();
-            } else {
-                // this should never happen - non-null constants are always expected to provide an exactType
-                assert false;
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2011, 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.graph.*;
-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.*;
-
-/* (tw/gd) For high-level optimization purpose the compare node should be a boolean *value* (it is currently only a helper node)
- * But in the back-end the comparison should not always be materialized (for example in x86 the comparison result will not be in a register but in a flag)
- *
- * Compare should probably be made a value (so that it can be canonicalized for example) and in later stages some Compare usage should be transformed
- * into variants that do not materialize the value (CompareIf, CompareGuard...)
- *
- */
-public final class Compare extends BooleanNode implements Canonicalizable {
-
-    @Input private ValueNode x;
-    @Input private ValueNode y;
-
-    @Data private Condition condition;
-    @Data private boolean unorderedIsTrue;
-
-    public ValueNode x() {
-        return x;
-    }
-
-    public void setX(ValueNode x) {
-        updateUsages(this.x, x);
-        this.x = x;
-    }
-
-    public ValueNode y() {
-        return y;
-    }
-
-    public void setY(ValueNode x) {
-        updateUsages(y, x);
-        this.y = x;
-    }
-
-    /**
-     * Constructs a new Compare instruction.
-     *
-     * @param x the instruction producing the first input to the instruction
-     * @param condition the condition (comparison operation)
-     * @param y the instruction that produces the second input to this instruction
-     * @param 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;
-        setX(x);
-        setY(y);
-    }
-
-    /**
-     * Gets the condition (comparison operation) for this instruction.
-     *
-     * @return the condition
-     */
-    public Condition condition() {
-        return condition;
-    }
-
-    /**
-     * Checks whether unordered inputs mean true or false.
-     *
-     * @return {@code true} if unordered inputs produce true
-     */
-    public boolean unorderedIsTrue() {
-        return unorderedIsTrue;
-    }
-
-    public void setUnorderedIsTrue(boolean unorderedIsTrue) {
-        this.unorderedIsTrue = unorderedIsTrue;
-    }
-
-    /**
-     * Swaps the operands to this if and mirrors the condition (e.g. > becomes <).
-     *
-     * @see Condition#mirror()
-     */
-    public void swapOperands() {
-        condition = condition.mirror();
-        ValueNode t = x();
-        setX(y());
-        setY(t);
-    }
-
-    public void negate() {
-        condition = condition.negate();
-        unorderedIsTrue = !unorderedIsTrue;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-    }
-
-    @Override
-    public String shortName() {
-        return "Comp " + condition.operator;
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("unorderedIsTrue", unorderedIsTrue());
-        return properties;
-    }
-
-    private Node optimizeMaterialize(CiConstant constant, MaterializeNode materializeNode) {
-        if (constant.kind == CiKind.Int) {
-            boolean isFalseCheck = (constant.asInt() == 0);
-            if (condition == Condition.EQ || condition == Condition.NE) {
-                if (condition == Condition.NE) {
-                    isFalseCheck = !isFalseCheck;
-                }
-                BooleanNode result = materializeNode.condition();
-                if (isFalseCheck) {
-                    result = new NegateBooleanNode(result, graph());
-                }
-                return result;
-            }
-        }
-        return this;
-    }
-
-    private Node optimizeNormalizeCmp(CiConstant constant, NormalizeCompare normalizeNode) {
-        if (constant.kind == CiKind.Int && constant.asInt() == 0) {
-            Condition condition = condition();
-            if (normalizeNode == y()) {
-                condition = condition.mirror();
-            }
-            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()));
-            return result;
-        }
-        return this;
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant() && !y().isConstant()) { // move constants to the left (y)
-            swapOperands();
-        } else if (x().isConstant() && y().isConstant()) {
-            CiConstant constX = x().asConstant();
-            CiConstant constY = y().asConstant();
-            Boolean result = condition().foldCondition(constX, constY, ((CompilerGraph) graph()).runtime(), unorderedIsTrue());
-            if (result != null) {
-                return Constant.forBoolean(result, graph());
-            }
-        }
-
-        if (y().isConstant()) {
-            if (x() instanceof MaterializeNode) {
-                return optimizeMaterialize(y().asConstant(), (MaterializeNode) x());
-            } else if (x() instanceof NormalizeCompare) {
-                return optimizeNormalizeCmp(y().asConstant(), (NormalizeCompare) x());
-            }
-        }
-
-        if (x() == y() && x().kind != CiKind.Float && x().kind != CiKind.Double) {
-            return Constant.forBoolean(condition().check(1, 1), graph());
-        }
-        if ((condition == Condition.NE || condition == Condition.EQ) && x().kind == CiKind.Object) {
-            ValueNode object = null;
-            if (x().isNullConstant()) {
-                object = y();
-            } else if (y().isNullConstant()) {
-                object = x();
-            }
-            if (object != null) {
-                IsNonNull nonNull = new IsNonNull(object, graph());
-                if (condition == Condition.NE) {
-                    return nonNull;
-                } else {
-                    assert condition == Condition.EQ;
-                    return new NegateBooleanNode(nonNull, graph());
-                }
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +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.*;
-import com.oracle.max.graal.compiler.debug.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.graph.*;
-
-public final class ComputeLinearScanOrder {
-
-    private final int maxBlockId; // the highest blockId of a block
-    private int numBlocks; // total number of blocks (smaller than maxBlockId)
-
-    List linearScanOrder; // the resulting list of blocks in correct order
-    List codeEmittingOrder;
-
-    final BitMap visitedBlocks; // used for recursive processing of blocks
-    final BitMap activeBlocks; // used for recursive processing of blocks
-    final BitMap dominatorBlocks; // temporary BitMap used for computation of dominator
-    final int[] forwardBranches; // number of incoming forward branches for each block
-    final List workList; // temporary list (used in markLoops and computeOrder)
-    final LIRBlock[] loopHeaders;
-
-    // accessors for visitedBlocks and activeBlocks
-    void initVisited() {
-        activeBlocks.clearAll();
-        visitedBlocks.clearAll();
-    }
-
-    boolean isVisited(LIRBlock b) {
-        return visitedBlocks.get(b.blockID());
-    }
-
-    boolean isActive(LIRBlock b) {
-        return activeBlocks.get(b.blockID());
-    }
-
-    void setVisited(LIRBlock b) {
-        assert !isVisited(b) : "already set";
-        visitedBlocks.set(b.blockID());
-    }
-
-    void setActive(LIRBlock b) {
-        assert !isActive(b) : "already set";
-        activeBlocks.set(b.blockID());
-    }
-
-    void clearActive(LIRBlock b) {
-        assert isActive(b) : "not already";
-        activeBlocks.clear(b.blockID());
-    }
-
-    // accessors for forwardBranches
-    void incForwardBranches(LIRBlock b) {
-        forwardBranches[b.blockID()]++;
-    }
-
-    int decForwardBranches(LIRBlock b) {
-        return --forwardBranches[b.blockID()];
-    }
-
-    // accessors for final result
-    public List linearScanOrder() {
-        return linearScanOrder;
-    }
-
-    public ComputeLinearScanOrder(int maxBlockId, int loopCount, LIRBlock startBlock) {
-        loopHeaders = new LIRBlock[loopCount];
-
-        this.maxBlockId = maxBlockId;
-        visitedBlocks = new BitMap(maxBlockId);
-        activeBlocks = new BitMap(maxBlockId);
-        dominatorBlocks = new BitMap(maxBlockId);
-        forwardBranches = new int[maxBlockId];
-        workList = new ArrayList(8);
-
-        countEdges(startBlock, null);
-        computeOrder(startBlock);
-        printBlocks();
-    }
-
-    /**
-     * Traverses the CFG to analyze block and edge info. The analysis performed is:
-     *
-     * 1. Count of total number of blocks.
-     * 2. Count of all incoming edges and backward incoming edges.
-     * 3. Number loop header blocks.
-     * 4. Create a list with all loop end blocks.
-     */
-    void countEdges(LIRBlock cur, LIRBlock parent) {
-        if (GraalOptions.TraceLinearScanLevel >= 3) {
-            TTY.println("Counting edges for block B%d%s", cur.blockID(), parent == null ? "" : " coming from B" + parent.blockID());
-        }
-
-        if (isActive(cur)) {
-            return;
-        }
-
-        // increment number of incoming forward branches
-        incForwardBranches(cur);
-
-        if (isVisited(cur)) {
-            if (GraalOptions.TraceLinearScanLevel >= 3) {
-                TTY.println("block already visited");
-            }
-            return;
-        }
-
-        numBlocks++;
-        setVisited(cur);
-        setActive(cur);
-
-        // recursive call for all successors
-        int i;
-        for (i = cur.numberOfSux() - 1; i >= 0; i--) {
-            countEdges(cur.suxAt(i), cur);
-        }
-
-        clearActive(cur);
-
-        if (GraalOptions.TraceLinearScanLevel >= 3) {
-            TTY.println("Finished counting edges for block B%d", cur.blockID());
-        }
-    }
-
-    int computeWeight(LIRBlock cur) {
-
-        // limit loop-depth to 15 bit (only for security reason, it will never be so big)
-        int weight = (cur.loopDepth() & 0x7FFF) << 16;
-
-        int curBit = 15;
-
-        // this is necessary for the (very rare) case that two successive blocks have
-        // the same loop depth, but a different loop index (can happen for endless loops
-        // with exception handlers)
-//        if (!cur.isLinearScanLoopHeader()) {
-//            weight |= 1 << curBit;
-//        }
-//        curBit--;
-
-        // loop end blocks (blocks that end with a backward branch) are added
-        // after all other blocks of the loop.
-        if (!cur.isLinearScanLoopEnd()) {
-            weight |= 1 << curBit;
-        }
-        curBit--;
-
-        // critical edge split blocks are preferred because then they have a greater
-        // probability to be completely empty
-        //if (cur.isCriticalEdgeSplit()) {
-        //    weight |= 1 << curBit;
-        //}
-        //curBit--;
-
-        // exceptions should not be thrown in normal control flow, so these blocks
-        // are added as late as possible
-//        if (!(cur.end() instanceof Throw) && (singleSux == null || !(singleSux.end() instanceof Throw))) {
-//            weight |= 1 << curBit;
-//        }
-//        curBit--;
-//        if (!(cur.end() instanceof Return) && (singleSux == null || !(singleSux.end() instanceof Return))) {
-//            weight |= 1 << curBit;
-//        }
-//        curBit--;
-
-        // exceptions handlers are added as late as possible
-        if (!cur.isExceptionEntry()) {
-            weight |= 1 << curBit;
-        }
-        curBit--;
-
-        // guarantee that weight is > 0
-        weight |= 1;
-
-        assert curBit >= 0 : "too many flags";
-        assert weight > 0 : "weight cannot become negative";
-
-        return weight;
-    }
-
-    private boolean readyForProcessing(LIRBlock cur) {
-        // Discount the edge just traveled.
-        // When the number drops to zero, all forward branches were processed
-        if (decForwardBranches(cur) != 0) {
-            return false;
-        }
-
-        assert !linearScanOrder.contains(cur) : "block already processed (block can be ready only once)";
-        assert !workList.contains(cur) : "block already in work-list (block can be ready only once)";
-        return true;
-    }
-
-    private void sortIntoWorkList(LIRBlock cur) {
-        assert !workList.contains(cur) : "block already in work list";
-
-        int curWeight = computeWeight(cur);
-
-        // the linearScanNumber is used to cache the weight of a block
-        cur.setLinearScanNumber(curWeight);
-
-        if (GraalOptions.StressLinearScan) {
-            workList.add(0, cur);
-            return;
-        }
-
-        workList.add(null); // provide space for new element
-
-        int insertIdx = workList.size() - 1;
-        while (insertIdx > 0 && workList.get(insertIdx - 1).linearScanNumber() > curWeight) {
-            workList.set(insertIdx, workList.get(insertIdx - 1));
-            insertIdx--;
-        }
-        workList.set(insertIdx, cur);
-
-        if (GraalOptions.TraceLinearScanLevel >= 3) {
-            TTY.println("Sorted B%d into worklist. new worklist:", cur.blockID());
-            for (int i = 0; i < workList.size(); i++) {
-                TTY.println(String.format("%8d B%02d  weight:%6x", i, workList.get(i).blockID(), workList.get(i).linearScanNumber()));
-            }
-        }
-
-        for (int i = 0; i < workList.size(); i++) {
-            assert workList.get(i).linearScanNumber() > 0 : "weight not set";
-            assert i == 0 || workList.get(i - 1).linearScanNumber() <= workList.get(i).linearScanNumber() : "incorrect order in worklist";
-        }
-    }
-
-    private void appendBlock(LIRBlock cur) {
-        if (GraalOptions.TraceLinearScanLevel >= 3) {
-            TTY.println("appending block B%d (weight 0x%06x) to linear-scan order", cur.blockID(), cur.linearScanNumber());
-        }
-        assert !linearScanOrder.contains(cur) : "cannot add the same block twice";
-
-        // currently, the linear scan order and code emit order are equal.
-        // therefore the linearScanNumber and the weight of a block must also
-        // be equal.
-        cur.setLinearScanNumber(linearScanOrder.size());
-        linearScanOrder.add(cur);
-
-        if (!cur.isLinearScanLoopHeader() || !GraalOptions.OptReorderLoops) {
-            codeEmittingOrder.add(cur);
-
-            if (cur.isLinearScanLoopEnd() && GraalOptions.OptReorderLoops) {
-                LIRBlock loopHeader = loopHeaders[cur.loopIndex()];
-                assert loopHeader != null;
-                codeEmittingOrder.add(loopHeader);
-
-                for (LIRBlock succ : loopHeader.blockSuccessors()) {
-                    if (succ.loopDepth() == loopHeader.loopDepth()) {
-                        succ.setAlign(true);
-                    }
-                }
-            }
-        } else {
-            loopHeaders[cur.loopIndex()] = cur;
-        }
-    }
-
-    private void computeOrder(LIRBlock startBlock) {
-        if (GraalOptions.TraceLinearScanLevel >= 3) {
-            TTY.println("----- computing final block order");
-        }
-
-        // the start block is always the first block in the linear scan order
-        linearScanOrder = new ArrayList(numBlocks);
-
-        codeEmittingOrder = new ArrayList(numBlocks);
-
-        // start processing with standard entry block
-        assert workList.isEmpty() : "list must be empty before processing";
-
-        assert readyForProcessing(startBlock);
-        sortIntoWorkList(startBlock);
-
-        do {
-            LIRBlock cur = workList.remove(workList.size() - 1);
-            appendBlock(cur);
-
-            int i;
-            int numSux = cur.numberOfSux();
-            // changed loop order to get "intuitive" order of if- and else-blocks
-            for (i = 0; i < numSux; i++) {
-                LIRBlock sux = cur.suxAt(i);
-                if (readyForProcessing(sux)) {
-                    sortIntoWorkList(sux);
-                }
-            }
-        } while (workList.size() > 0);
-    }
-
-    public void printBlocks() {
-        if (GraalOptions.TraceLinearScanLevel >= 2) {
-            TTY.println("----- loop information:");
-            for (LIRBlock cur : linearScanOrder) {
-                TTY.print(String.format("%4d: B%02d: ", cur.linearScanNumber(), cur.blockID()));
-                TTY.println(String.format(" . loopIndex: %2d, loopDepth: %2d", cur.loopIndex(), cur.loopDepth()));
-            }
-        }
-
-        if (GraalOptions.TraceLinearScanLevel >= 1) {
-            TTY.println("----- linear-scan block order:");
-            for (LIRBlock cur : linearScanOrder) {
-                TTY.print(String.format("%4d: B%02d    loop: %2d  depth: %2d", cur.linearScanNumber(), cur.blockID(), cur.loopIndex(), cur.loopDepth()));
-
-                TTY.print(cur.isLinearScanLoopHeader() ? " lh" : "   ");
-                TTY.print(cur.isLinearScanLoopEnd() ? " le" : "   ");
-
-                TTY.print("    dom: null ");
-
-
-                if (cur.numberOfPreds() > 0) {
-                    TTY.print("    preds: ");
-                    for (int j = 0; j < cur.numberOfPreds(); j++) {
-                        LIRBlock pred = cur.predAt(j);
-                        TTY.print("B%d ", pred.blockID());
-                    }
-                }
-                if (cur.numberOfSux() > 0) {
-                    TTY.print("    sux: ");
-                    for (int j = 0; j < cur.numberOfSux(); j++) {
-                        LIRBlock sux = cur.suxAt(j);
-                        TTY.print("B%d ", sux.blockID());
-                    }
-                }
-                TTY.println();
-            }
-        }
-    }
-
-    public List codeEmittingOrder() {
-        return codeEmittingOrder;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Condition.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Condition.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,262 +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.sun.cri.ci.*;
-import com.sun.cri.ri.*;
-
-/**
- * Condition codes used in conditionals.
- */
-public enum Condition {
-    /**
-     * Equal.
-     */
-    EQ("=="),
-
-    /**
-     * Not equal.
-     */
-    NE("!="),
-
-    /**
-     * Signed less than.
-     */
-    LT("<"),
-
-    /**
-     * Signed less than or equal.
-     */
-    LE("<="),
-
-    /**
-     * Signed greater than.
-     */
-    GT(">"),
-
-    /**
-     * Signed greater than or equal.
-     */
-    GE(">="),
-
-    /**
-     * Unsigned greater than or equal ("above than or equal").
-     */
-    AE("|>=|"),
-
-    /**
-     * Unsigned less than or equal ("below than or equal").
-     */
-    BE("|<=|"),
-
-    /**
-     * Unsigned greater than ("above than").
-     */
-    AT("|>|"),
-
-    /**
-     * Unsigned less than ("below than").
-     */
-    BT("|<|"),
-
-    /**
-     * Operation produced an overflow.
-     */
-    OF("overflow"),
-
-    /**
-     * Operation did not produce an overflow.
-     */
-    NOF("noOverflow"),
-
-    TRUE("TRUE");
-
-    public final String operator;
-
-    private Condition(String operator) {
-        this.operator = operator;
-    }
-
-    public boolean check(int left, int right) {
-        switch (this) {
-            case EQ: return left == right;
-            case NE: return left != right;
-            case LT: return left < right;
-            case LE: return left <= right;
-            case GT: return left > right;
-            case GE: return left >= right;
-            case BT: return (left & 0xffffffffL) < (right & 0xffffffffL);
-            case BE: return (left & 0xffffffffL) <= (right & 0xffffffffL);
-            case AT: return (left & 0xffffffffL) > (right & 0xffffffffL);
-            case AE: return (left & 0xffffffffL) >= (right & 0xffffffffL);
-        }
-        throw new IllegalArgumentException();
-    }
-
-    /**
-     * Negate this conditional.
-     * @return the condition that represents the negation
-     */
-    public final Condition negate() {
-        switch (this) {
-            case EQ: return NE;
-            case NE: return EQ;
-            case LT: return GE;
-            case LE: return GT;
-            case GT: return LE;
-            case GE: return LT;
-            case BT: return AE;
-            case BE: return AT;
-            case AT: return BE;
-            case AE: return BT;
-            case OF: return NOF;
-            case NOF: return OF;
-        }
-        throw new IllegalArgumentException(this.toString());
-    }
-
-    /**
-     * Mirror this conditional (i.e. commute "a op b" to "b op' a")
-     * @return the condition representing the equivalent commuted operation
-     */
-    public final Condition mirror() {
-        switch (this) {
-            case EQ: return EQ;
-            case NE: return NE;
-            case LT: return GT;
-            case LE: return GE;
-            case GT: return LT;
-            case GE: return LE;
-            case BT: return AT;
-            case BE: return AE;
-            case AT: return BT;
-            case AE: return BE;
-        }
-        throw new IllegalArgumentException();
-    }
-
-    /**
-     * Checks if this conditional operation is commutative.
-     * @return {@code true} if this operation is commutative
-     */
-    public final boolean isCommutative() {
-        return this == EQ || this == NE;
-    }
-
-    /**
-     * Attempts to fold a comparison between two constants and return the result.
-     * @param lt the constant on the left side of the comparison
-     * @param rt the constant on the right side of the comparison
-     * @param runtime the RiRuntime (might be needed to compare runtime-specific types)
-     * @return {@link Boolean#TRUE} if the comparison is known to be true,
-     * {@link Boolean#FALSE} if the comparison is known to be false, {@code null} otherwise.
-     */
-    public Boolean foldCondition(CiConstant lt, CiConstant rt, RiRuntime runtime, boolean unorderedIsTrue) {
-        switch (lt.kind) {
-            case Boolean:
-            case Int: {
-                int x = lt.asInt();
-                int y = rt.asInt();
-                switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case LT: return x < y;
-                    case LE: return x <= y;
-                    case GT: return x > y;
-                    case GE: return x >= y;
-                    case AE: return toUnsigned(x) >= toUnsigned(y);
-                    case BE: return toUnsigned(x) <= toUnsigned(y);
-                    case AT: return toUnsigned(x) > toUnsigned(y);
-                    case BT: return toUnsigned(x) < toUnsigned(y);
-                }
-                break;
-            }
-            case Long: {
-                long x = lt.asLong();
-                long y = rt.asLong();
-                switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case LT: return x < y;
-                    case LE: return x <= y;
-                    case GT: return x > y;
-                    case GE: return x >= y;
-                }
-                break;
-            }
-            case Object: {
-                switch (this) {
-                    case EQ: return runtime.areConstantObjectsEqual(lt, rt);
-                    case NE: return !runtime.areConstantObjectsEqual(lt, rt);
-                }
-                break;
-            }
-            case Float: {
-                float x = lt.asFloat();
-                float y = rt.asFloat();
-                if (Float.isNaN(x) || Float.isNaN(y)) {
-                    return unorderedIsTrue;
-                }
-                switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case BT:
-                    case LT: return x < y;
-                    case BE:
-                    case LE: return x <= y;
-                    case AT:
-                    case GT: return x > y;
-                    case AE:
-                    case GE: return x >= y;
-                }
-            }
-            case Double: {
-                double x = lt.asDouble();
-                double y = rt.asDouble();
-                if (Double.isNaN(x) || Double.isNaN(y)) {
-                    return unorderedIsTrue;
-                }
-                switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case BT:
-                    case LT: return x < y;
-                    case BE:
-                    case LE: return x <= y;
-                    case AT:
-                    case GT: return x > y;
-                    case AE:
-                    case GE: return x >= y;
-                }
-            }
-        }
-        return null;
-    }
-
-    private long toUnsigned(int x) {
-        if (x < 0) {
-            return ((long) (x & 0x7FFFFFFF)) + ((long) Integer.MAX_VALUE) + 1;
-        }
-        return x;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +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.ir.Phi.PhiType;
-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 Conditional} class represents a comparison that yields one of two values. Note that these nodes are not
- * built directly from the bytecode but are introduced by conditional expression elimination.
- */
-public class Conditional extends Binary implements Canonicalizable {
-
-    @Input private BooleanNode condition;
-
-    public BooleanNode condition() {
-        return condition;
-    }
-
-    public void setCondition(BooleanNode n) {
-        updateUsages(condition, n);
-        condition = n;
-    }
-
-    /**
-     * Constructs a new IfOp.
-     *
-     * @param x the instruction producing the first value to be compared
-     * @param condition the condition of the comparison
-     * @param y the instruction producing the second value to be compared
-     * @param trueValue the value produced if the condition is true
-     * @param falseValue the value produced if the condition is false
-     */
-    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);
-    }
-
-    // for copying
-    private Conditional(CiKind kind, Graph graph) {
-        super(kind, Bytecodes.ILLEGAL, null, null, graph);
-    }
-
-    public ValueNode trueValue() {
-        return x();
-    }
-
-    public ValueNode falseValue() {
-        return y();
-    }
-
-    public void setTrueValue(ValueNode value) {
-        setX(value);
-    }
-
-    public void setFalseValue(ValueNode value) {
-        setY(value);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LIRGeneratorOp.class) {
-            return (T) LIRGEN;
-        }
-        return super.lookup(clazz);
-    }
-
-    public static class ConditionalStructure {
-
-        public final If ifNode;
-        public final Phi phi;
-        public final Merge merge;
-
-        public ConditionalStructure(If ifNode, Phi phi, Merge merge) {
-            this.ifNode = ifNode;
-            this.phi = phi;
-            this.merge = merge;
-        }
-    }
-
-    public static ConditionalStructure createConditionalStructure(BooleanNode condition, ValueNode trueValue, ValueNode falseValue) {
-        return createConditionalStructure(condition, trueValue, falseValue, 0.5);
-    }
-
-    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);
-        EndNode trueEnd = new EndNode(graph);
-        EndNode falseEnd = new EndNode(graph);
-        ifNode.setTrueSuccessor(trueEnd);
-        ifNode.setFalseSuccessor(falseEnd);
-        Merge merge = new Merge(graph);
-        merge.addEnd(trueEnd);
-        merge.addEnd(falseEnd);
-        Phi phi = new Phi(kind, merge, PhiType.Value, graph);
-        phi.addInput(trueValue);
-        phi.addInput(falseValue);
-        return new ConditionalStructure(ifNode, phi, merge);
-    }
-
-    private static final LIRGeneratorOp LIRGEN = new LIRGeneratorOp() {
-
-        @Override
-        public void generate(Node n, LIRGeneratorTool generator) {
-            generator.visitConditional((Conditional) n);
-        }
-    };
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (condition instanceof Constant) {
-            Constant c = (Constant) condition;
-            if (c.asConstant().asBoolean()) {
-                return trueValue();
-            } else {
-                return falseValue();
-            }
-        }
-        if (trueValue() == falseValue()) {
-            return trueValue();
-        }
-        if (!(this instanceof MaterializeNode) && trueValue() instanceof Constant && falseValue() instanceof Constant && trueValue().kind == CiKind.Int && falseValue().kind == CiKind.Int) {
-            int trueInt = trueValue().asConstant().asInt();
-            int falseInt = falseValue().asConstant().asInt();
-            if (trueInt == 0 && falseInt == 1) {
-                reProcess.reProccess(condition); // because we negate it
-                return new MaterializeNode(new NegateBooleanNode(condition, graph()), graph());
-            } else if (trueInt == 1 && falseInt == 0) {
-                return new MaterializeNode(condition, graph());
-            }
-        } else if (falseValue() instanceof Constant && !(trueValue() instanceof Constant)) {
-            ValueNode temp = trueValue();
-            setTrueValue(falseValue());
-            setFalseValue(temp);
-            condition = new NegateBooleanNode(condition, graph());
-            setCondition(condition);
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +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.GraalCompilation.*;
-
-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 Constant} instruction represents a constant such as an integer value,
- * long, float, object reference, address, etc.
- */
-public final class Constant extends BooleanNode {
-
-    @Data public final CiConstant value;
-
-    /**
-     * Constructs a new instruction representing the specified constant.
-     * @param value the constant
-     * @param graph
-     */
-    public Constant(CiConstant value, Graph graph) {
-        super(value.kind.stackKind(), graph);
-        this.value = value;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitConstant(this);
-    }
-
-    /**
-     * Creates an instruction for a double constant.
-     * @param d the double value for which to create the instruction
-     * @param graph
-     * @return an instruction representing the double
-     */
-    public static Constant forDouble(double d, Graph graph) {
-        return new Constant(CiConstant.forDouble(d), graph);
-    }
-
-    /**
-     * Creates an instruction for a float constant.
-     * @param f the float value for which to create the instruction
-     * @return an instruction representing the float
-     */
-    public static Constant forFloat(float f, Graph graph) {
-        return new Constant(CiConstant.forFloat(f), graph);
-    }
-
-    /**
-     * Creates an instruction for an long constant.
-     * @param i the long value for which to create the instruction
-     * @return an instruction representing the long
-     */
-    public static Constant forLong(long i, Graph graph) {
-        return new Constant(CiConstant.forLong(i), graph);
-    }
-
-    /**
-     * Creates an instruction for an integer constant.
-     * @param i the integer value for which to create the instruction
-     * @return an instruction representing the integer
-     */
-    public static Constant forInt(int i, Graph graph) {
-        return new Constant(CiConstant.forInt(i), graph);
-    }
-
-    /**
-     * Creates an instruction for a boolean constant.
-     * @param i the boolean value for which to create the instruction
-     * @return an instruction representing the boolean
-     */
-    public static Constant forBoolean(boolean i, Graph graph) {
-        return new Constant(CiConstant.forBoolean(i), graph);
-    }
-
-    /**
-     * Creates an instruction for an address (jsr/ret address) constant.
-     * @param i the address value for which to create the instruction
-     * @return an instruction representing the address
-     */
-    public static Constant forJsr(int i, Graph graph) {
-        return new Constant(CiConstant.forJsr(i), graph);
-    }
-
-    /**
-     * Creates an instruction for an object constant.
-     * @param o the object value for which to create the instruction
-     * @return an instruction representing the object
-     */
-    public static Constant forObject(Object o, Graph graph) {
-        return new Constant(CiConstant.forObject(o), graph);
-    }
-
-    /**
-     * Creates an instruction for a word constant.
-     * @param val the word value for which to create the instruction
-     * @return an instruction representing the word
-     */
-    public static Constant forWord(long val, Graph graph) {
-        return new Constant(CiConstant.forWord(val), graph);
-    }
-
-    public static Constant defaultForKind(CiKind kind, Graph graph) {
-        switch(kind) {
-            case Boolean:
-                return Constant.forBoolean(false, graph);
-            case Byte:
-            case Char:
-            case Short:
-            case Int:
-                return Constant.forInt(0, graph);
-            case Double:
-                return Constant.forDouble(0.0, graph);
-            case Float:
-                return Constant.forFloat(0.0f, graph);
-            case Long:
-                return Constant.forLong(0L, graph);
-            case Object:
-                return Constant.forObject(null, graph);
-            case Word:
-                return Constant.forWord(0L, graph);
-            default:
-                return null;
-        }
-    }
-
-    @Override
-    public String toString() {
-        return super.toString() + "(" + value + ")";
-    }
-
-    @Override
-    public int valueNumber() {
-        return 0x50000000 | value.hashCode();
-    }
-
-    @Override
-    public RiType declaredType() {
-        RiRuntime runtime = compilation().runtime;
-        if (kind.isPrimitive()) {
-            return runtime.asRiType(kind);
-        }
-        return runtime.getTypeOf(asConstant());
-    }
-
-    @Override
-    public RiType exactType() {
-        return declaredType();
-    }
-
-    @Override
-    public String shortName() {
-        return value.name();
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ControlSplit.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ControlSplit.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code BlockEnd} instruction is a base class for all instructions that end a basic
- * block, including branches, switches, throws, and goto's.
- */
-public abstract class ControlSplit extends FixedNode {
-
-    @Successor    private final NodeSuccessorList blockSuccessors;
-
-    public FixedNode blockSuccessor(int index) {
-        return blockSuccessors.get(index);
-    }
-
-    public void setBlockSuccessor(int index, FixedNode x) {
-        blockSuccessors.set(index, x);
-    }
-
-    public int blockSuccessorCount() {
-        return blockSuccessors.size();
-    }
-
-    protected final double[] branchProbability;
-
-    /**
-     * Constructs a new block end with the specified value type.
-     * @param kind the type of the value produced by this instruction
-     * @param successors the list of successor blocks. If {@code null}, a new one will be created.
-     */
-    public ControlSplit(CiKind kind, List blockSuccessors, double[] branchProbability, Graph graph) {
-        this(kind, blockSuccessors.size(), branchProbability, graph);
-        for (int i = 0; i < blockSuccessors.size(); i++) {
-            setBlockSuccessor(i, blockSuccessors.get(i));
-        }
-    }
-
-    public ControlSplit(CiKind kind, int blockSuccessorCount, double[] branchProbability, Graph graph) {
-        super(kind, graph);
-        this.blockSuccessors = new NodeSuccessorList(this, blockSuccessorCount);
-        assert branchProbability.length == blockSuccessorCount;
-        this.branchProbability = branchProbability;
-    }
-
-    public double probability(int successorIndex) {
-        return branchProbability[successorIndex];
-    }
-
-    public void setProbability(int successorIndex, double x) {
-        branchProbability[successorIndex] = x;
-    }
-
-    /**
-     * Gets the successor corresponding to the default (fall through) case.
-     * @return the default successor
-     */
-    public FixedNode defaultSuccessor() {
-        return blockSuccessor(blockSuccessorCount() - 1);
-    }
-
-    public Iterable blockSuccessors() {
-        return new Iterable() {
-            @Override
-            public Iterator iterator() {
-                return new Iterator() {
-                    int i = 0;
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                    @Override
-                    public FixedNode next() {
-                        return ControlSplit.this.blockSuccessor(i++);
-                    }
-
-                    @Override
-                    public boolean hasNext() {
-                        return i < ControlSplit.this.blockSuccessorCount();
-                    }
-                };
-            }
-        };
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        StringBuilder str = new StringBuilder();
-        for (int i = 0; i < branchProbability.length; i++) {
-            str.append(i == 0 ? "" : ", ").append(String.format("%7.5f", branchProbability[i]));
-        }
-        properties.put("branchProbability", str.toString());
-        return properties;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code Convert} class represents a conversion between primitive types.
- */
-public final class Convert extends FloatingNode {
-    @Input private ValueNode value;
-
-    @Data public final int opcode;
-
-    public ValueNode value() {
-        return value;
-    }
-
-    public void setValue(ValueNode x) {
-        updateUsages(value, x);
-        value = x;
-    }
-
-    /**
-     * Constructs a new Convert instance.
-     * @param opcode the bytecode representing the operation
-     * @param value the instruction producing the input value
-     * @param kind the result type of this instruction
-     * @param graph
-     */
-    public Convert(int opcode, ValueNode value, CiKind kind, Graph graph) {
-        super(kind, graph);
-        this.opcode = opcode;
-        setValue(value);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitConvert(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +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.ir.Phi.PhiType;
-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 ValueNode length;
-
-    public ValueNode length() {
-        return length;
-    }
-
-    public void setLength(ValueNode x) {
-        updateUsages(length, x);
-        length = x;
-    }
-
-    private boolean reversed;
-
-    public boolean reversed() {
-        return reversed;
-    }
-
-    public void setReversed(boolean r) {
-        reversed = r;
-    }
-
-    public CreateVectorNode(boolean reversed, ValueNode length, Graph graph) {
-        super(CiKind.Illegal, null, graph);
-        setLength(length);
-        setReversed(reversed);
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map debugProperties = super.getDebugProperties();
-        debugProperties.put("reversed", reversed);
-        return debugProperties;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LIRGeneratorOp.class) {
-            return null;
-        } else if (clazz == LoweringOp.class) {
-            return (T) LOWERING_OP;
-        }
-        return super.lookup(clazz);
-    }
-
-    private LoopBegin createLoop(Map map) {
-        EndNode end = new EndNode(graph());
-        LoopBegin loopBegin = new LoopBegin(graph());
-        loopBegin.addEnd(end);
-        Phi loopVariable = new Phi(CiKind.Int, loopBegin, PhiType.Value, graph());
-
-        if (reversed) {
-            IntegerSub add = new IntegerSub(CiKind.Int, loopVariable, Constant.forInt(1, graph()), graph());
-            loopVariable.addInput(new IntegerSub(CiKind.Int, length(), Constant.forInt(1, graph()), graph()));
-            loopVariable.addInput(add);
-        } else {
-            IntegerAdd add = new IntegerAdd(CiKind.Int, loopVariable, Constant.forInt(1, graph()), graph());
-            loopVariable.addInput(Constant.forInt(0, graph()));
-            loopVariable.addInput(add);
-        }
-
-        LoopEnd loopEnd = new LoopEnd(graph());
-        loopEnd.setLoopBegin(loopBegin);
-        loopBegin.setStateAfter(stateAfter());
-        Compare condition;
-        if (reversed) {
-            condition = new Compare(loopVariable, Condition.GE, Constant.forInt(0, graph()), graph());
-        } else {
-            condition = new Compare(loopVariable, Condition.LT, length(), graph());
-        }
-        int expectedLength = 100; // TODO: it may be possible to get a more accurate estimate...?
-        if (length().isConstant()) {
-            expectedLength = length().asConstant().asInt();
-        }
-        If ifNode = new If(condition, 1.0 / expectedLength, graph());
-        loopBegin.setNext(ifNode);
-        ifNode.setTrueSuccessor(loopEnd);
-        this.replaceAtPredecessors(end);
-        ifNode.setFalseSuccessor(this);
-        map.put(this, loopVariable);
-        return loopBegin;
-    }
-
-    private static final LoweringOp LOWERING_OP = new LoweringOp() {
-        @Override
-        public void lower(Node n, CiLoweringTool tool) {
-            CreateVectorNode vectorNode = (CreateVectorNode) n;
-
-            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) {
-            AbstractVectorNode vectorNode = (AbstractVectorNode) use;
-            if (nodes.containsKey(vectorNode)) {
-                return;
-            }
-            nodes.put(vectorNode, null);
-
-            // Make sure inputs are evaluated.
-            for (Node input : use.inputs()) {
-                if (input instanceof AbstractVectorNode) {
-                    AbstractVectorNode abstractVectorNodeInput = (AbstractVectorNode) input;
-                    processUse(loop, abstractVectorNodeInput, nodes);
-                }
-            }
-
-            vectorNode.addToLoop(loop, nodes);
-
-            // Go on to usages.
-            for (Node usage : use.usages()) {
-                processUse(loop, usage, nodes);
-            }
-        }
-    };
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-@NodeInfo(shortName = "Deopt")
-public class Deoptimize extends FixedNode {
-
-    public static enum DeoptAction {
-        None,                           // just interpret, do not invalidate nmethod
-        Recompile,                      // recompile the nmethod; need not invalidate
-        InvalidateReprofile,            // invalidate the nmethod, reset IC, maybe recompile
-        InvalidateRecompile,            // invalidate the nmethod, recompile (probably)
-        InvalidateStopCompiling,        // invalidate the nmethod and do not compile
-    }
-
-    private String message;
-    private final DeoptAction action;
-
-    public Deoptimize(DeoptAction action, Graph graph) {
-        super(CiKind.Illegal, graph);
-        this.action = action;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-
-    public String message() {
-        return message;
-    }
-
-    public DeoptAction action() {
-        return action;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitDeoptimize(this);
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("message", message);
-        properties.put("action", action);
-        return properties;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-/**
- * LinearInductionVariable that is computed in the loops with offset + scale * base.
- * This is computed in the loop only when necessary, puts less pressure on registers.
- */
-public class DerivedInductionVariable extends LinearInductionVariable {
-    @Input private InductionVariable base;
-
-    public DerivedInductionVariable(CiKind kind, ValueNode offset, ValueNode scale, InductionVariable base, Graph graph) {
-        super(kind, offset, scale, graph);
-        setBase(base);
-    }
-
-    public InductionVariable base() {
-        return base;
-    }
-
-    public void setBase(InductionVariable base) {
-        updateUsages(this.base, base);
-        this.base = base;
-    }
-
-    public ValueNode offset() {
-        return a();
-    }
-
-    public void setOffset(ValueNode offset) {
-        setA(offset);
-    }
-
-    public ValueNode scale() {
-        return b();
-    }
-
-    public void setScale(ValueNode scale) {
-        setB(scale);
-    }
-
-    @Override
-    public LoopBegin loopBegin() {
-        return base().loopBegin();
-    }
-
-    @Override
-    public void peelOneIteration() {
-        // nop
-    }
-
-    /**
-     * This will apply strength reduction to this induction variable but will augment register pressure in the loop.
-     * @return the new BasicInductionVariable
-     */
-    public BasicInductionVariable toBasicInductionVariable() {
-        InductionVariable base = base();
-        if (base instanceof DerivedInductionVariable) {
-            base = ((DerivedInductionVariable) base).toBasicInductionVariable();
-        }
-        ValueNode init;
-        ValueNode stride;
-        LoopCounter counter;
-        if (base instanceof BasicInductionVariable) {
-            BasicInductionVariable basic = (BasicInductionVariable) base;
-            // let the canonicalizer do its job with this
-            init = IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), basic.init()));
-            stride = IntegerArithmeticNode.mul(scale(), basic.stride());
-            counter = basic.loopCounter();
-        } else {
-            assert base instanceof LoopCounter;
-            init = offset();
-            stride = scale();
-            counter = (LoopCounter) base;
-        }
-        BasicInductionVariable newBIV = new BasicInductionVariable(kind, init, stride, counter, graph());
-        this.replaceAndDelete(newBIV);
-        return newBIV;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LoweringOp.class) {
-            return (T) LOWERING;
-        }
-        return super.lookup(clazz);
-    }
-
-    private static final LoweringOp LOWERING = new LoweringOp() {
-        @Override
-        public void lower(Node n, CiLoweringTool tool) {
-            DerivedInductionVariable div = (DerivedInductionVariable) n;
-            IntegerArithmeticNode computed = IntegerArithmeticNode.add(div.offset(), IntegerArithmeticNode.mul(div.scale(), div.base()));
-            div.replaceAtNonIVUsages(computed);
-        }
-    };
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public final class EndNode extends FixedNode {
-
-    public EndNode(Graph graph) {
-        super(CiKind.Illegal, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitEndNode(this);
-    }
-
-    public Merge merge() {
-        if (usages().size() == 0) {
-            return null;
-        } else {
-            assert usages().size() == 1;
-            return (Merge) usages().iterator().next();
-        }
-    }
-
-    @Override
-    public boolean verify() {
-        assertTrue(usages().size() <= 1, "at most one usage");
-        return true;
-    }
-
-    @Override
-    public Iterable< ? extends Node> dataUsages() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Iterable< ? extends Node> cfgSuccessors() {
-        Merge merge = this.merge();
-        if (merge == null) {
-            return Collections.emptyList();
-        }
-        return Arrays.asList(merge);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionEdgeInstruction.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionEdgeInstruction.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +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;
-
-
-public interface ExceptionEdgeInstruction {
-    FixedNode exceptionEdge();
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code ExceptionObject} instruction represents the incoming exception object to an exception handler.
- */
-public final class ExceptionObject extends StateSplit {
-
-    /**
-     * Constructs a new ExceptionObject instruction.
-     * @param graph
-     */
-    public ExceptionObject(Graph graph) {
-        super(CiKind.Object, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitExceptionObject(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +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.ir.Deoptimize.DeoptAction;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-public final class FixedGuard extends FixedNodeWithNext implements Canonicalizable {
-
-    @Input private final NodeInputList conditions = new NodeInputList(this);
-
-    public FixedGuard(BooleanNode node, Graph graph) {
-        this(graph);
-        addNode(node);
-    }
-
-    public FixedGuard(Graph graph) {
-        super(CiKind.Illegal, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitFixedGuard(this);
-    }
-
-    public void addNode(BooleanNode x) {
-        conditions.add(x);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        for (BooleanNode n : conditions.snapshot()) {
-            if (n instanceof Constant) {
-                Constant c = (Constant) n;
-                if (c.asConstant().asBoolean()) {
-                    conditions.remove(n);
-                } else {
-                    return new Deoptimize(DeoptAction.InvalidateRecompile, graph());
-                }
-            }
-        }
-
-        if (conditions.isEmpty()) {
-            return next();
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-public abstract class FixedNode extends ValueNode {
-
-    private double probability;
-
-    public FixedNode(CiKind kind, Graph graph) {
-        super(kind, graph);
-    }
-
-    public double probability() {
-        return probability;
-    }
-
-    public void setProbability(double probability) {
-        this.probability = probability;
-    }
-
-    protected void copyInto(FixedNode newNode) {
-        newNode.setProbability(probability);
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("probability", String.format(Locale.ENGLISH, "%7.5f", probability));
-        return properties;
-    }
-
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedNodeWithNext.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedNodeWithNext.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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 com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-public abstract class FixedNodeWithNext extends FixedNode {
-
-    @Successor    private FixedNode next;
-
-    public FixedNode next() {
-        return next;
-    }
-
-    public void setNext(FixedNode x) {
-        updatePredecessors(next, x);
-        next = x;
-    }
-
-    public static final int SYNCHRONIZATION_ENTRY_BCI = -1;
-
-    /**
-     * Constructs a new instruction with the specified value type.
-     * @param kind the value type for this instruction
-     */
-    public FixedNodeWithNext(CiKind kind, Graph graph) {
-        super(kind, graph);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +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.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 FloatAdd extends FloatArithmetic implements Canonicalizable {
-
-    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);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant() && !y().isConstant()) {
-            swapOperands();
-        }
-        if (x().isConstant()) {
-            if (kind == CiKind.Float) {
-                return Constant.forFloat(x().asConstant().asFloat() + y().asConstant().asFloat(), graph());
-            } else {
-                assert kind == CiKind.Double;
-                return Constant.forDouble(x().asConstant().asDouble() + y().asConstant().asDouble(), graph());
-            }
-        } else if (y().isConstant()) {
-            if (kind == CiKind.Float) {
-                float c = y().asConstant().asFloat();
-                if (c == 0.0f) {
-                    return x();
-                }
-            } else {
-                assert kind == CiKind.Double;
-                double c = y().asConstant().asDouble();
-                if (c == 0.0) {
-                    return x();
-                }
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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.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, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
-        super(kind, opcode, x, y, isStrictFP, graph);
-    }
-
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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.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 FloatDiv extends FloatArithmetic implements Canonicalizable {
-
-    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);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant() && y().isConstant()) {
-            if (kind == CiKind.Float) {
-                return Constant.forFloat(x().asConstant().asFloat() / y().asConstant().asFloat(), graph());
-            } else {
-                assert kind == CiKind.Double;
-                return Constant.forDouble(x().asConstant().asDouble() / y().asConstant().asDouble(), graph());
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +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.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 FloatMul extends FloatArithmetic implements Canonicalizable {
-
-    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);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant() && !y().isConstant()) {
-            swapOperands();
-        }
-        if (x().isConstant()) {
-            if (kind == CiKind.Float) {
-                return Constant.forFloat(x().asConstant().asFloat() * y().asConstant().asFloat(), graph());
-            } else {
-                assert kind == CiKind.Double;
-                return Constant.forDouble(x().asConstant().asDouble() * y().asConstant().asDouble(), graph());
-            }
-        } else if (y().isConstant()) {
-            if (kind == CiKind.Float) {
-                float c = y().asConstant().asFloat();
-                if (c == 0.0f) {
-                    return Constant.forFloat(0.0f, graph());
-                }
-            } else {
-                assert kind == CiKind.Double;
-                double c = y().asConstant().asDouble();
-                if (c == 0.0) {
-                    return Constant.forDouble(0.0, graph());
-                }
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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.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 FloatRem extends FloatArithmetic implements Canonicalizable {
-
-    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);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant() && y().isConstant()) {
-            if (kind == CiKind.Float) {
-                return Constant.forFloat(x().asConstant().asFloat() % y().asConstant().asFloat(), graph());
-            } else {
-                assert kind == CiKind.Double;
-                return Constant.forDouble(x().asConstant().asDouble() % y().asConstant().asDouble(), graph());
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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.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 FloatSub extends FloatArithmetic implements Canonicalizable {
-
-    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);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x() == y()) {
-            if (kind == CiKind.Float) {
-                return Constant.forFloat(0.0f, graph());
-            } else {
-                assert kind == CiKind.Double;
-                return Constant.forDouble(0.0, graph());
-            }
-        }
-        if (x().isConstant() && y().isConstant()) {
-            if (kind == CiKind.Float) {
-                return Constant.forFloat(x().asConstant().asFloat() - y().asConstant().asFloat(), graph());
-            } else {
-                assert kind == CiKind.Double;
-                return Constant.forDouble(x().asConstant().asDouble() - y().asConstant().asDouble(), graph());
-            }
-        } else if (y().isConstant()) {
-            if (kind == CiKind.Float) {
-                float c = y().asConstant().asFloat();
-                if (c == 0.0f) {
-                    return x();
-                }
-                return new FloatAdd(kind, x(), Constant.forFloat(-c, graph()), isStrictFP(), graph());
-            } else {
-                assert kind == CiKind.Double;
-                double c = y().asConstant().asDouble();
-                if (c == 0.0) {
-                    return x();
-                }
-                return new FloatAdd(kind, x(), Constant.forDouble(-c, graph()), isStrictFP(), graph());
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-public abstract class FloatingNode extends ValueNode implements Node.ValueNumberable {
-    public FloatingNode(CiKind kind, Graph graph) {
-        super(kind, graph);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +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.*;
-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.*;
-
-public final class GuardNode extends FloatingNode implements Canonicalizable {
-
-    @Input private FixedNode anchor;
-    @Input private BooleanNode node;
-
-    public FixedNode anchor() {
-        return anchor;
-    }
-
-    public void setAnchor(FixedNode x) {
-        updateUsages(anchor, x);
-        anchor = x;
-    }
-
-    /**
-     * The instruction that produces the tested boolean value.
-     */
-    public BooleanNode node() {
-        return node;
-    }
-
-    public void setNode(BooleanNode x) {
-        updateUsages(node, x);
-        node = x;
-    }
-
-    public GuardNode(BooleanNode node, Graph graph) {
-        super(CiKind.Illegal, graph);
-        setNode(node);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitGuardNode(this);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (node() instanceof Constant) {
-            Constant c = (Constant) node();
-            if (c.asConstant().asBoolean()) {
-                if (GraalOptions.TraceCanonicalizer) {
-                    TTY.println("Removing redundant floating guard " + this);
-                }
-                return Node.Null;
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code If} instruction represents a branch that can go one of two directions depending on the outcome of a
- * comparison.
- */
-public final class If extends ControlSplit implements Canonicalizable {
-
-    @Input private BooleanNode compare;
-
-    public BooleanNode compare() {
-        return compare;
-    }
-
-    public void setCompare(BooleanNode x) {
-        updateUsages(compare, x);
-        compare = x;
-    }
-
-    public If(BooleanNode condition, double probability, Graph graph) {
-        super(CiKind.Illegal, 2, new double[] {probability, 1 - probability}, graph);
-        setCompare(condition);
-    }
-
-    /**
-     * Gets the block corresponding to the true successor.
-     *
-     * @return the true successor
-     */
-    public FixedNode trueSuccessor() {
-        return blockSuccessor(0);
-    }
-
-    /**
-     * Gets the block corresponding to the false successor.
-     *
-     * @return the false successor
-     */
-    public FixedNode falseSuccessor() {
-        return blockSuccessor(1);
-    }
-
-    public void setTrueSuccessor(FixedNode node) {
-        setBlockSuccessor(0, node);
-    }
-
-    public void setFalseSuccessor(FixedNode node) {
-        setBlockSuccessor(1, node);
-    }
-
-    /**
-     * Gets the block corresponding to the specified outcome of the branch.
-     *
-     * @param istrue {@code true} if the true successor is requested, {@code false} otherwise
-     * @return the corresponding successor
-     */
-    public FixedNode successor(boolean istrue) {
-        return blockSuccessor(istrue ? 0 : 1);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitIf(this);
-    }
-
-    @Override
-    public boolean verify() {
-        assertTrue(compare() != null);
-        assertTrue(trueSuccessor() != null);
-        assertTrue(falseSuccessor() != null);
-        return true;
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (compare() instanceof Constant) {
-            Constant c = (Constant) compare();
-            if (c.asConstant().asBoolean()) {
-                return trueSuccessor();
-            } else {
-                return falseSuccessor();
-            }
-        }
-        if (trueSuccessor() instanceof EndNode && falseSuccessor() instanceof EndNode) {
-            EndNode trueEnd = (EndNode) trueSuccessor();
-            EndNode falseEnd = (EndNode) falseSuccessor();
-            Merge merge = trueEnd.merge();
-            if (merge == falseEnd.merge() && merge.phis().size() == 0 && merge.endCount() == 2) {
-                FixedNode next = merge.next();
-                merge.setNext(null); // disconnect to avoid next from having 2 preds
-                return next;
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-public abstract class InductionVariable extends FloatingNode {
-
-    public InductionVariable(CiKind kind, Graph graph) {
-        super(kind, graph);
-        assert kind.isInt() || kind.isLong();
-    }
-
-    public abstract LoopBegin loopBegin();
-
-    public abstract void peelOneIteration();
-
-    public void replaceAtNonIVUsages(Node other) {
-        for (Node usage : this.usages().snapshot()) {
-            if (!(usage instanceof InductionVariable)) {
-                usage.replaceFirstInput(this, other);
-            }
-        }
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        // nop
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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.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 TypeCheckNode implements Canonicalizable {
-
-    /**
-     * Constructs a new InstanceOf instruction.
-     *
-     * @param targetClass the target class of the instanceof check
-     * @param object the instruction producing the object input to this instruction
-     * @param graph
-     */
-    public InstanceOf(Constant targetClassInstruction, ValueNode object, boolean nullIsTrue, Graph graph) {
-        super(targetClassInstruction, object, CiKind.Illegal, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (object().exactType() != null) {
-            return Constant.forBoolean(object().exactType().isSubtypeOf(targetClass()), graph());
-        }
-        CiConstant constant = object().asConstant();
-        if (constant != null) {
-            assert constant.kind == CiKind.Object;
-            if (constant.isNull()) {
-                return Constant.forBoolean(false, graph());
-            } else {
-                // this should never happen - non-null constants are always expected to provide an exactType
-                assert false;
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2011, 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.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 IntegerAdd extends IntegerArithmeticNode implements Canonicalizable {
-
-    public IntegerAdd(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.IADD : Bytecodes.LADD, x, y, graph);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        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 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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.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 ValueNode value;
-
-    public ValueNode value() {
-        return value;
-    }
-
-    public void setValue(ValueNode x) {
-        updateUsages(value, x);
-        value = x;
-    }
-
-    public IntegerAddVectorNode(AbstractVectorNode vector, ValueNode value, Graph graph) {
-        super(CiKind.Illegal, vector, graph);
-        setValue(value);
-    }
-
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LIRGeneratorOp.class) {
-            return null;
-        }
-        return super.lookup(clazz);
-    }
-
-    @Override
-    public void addToLoop(LoopBegin loop, IdentityHashMap nodes) {
-        nodes.put(this, new IntegerAdd(CiKind.Int, nodes.get(vector()), value(), graph()));
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2011, 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.nodes.base.*;
-import com.oracle.max.graal.compiler.util.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public abstract class IntegerArithmeticNode extends Arithmetic {
-
-    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(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 ?
-        switch(v1.kind) {
-            case Int:
-                return new IntegerAdd(CiKind.Int, v1, v2, graph);
-            case Long:
-                return new IntegerAdd(CiKind.Long, v1, v2, graph);
-            default:
-                throw Util.shouldNotReachHere();
-        }
-    }
-
-    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 ?
-        switch(v1.kind) {
-            case Int:
-                return new IntegerMul(CiKind.Int, v1, v2, graph);
-            case Long:
-                return new IntegerMul(CiKind.Long, v1, v2, graph);
-            default:
-                throw Util.shouldNotReachHere();
-        }
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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.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 IntegerDiv extends IntegerArithmeticNode implements Canonicalizable {
-
-    public IntegerDiv(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.IDIV : Bytecodes.LDIV, x, y, graph);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant() && y().isConstant()) {
-            long yConst = y().asConstant().asLong();
-            if (yConst == 0) {
-                return this; // this will trap, can not canonicalize
-            }
-            if (kind == CiKind.Int) {
-                return Constant.forInt(x().asConstant().asInt() / (int) yConst, graph());
-            } else {
-                assert kind == CiKind.Long;
-                return Constant.forLong(x().asConstant().asLong() / yConst, graph());
-            }
-        } else if (y().isConstant()) {
-            long c = y().asConstant().asLong();
-            if (c == 1) {
-                return x();
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.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 IntegerMul extends IntegerArithmeticNode implements Canonicalizable {
-
-    public IntegerMul(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.IMUL : Bytecodes.LMUL, x, y, graph);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        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()) {
-            long c = y().asConstant().asLong();
-            if (c == 1) {
-                return x();
-            }
-            if (c == 0) {
-                return Constant.forInt(0, graph());
-            }
-            if (c > 0 && CiUtil.isPowerOf2(c)) {
-                return new LeftShift(kind, x(), Constant.forInt(CiUtil.log2(c), graph()), graph());
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.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 IntegerRem extends IntegerArithmeticNode implements Canonicalizable {
-
-    public IntegerRem(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.IREM : Bytecodes.LREM, x, y, graph);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant() && y().isConstant()) {
-            long yConst = y().asConstant().asLong();
-            if (yConst == 0) {
-                return this; // this will trap, can not canonicalize
-            }
-            if (kind == CiKind.Int) {
-                return Constant.forInt(x().asConstant().asInt() % (int) yConst, graph());
-            } else {
-                assert kind == CiKind.Long;
-                return Constant.forLong(x().asConstant().asLong() % yConst, graph());
-            }
-        } else if (y().isConstant()) {
-            long c = y().asConstant().asLong();
-            if (c == 1 || c == -1) {
-                if (kind == CiKind.Int) {
-                    return Constant.forInt(0, graph());
-                } else {
-                    assert kind == CiKind.Long;
-                    return Constant.forLong(0, graph());
-                }
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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.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 IntegerSub extends IntegerArithmeticNode implements Canonicalizable {
-
-    public IntegerSub(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.ISUB : Bytecodes.LSUB, 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(0, graph());
-            }
-        }
-        if (x().isConstant() && y().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()) {
-            long c = y().asConstant().asLong();
-            if (c == 0) {
-                return x();
-            }
-            if (kind == CiKind.Int) {
-                return new IntegerAdd(kind, x(), Constant.forInt((int) -c, graph()), graph());
-            } else {
-                assert kind == CiKind.Long;
-                return new IntegerAdd(kind, x(), Constant.forLong(-c, graph()), graph());
-            }
-        } else if (x().isConstant()) {
-            long c = x().asConstant().asLong();
-            if (c == 0) {
-                return new Negate(y(), graph());
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +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.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.*;
-import com.sun.cri.ri.*;
-
-/**
- * The {@code Invoke} instruction represents all kinds of method calls.
- */
-public final class Invoke extends AbstractMemoryCheckpointNode implements ExceptionEdgeInstruction {
-
-    @Successor private FixedNode exceptionEdge;
-
-    @Input private final NodeInputList arguments;
-
-    @Override
-    public FixedNode exceptionEdge() {
-        return exceptionEdge;
-    }
-
-    public void setExceptionEdge(FixedNode x) {
-        updatePredecessors(exceptionEdge, x);
-        exceptionEdge = x;
-    }
-
-    private final int argumentCount;
-
-    private boolean canInline = true;
-
-    public boolean canInline() {
-        return canInline;
-    }
-
-    public void setCanInline(boolean b) {
-        canInline = b;
-    }
-
-    public NodeInputList arguments() {
-        return arguments;
-    }
-
-    public final int opcode;
-    public final RiMethod target;
-    public final RiType returnType;
-    public final int bci; // XXX needed because we can not compute the bci from the sateBefore bci of this Invoke was optimized from INVOKEINTERFACE to INVOKESPECIAL
-
-    /**
-     * Constructs a new Invoke instruction.
-     *
-     * @param opcode the opcode of the invoke
-     * @param result the result type
-     * @param args the list of instructions producing arguments to the invocation, including the receiver object
-     * @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, ValueNode[] args, RiMethod target, RiType returnType, Graph graph) {
-        super(result, graph);
-        arguments = new NodeInputList(this, args.length);
-        this.opcode = opcode;
-        this.target = target;
-        this.returnType = returnType;
-        this.bci = bci;
-
-        this.argumentCount = args.length;
-        for (int i = 0; i < args.length; i++) {
-            arguments().set(i, args[i]);
-        }
-    }
-
-    /**
-     * Gets the opcode of this invoke instruction.
-     * @return the opcode
-     */
-    public int opcode() {
-        return opcode;
-    }
-
-    /**
-     * Checks whether this is an invocation of a static method.
-     * @return {@code true} if the invocation is a static invocation
-     */
-    public boolean isStatic() {
-        return opcode == Bytecodes.INVOKESTATIC;
-    }
-
-    @Override
-    public RiType declaredType() {
-        return returnType;
-    }
-
-    /**
-     * Gets the instruction that produces the receiver object for this invocation, if any.
-     * @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 ValueNode receiver() {
-        assert !isStatic();
-        return arguments().get(0);
-    }
-
-    /**
-     * Gets the target method for this invocation instruction.
-     * @return the target method
-     */
-    public RiMethod target() {
-        return target;
-    }
-
-    /**
-     * Checks whether this invocation has a receiver object.
-     * @return {@code true} if this invocation has a receiver object; {@code false} otherwise, if this is a
-     *         static call
-     */
-    public boolean hasReceiver() {
-        return !isStatic();
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitInvoke(this);
-    }
-
-    @Override
-    public String toString() {
-        return super.toString() + target;
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("opcode", Bytecodes.nameOf(opcode));
-        properties.put("target", CiUtil.format("%H.%n(%p):%r", target, false));
-        properties.put("bci", bci);
-        return properties;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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 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 NullCheck} class represents an explicit null check instruction.
- */
-public final class IsNonNull extends BooleanNode implements Canonicalizable {
-
-    @Input private ValueNode object;
-
-    public ValueNode object() {
-        return object;
-    }
-
-    public void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
-    }
-
-    /**
-     * Constructs a new NullCheck instruction.
-     *
-     * @param object the instruction producing the object to check against null
-     * @param graph
-     */
-    public IsNonNull(ValueNode object, Graph graph) {
-        super(CiKind.Object, graph);
-        assert object == null || object.kind == CiKind.Object : object;
-        setObject(object);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        // Nothing to do.
-    }
-
-    @Override
-    public RiType declaredType() {
-        // null check does not alter the type of the object
-        return object().declaredType();
-    }
-
-    @Override
-    public RiType exactType() {
-        // null check does not alter the type of the object
-        return object().exactType();
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (object() instanceof NewInstance || object() instanceof NewArray) {
-            return Constant.forBoolean(true, graph());
-        }
-        CiConstant constant = object().asConstant();
-        if (constant != null) {
-            assert constant.kind == CiKind.Object;
-            return Constant.forBoolean(constant.isNonNull(), graph());
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +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.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 TypeCheck} class represents an explicit type check instruction.
- */
-public final class IsType extends BooleanNode implements Canonicalizable {
-
-    @Input private ValueNode object;
-
-    public ValueNode object() {
-        return object;
-    }
-
-    public void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
-    }
-
-    private final RiType type;
-
-    /**
-     * Constructs a new IsType instruction.
-     *
-     * @param object the instruction producing the object to check against the given type
-     * @param graph
-     */
-    public IsType(ValueNode object, RiType type, Graph graph) {
-        super(CiKind.Object, graph);
-        assert type.isResolved();
-        assert object == null || object.kind == CiKind.Object;
-        this.type = type;
-        setObject(object);
-    }
-
-    public RiType type() {
-        return type;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        // Nothing to do.
-    }
-
-    @Override
-    public RiType declaredType() {
-        // type check does not alter the type of the object
-        return object().declaredType();
-    }
-
-    @Override
-    public RiType exactType() {
-        return type;
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("type", type);
-        return properties;
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (object().exactType() != null) {
-            return Constant.forBoolean(object().exactType() == type(), graph());
-        }
-        // constants return the correct exactType, so they are handled by the code above
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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.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 ShiftNode implements Canonicalizable {
-
-    public LeftShift(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.ISHL : Bytecodes.LSHL, 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 LeftShift) {
-                        int total = amount + otherAmount;
-                        if (total != (total & mask)) {
-                            return Constant.forInt(0, graph());
-                        }
-                        return new LeftShift(kind, other.x(), Constant.forInt(total, graph()), graph());
-                    } 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 {
-                            assert kind == CiKind.Int;
-                            return new And(kind, other.x(), Constant.forInt(-1 << amount, graph()), graph());
-                        }
-                    }
-                }
-            }
-            if (originalAmout != amount) {
-                return new LeftShift(kind, x(), Constant.forInt(amount, graph()), graph());
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.nodes.base.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * InductionVariable of the form a+b*x.
- */
-public abstract class LinearInductionVariable extends InductionVariable {
-    @Input private ValueNode a;
-    @Input private ValueNode b;
-
-    public LinearInductionVariable(CiKind kind, ValueNode a, ValueNode b, Graph graph) {
-        super(kind, graph);
-        setA(a);
-        setB(b);
-    }
-
-    protected ValueNode a() {
-        return a;
-    }
-
-    protected ValueNode b() {
-        return b;
-    }
-
-    protected void setA(ValueNode a) {
-        updateUsages(this.a, a);
-        this.a = a;
-    }
-
-
-    protected void setB(ValueNode b) {
-        updateUsages(this.b, b);
-        this.b = b;
-    }
-
-    public boolean isLinearInductionVariableInput(Node n) {
-        return n == a() || n == b();
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +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.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 LoadField} instruction represents a read of a static or instance field.
- */
-public final class LoadField extends AccessField implements Canonicalizable {
-
-    /**
-     * Creates a new LoadField instance.
-     *
-     * @param object the receiver object
-     * @param field the compiler interface field
-     * @param isStatic indicates if the field is static
-     * @param stateAfter the state after the field access
-     * @param graph
-     * @param isLoaded indicates if the class is loaded
-     */
-    public LoadField(ValueNode object, RiField field, Graph graph) {
-        super(field.kind().stackKind(), object, field, graph);
-    }
-
-    /**
-     * Gets the declared type of the field being accessed.
-     *
-     * @return the declared type of the field being accessed.
-     */
-    @Override
-    public RiType declaredType() {
-        return field().type();
-    }
-
-    /**
-     * Gets the exact type of the field being accessed. If the field type is a primitive array or an instance class and
-     * the class is loaded and final, then the exact type is the same as the declared type. Otherwise it is {@code null}
-     *
-     * @return the exact type of the field if known; {@code null} otherwise
-     */
-    @Override
-    public RiType exactType() {
-        RiType declared = declaredType();
-        return declared != null && declared.isResolved() ? declared.exactType() : null;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitLoadField(this);
-    }
-
-    @Override
-    public boolean needsStateAfter() {
-        return false;
-    }
-
-    /**
-     * Gets a constant value to which this load can be reduced.
-     *
-     * @return {@code null} if this load cannot be reduced to a constant
-     */
-    private CiConstant constantValue() {
-        if (isStatic()) {
-            return field.constantValue(null);
-        } else if (object().isConstant()) {
-            return field.constantValue(object().asConstant());
-        }
-        return null;
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        CiConstant constant = null;
-        if (isStatic()) {
-            constant = field().constantValue(null);
-        } else if (object().isConstant()) {
-            constant = field().constantValue(object().asConstant());
-        }
-        if (constant != null) {
-            return new Constant(constant, graph());
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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.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 LoadIndexed} instruction represents a read from an element of an array.
- */
-public final class LoadIndexed extends AccessIndexed {
-
-    /**
-     * Creates a new LoadIndexed 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 graph
-     */
-    public LoadIndexed(ValueNode array, ValueNode index, ValueNode length, CiKind elementKind, Graph graph) {
-        super(elementKind.stackKind(), array, index, length, elementKind, graph);
-    }
-
-    /**
-     * Gets the declared type of this instruction's result.
-     * @return the declared type
-     */
-    @Override
-    public RiType declaredType() {
-        RiType arrayType = array().declaredType();
-        if (arrayType == null) {
-            return null;
-        }
-        return arrayType.componentType();
-    }
-
-    /**
-     * Gets the exact type of this instruction's result.
-     * @return the exact type
-     */
-    @Override
-    public RiType exactType() {
-        RiType declared = declaredType();
-        return declared != null && declared.isResolved() ? declared.exactType() : null;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitLoadIndexed(this);
-    }
-
-    @Override
-    public boolean needsStateAfter() {
-        return false;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LoweringOp.class) {
-            return (T) DELEGATE_TO_RUNTIME;
-        }
-        return super.lookup(clazz);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-import com.sun.cri.ri.*;
-
-/**
- * The {@code Local} instruction is a placeholder for an incoming argument
- * to a function call.
- */
-public final class Local extends FloatingNode {
-
-    @Input    private StartNode start;
-
-    public StartNode start() {
-        return start;
-    }
-
-    public void setStart(StartNode x) {
-        updateUsages(start, x);
-        start = x;
-    }
-
-    private final int index;
-    private RiType declaredType;
-
-    public Local(CiKind kind, int javaIndex, Graph graph) {
-        super(kind, graph);
-        this.index = javaIndex;
-        setStart(graph.start());
-    }
-
-    /**
-     * Gets the index of this local.
-     * @return the index
-     */
-    public int index() {
-        return index;
-    }
-
-    /**
-     * Sets the declared type of this local, e.g. derived from the signature of the method.
-     * @param declaredType the declared type of the local variable
-     */
-    public void setDeclaredType(RiType declaredType) {
-        this.declaredType = declaredType;
-    }
-
-    /**
-     * 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
-     */
-    @Override
-    public RiType declaredType() {
-        return declaredType;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitLocal(this);
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("index", index());
-        return properties;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +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.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.Scale;
-
-
-public final class LocationNode extends FloatingNode {
-    @Input private ValueNode index;
-
-    @Data private int displacement;
-    @Data private boolean indexScalingEnabled = true;
-    @Data private CiKind valueKind;
-    @Data private Object locationIdentity;
-
-    public ValueNode index() {
-        return index;
-    }
-
-    public void setIndex(ValueNode x) {
-        updateUsages(index, x);
-        index = x;
-    }
-
-    public static final Object UNSAFE_ACCESS_LOCATION = new Object();
-    public static final Object FINAL_LOCATION = new Object();
-
-    public static Object getArrayLocation(CiKind elementKind) {
-        return elementKind;
-    }
-
-    public int displacement() {
-        return displacement;
-    }
-
-    /**
-     * @return whether scaling of the index by the value kind's size is enabled (the default) or disabled.
-     */
-    public boolean indexScalingEnabled() {
-        return indexScalingEnabled;
-    }
-
-    /**
-     * Enables or disables scaling of the index by the value kind's size. Has no effect if the index input is not used.
-     */
-    public void setIndexScalingEnabled(boolean enable) {
-        this.indexScalingEnabled = enable;
-    }
-
-    public static LocationNode create(Object identity, CiKind kind, int displacement, Graph graph) {
-        LocationNode result = new LocationNode(identity, kind, displacement, graph);
-        return graph.value(result);
-    }
-
-    private LocationNode(Object identity, CiKind kind, int displacement, Graph graph) {
-        super(CiKind.Illegal, graph);
-        this.displacement = displacement;
-        this.valueKind = kind;
-        this.locationIdentity = identity;
-    }
-
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LIRGeneratorOp.class) {
-            return null;
-        }
-        return super.lookup(clazz);
-    }
-
-    public CiKind getValueKind() {
-        return valueKind;
-    }
-
-    public CiAddress createAddress(LIRGeneratorTool lirGenerator, ValueNode object) {
-        CiValue indexValue = CiValue.IllegalValue;
-        Scale indexScale = Scale.Times1;
-        if (this.index() != null) {
-            indexValue = lirGenerator.load(this.index());
-            if (indexScalingEnabled) {
-                indexScale = Scale.fromInt(valueKind.sizeInBytes(lirGenerator.target().wordSize));
-            }
-        }
-        return new CiAddress(valueKind, lirGenerator.load(object), indexValue, indexScale, displacement);
-    }
-
-    public Object locationIdentity() {
-        return locationIdentity;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code LogicOp} class definition.
- */
-public abstract class Logic extends Binary {
-
-    /**
-     * Constructs a new logic operation instruction.
-     * @param opcode the opcode of the logic operation
-     * @param x the first input into this instruction
-     * @param y the second input into this instruction
-     */
-    public Logic(CiKind kind, int opcode, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, opcode, x, y, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitLogic(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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.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 SwitchNode {
-
-    private static final int INPUT_COUNT = 0;
-    private static final int SUCCESSOR_COUNT = 0;
-
-    final int[] keys;
-
-    /**
-     * Constructs a new LookupSwitch instruction.
-     * @param value the instruction producing the value being switched on
-     * @param successors the list of successors
-     * @param keys the list of keys, sorted
-     * @param stateAfter the state after the switch
-     * @param 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;
-    }
-
-    /**
-     * Gets the key at the specified index.
-     * @param i the index
-     * @return the key at that index
-     */
-    public int keyAt(int i) {
-        return keys[i];
-    }
-
-    public int keysLength() {
-        return keys.length;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitLookupSwitch(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +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.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.*;
-
-public class LoopBegin extends Merge {
-
-    private double loopFrequency;
-
-    public LoopBegin(Graph graph) {
-        super(graph);
-        loopFrequency = 1;
-    }
-
-    public double loopFrequency() {
-        return loopFrequency;
-    }
-
-    public void setLoopFrequency(double loopFrequency) {
-        this.loopFrequency = loopFrequency;
-    }
-
-    public LoopEnd loopEnd() {
-        for (Node usage : usages()) {
-            if (usage instanceof LoopEnd) {
-                LoopEnd end = (LoopEnd) usage;
-                if (end.loopBegin() == this) {
-                    return end;
-                }
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitLoopBegin(this);
-    }
-
-    @Override
-    public int phiPredecessorCount() {
-        return 2;
-    }
-
-    @Override
-    public int phiPredecessorIndex(Node pred) {
-        if (pred == forwardEdge()) {
-            return 0;
-        } else if (pred == this.loopEnd()) {
-            return 1;
-        }
-        throw Util.shouldNotReachHere("unknown pred : " + pred + "(sp=" + forwardEdge() + ", le=" + this.loopEnd() + ")");
-    }
-
-    @Override
-    public Node phiPredecessorAt(int index) {
-        if (index == 0) {
-            return forwardEdge();
-        } else if (index == 1) {
-            return loopEnd();
-        }
-        throw Util.shouldNotReachHere();
-    }
-
-    public Collection inductionVariables() {
-        return Util.filter(this.usages(), InductionVariable.class);
-    }
-
-    @Override
-    public Iterable phiPredecessors() {
-        return Arrays.asList(new Node[]{this.forwardEdge(), this.loopEnd()});
-    }
-
-    public EndNode forwardEdge() {
-        return this.endAt(0);
-    }
-
-    public LoopCounter loopCounter() {
-        return loopCounter(CiKind.Long);
-    }
-
-    public LoopCounter loopCounter(CiKind kind) {
-        for (Node usage : usages()) {
-            if (usage instanceof LoopCounter && ((LoopCounter) usage).kind == kind) {
-                return (LoopCounter) usage;
-            }
-        }
-        return new LoopCounter(kind, this, graph());
-    }
-
-    @Override
-    public boolean verify() {
-        assertTrue(loopEnd() != null);
-        assertTrue(forwardEdge() != null);
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "LoopBegin: " + super.toString();
-    }
-
-    @Override
-    public Iterable< ? extends Node> dataUsages() {
-        final Iterator< ? extends Node> dataUsages = super.dataUsages().iterator();
-        return new Iterable() {
-            @Override
-            public Iterator iterator() {
-                return new StateSplit.FilteringIterator(dataUsages, LoopEnd.class);
-            }
-        };
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("loopFrequency", String.format("%7.1f", loopFrequency));
-        return properties;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * Counts loop iterations from 0 to Niter.
- * If used directly (and not just by BasicInductionVariables) computed with Phi(0, this + 1)
- */
-public final class LoopCounter extends InductionVariable {
-    @Input private LoopBegin loopBegin;
-
-    @Override
-    public LoopBegin loopBegin() {
-        return loopBegin;
-    }
-
-    public void setLoopBegin(LoopBegin x) {
-        updateUsages(loopBegin, x);
-        loopBegin = x;
-    }
-
-    public LoopCounter(CiKind kind, LoopBegin loop, Graph graph) {
-        super(kind, graph);
-        setLoopBegin(loop);
-    }
-
-    @Override
-    public void peelOneIteration() {
-        BasicInductionVariable biv = null;
-        for (Node usage : usages()) {
-            if (!(usage instanceof InductionVariable && ((InductionVariable) usage).loopBegin() == this.loopBegin())) {
-                if (biv == null) {
-                    biv = createBasicInductionVariable();
-                    biv.peelOneIteration();
-                }
-                usage.inputs().replace(this, biv);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == LoweringOp.class) {
-            return (T) LOWERING;
-        }
-        return super.lookup(clazz);
-    }
-
-    private BasicInductionVariable createBasicInductionVariable() {
-        Graph graph = graph();
-        return new BasicInductionVariable(kind, Constant.forInt(0, graph), Constant.forInt(1, graph), this, graph);
-    }
-
-    private static final LoweringOp LOWERING = new LoweringOp() {
-        @Override
-        public void lower(Node n, CiLoweringTool tool) {
-            LoopCounter loopCounter = (LoopCounter) n;
-            Graph graph = n.graph();
-            Phi phi = BasicInductionVariable.LOWERING.ivToPhi(loopCounter.loopBegin(), Constant.forInt(0, graph), Constant.forInt(1, graph), loopCounter.kind);
-            loopCounter.replaceAtNonIVUsages(phi);
-        }
-    };
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public class LoopEnd extends FixedNode {
-
-    @Input    private LoopBegin loopBegin;
-
-    public LoopBegin loopBegin() {
-        return loopBegin;
-    }
-
-    public void setLoopBegin(LoopBegin x) {
-        updateUsages(this.loopBegin, x);
-        this.loopBegin = x;
-    }
-
-    public LoopEnd(Graph graph) {
-        super(CiKind.Illegal, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitLoopEnd(this);
-    }
-
-    @Override
-    public Iterable< ? extends Node> dataInputs() {
-        return Collections.emptyList();
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +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.*;
-
-public final class MaterializeNode extends Conditional {
-    public MaterializeNode(BooleanNode value, Graph graph) {
-        super(value, Constant.forInt(1, graph), Constant.forInt(0, graph), graph);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-
-public class MathIntrinsic extends FloatingNode {
-
-    @Input private ValueNode x;
-    @Data private final Operation operation;
-
-    public enum Operation {
-        ABS, SQRT,
-    }
-
-    public ValueNode x() {
-        return x;
-    }
-
-    private void setX(ValueNode x) {
-        updateUsages(this.x, x);
-        this.x = x;
-    }
-
-    public Operation operation() {
-        return operation;
-    }
-
-    public MathIntrinsic(ValueNode x, Operation op, Graph graph) {
-        super(x.kind, graph);
-        setX(x);
-        this.operation = op;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitMathIntrinsic(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +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.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.*;
-
-/**
- * Denotes the beginning of a basic block, and holds information
- * about the basic block, including the successor and
- * predecessor blocks, exception handlers, liveness information, etc.
- */
-public class Merge extends StateSplit {
-
-    @Input    private final NodeInputList ends = new NodeInputList(this);
-
-    public Merge(Graph graph) {
-        super(CiKind.Illegal, graph);
-    }
-
-    @Override
-    public boolean needsStateAfter() {
-        return false;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitMerge(this);
-    }
-
-    public int endIndex(EndNode end) {
-        return ends.indexOf(end);
-    }
-
-    public void addEnd(EndNode end) {
-        ends.add(end);
-    }
-
-    public int endCount() {
-        return ends.size();
-    }
-
-    public EndNode endAt(int index) {
-        return ends.get(index);
-    }
-
-    public Iterable phiPredecessors() {
-        return ends;
-    }
-
-    @Override
-    public Iterable cfgPredecessors() {
-        return ends;
-    }
-
-    @Override
-    public Iterable< ? extends Node> dataInputs() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("merge #");
-        builder.append(id());
-        builder.append(" [");
-
-        builder.append("]");
-
-        builder.append(" -> ");
-        boolean hasSucc = false;
-        for (Node s : this.successors()) {
-            if (hasSucc) {
-                builder.append(", ");
-            }
-            builder.append("#");
-            if (s != null) {
-                builder.append(s.id());
-            } else {
-                builder.append("null");
-            }
-            hasSucc = true;
-        }
-        return builder.toString();
-    }
-
-    public void printWithoutPhis(LogStream out) {
-        // print block id
-        out.print("B").print(id()).print(" ");
-
-        // print flags
-        StringBuilder sb = new StringBuilder(8);
-        if (sb.length() != 0) {
-            out.print('(').print(sb.toString()).print(')');
-        }
-
-        // print block bci range
-        out.print('[').print(-1).print(", ").print(-1).print(']');
-
-        // print block successors
-        //if (end != null && end.blockSuccessors().size() > 0) {
-            out.print(" .");
-            for (Node successor : this.successors()) {
-                if (successor instanceof ValueNode) {
-                    out.print((ValueNode) successor);
-                } else {
-                    out.print(successor.toString());
-                }
-            }
-        //}
-
-        // print predecessors
-//        if (!blockPredecessors().isEmpty()) {
-//            out.print(" pred:");
-//            for (Instruction pred : blockPredecessors()) {
-//                out.print(pred.block());
-//            }
-//        }
-    }
-
-    /**
-     * Determines if a given instruction is a phi whose {@linkplain Phi#merge() join block} is a given block.
-     *
-     * @param value the instruction to test
-     * @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(ValueNode value) {
-        return value instanceof Phi && ((Phi) value).merge() == this;
-    }
-
-
-    /**
-     * Formats a given instruction as a value in a {@linkplain FrameState frame state}. If the instruction is a phi defined at a given
-     * block, its {@linkplain Phi#valueCount() inputs} are appended to the returned string.
-     *
-     * @param index the index of the value in the frame state
-     * @param value the frame state value
-     * @param block if {@code value} is a phi, then its inputs are formatted if {@code block} is its
-     *            {@linkplain Phi#merge() join point}
-     * @return the instruction representation as a string
-     */
-    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) {
-            Phi phi = (Phi) value;
-            // print phi operands
-            if (phi.merge() == this) {
-                sb.append(" [");
-                for (int j = 0; j < phi.valueCount(); j++) {
-                    sb.append(' ');
-                    ValueNode operand = phi.valueAt(j);
-                    if (operand != null) {
-                        sb.append(Util.valueString(operand));
-                    } else {
-                        sb.append("NULL");
-                    }
-                }
-                sb.append("] ");
-            }
-        }
-        return sb.toString();
-    }
-
-    public void removeEnd(EndNode pred) {
-        int predIndex = ends.indexOf(pred);
-        assert predIndex != -1;
-        ends.remove(predIndex);
-
-        for (Node usage : usages()) {
-            if (usage instanceof Phi) {
-                ((Phi) usage).removeInput(predIndex);
-            }
-        }
-    }
-
-    public int phiPredecessorCount() {
-        return endCount();
-    }
-
-    public int phiPredecessorIndex(Node pred) {
-        EndNode end = (EndNode) pred;
-        return endIndex(end);
-    }
-
-    public Node phiPredecessorAt(int index) {
-        return endAt(index);
-    }
-
-    public Collection phis() {
-        return Util.filter(this.usages(), Phi.class);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2010, 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.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 ValueNode {
-
-    private int monitorIndex;
-
-    public MonitorAddress(int monitorIndex, Graph graph) {
-        super(CiKind.Word, graph);
-        this.monitorIndex = monitorIndex;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitMonitorAddress(this);
-    }
-
-    public int monitorIndex() {
-        return monitorIndex;
-    }
-
-    public void setMonitorIndex(int monitorIndex) {
-        this.monitorIndex = monitorIndex;
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("monitorIndex", monitorIndex);
-        return properties;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-
-/**
- * The {@code MonitorEnter} instruction represents the acquisition of a monitor.
- */
-public final class MonitorEnter extends AccessMonitor {
-
-    /**
-     * Creates a new MonitorEnter instruction.
-     *
-     * @param object the instruction producing the object
-     * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
-     * @param lockNumber the number of the lock
-     * @param graph
-     */
-    public MonitorEnter(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) {
-        super(object, lockAddress, lockNumber, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitMonitorEnter(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-
-/**
- * The {@code MonitorExit} instruction represents a monitor release.
- */
-public final class MonitorExit extends AccessMonitor {
-
-    /**
-     * Creates a new MonitorExit instruction.
-     *
-     * @param object the instruction produces the object value
-     * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
-     * @param lockNumber the number of the lock
-     * @param graph
-     */
-    public MonitorExit(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) {
-        super(object, lockAddress, lockNumber, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitMonitorExit(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code NegateOp} instruction negates its operand.
- */
-public final class Negate extends FloatingNode implements Canonicalizable {
-
-    @Input
-    private ValueNode x;
-
-    public ValueNode x() {
-        return x;
-    }
-
-    public void setX(ValueNode x) {
-        updateUsages(this.x, x);
-        this.x = x;
-    }
-
-    /**
-     * Creates new NegateOp instance.
-     *
-     * @param x the instruction producing the value that is input to this instruction
-     */
-    public Negate(ValueNode x, Graph graph) {
-        super(x.kind, graph);
-        setX(x);
-    }
-
-    // for copying
-    private Negate(CiKind kind, Graph graph) {
-        super(kind, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitNegate(this);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x().isConstant()) {
-            switch (x().kind) {
-                case Int:
-                    return Constant.forInt(-x().asConstant().asInt(), graph());
-                case Long:
-                    return Constant.forLong(-x().asConstant().asLong(), graph());
-                case Float:
-                    return Constant.forFloat(-x().asConstant().asFloat(), graph());
-                case Double:
-                    return Constant.forDouble(-x().asConstant().asDouble(), graph());
-            }
-        }
-        if (x() instanceof Negate) {
-            return ((Negate) x()).x();
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-public final class NegateBooleanNode extends BooleanNode implements Canonicalizable {
-
-    @Input private BooleanNode value;
-
-    public BooleanNode value() {
-        return value;
-    }
-
-    public void setValue(BooleanNode x) {
-        updateUsages(value, x);
-        value = x;
-    }
-
-    public NegateBooleanNode(BooleanNode value, Graph graph) {
-        super(CiKind.Int, graph);
-        setValue(value);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (value() instanceof NegateBooleanNode) {
-            return ((NegateBooleanNode) value()).value();
-        } else if (value() instanceof Constant) {
-            return Constant.forBoolean(!value().asConstant().asBoolean(), graph());
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +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.*;
-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 NewArray} class is the base of all instructions that allocate arrays.
- */
-public abstract class NewArray extends FixedNodeWithNext {
-
-    @Input    private ValueNode length;
-
-    public ValueNode length() {
-        return length;
-    }
-
-    public void setLength(ValueNode x) {
-        updateUsages(this.length, x);
-        this.length = x;
-    }
-
-    /**
-     * Constructs a new NewArray instruction.
-     * @param length the instruction that produces the length for this allocation
-     * @param graph
-     */
-    NewArray(ValueNode length, Graph graph) {
-        super(CiKind.Object, graph);
-        setLength(length);
-    }
-
-    /**
-     * The list of instructions which produce input for this instruction.
-     */
-    public ValueNode dimension(int index) {
-        assert index == 0;
-        return length();
-    }
-
-    /**
-     * The rank of the array allocated by this instruction, i.e. how many array dimensions.
-     */
-    public int dimensionCount() {
-        return 1;
-    }
-
-    public abstract CiKind elementKind();
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("exactType", exactType());
-        return properties;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == EscapeOp.class) {
-            return (T) ESCAPE;
-        }
-        return super.lookup(clazz);
-    }
-
-    private static final EscapeOp ESCAPE = new EscapeOp() {
-
-        @Override
-        public boolean canAnalyze(Node node) {
-            NewArray x = (NewArray) node;
-            CiConstant length = x.dimension(0).asConstant();
-            return length != null && length.asInt() >= 0 && length.asInt() < GraalOptions.MaximumEscapeAnalysisArrayLength;
-        }
-
-        @Override
-        public boolean escape(Node node, Node usage) {
-            if (usage instanceof LoadIndexed) {
-                LoadIndexed x = (LoadIndexed) usage;
-                assert x.array() == node;
-                CiConstant index = x.index().asConstant();
-                CiConstant length = ((NewArray) node).dimension(0).asConstant();
-                if (index == null || length == null || index.asInt() < 0 || index.asInt() >= length.asInt()) {
-                    return true;
-                }
-                return false;
-            } else if (usage instanceof StoreFieldNode) {
-                StoreFieldNode x = (StoreFieldNode) usage;
-                assert x.value() == node;
-                return true;
-            } 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()) {
-                    return true;
-                }
-                return x.value() == node && x.array() != node;
-            } else if (usage instanceof ArrayLength) {
-                ArrayLength x = (ArrayLength) usage;
-                assert x.array() == node;
-                return false;
-            } else if (usage instanceof VirtualObjectFieldNode) {
-                return false;
-            } else {
-                return super.escape(node, usage);
-            }
-        }
-
-        @Override
-        public EscapeField[] fields(Node node) {
-            NewArray x = (NewArray) node;
-            int length = x.dimension(0).asConstant().asInt();
-            EscapeField[] fields = new EscapeField[length];
-            for (int i = 0; i < length; i++) {
-                Integer representation = i;
-                fields[i] = new EscapeField("[" + i + "]", representation, ((NewArray) node).elementKind());
-            }
-            return fields;
-        }
-
-        @Override
-        public void beforeUpdate(Node node, Node usage) {
-            if (usage instanceof ArrayLength) {
-                ArrayLength x = (ArrayLength) usage;
-                x.replaceAndDelete(((NewArray) node).dimension(0));
-            } else {
-                super.beforeUpdate(node, usage);
-            }
-        }
-
-        @Override
-        public int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState) {
-            if (current instanceof AccessIndexed) {
-                AccessIndexed x = (AccessIndexed) current;
-                if (x.array() == node) {
-                    int index = ((AccessIndexed) current).index().asConstant().asInt();
-                    if (current instanceof LoadIndexed) {
-                        x.replaceAtUsages(fieldState[index]);
-                        assert x.usages().size() == 0;
-                        x.replaceAndDelete(x.next());
-                    } else if (current instanceof StoreIndexedNode) {
-                        fieldState[index] = ((StoreIndexedNode) x).value();
-                        assert x.usages().size() == 0;
-                        x.replaceAndDelete(x.next());
-                        return index;
-                    }
-                }
-            }
-            return -1;
-        }
-    };
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +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.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.*;
-
-/**
- * The {@code NewInstance} instruction represents the allocation of an instance class object.
- */
-public final class NewInstance extends FixedNodeWithNext {
-
-    final RiType instanceClass;
-    public final int cpi;
-    public final RiConstantPool constantPool;
-
-    /**
-     * Constructs a NewInstance instruction.
-     * @param type the class being allocated
-     * @param cpi the constant pool index
-     * @param graph
-     */
-    public NewInstance(RiType type, int cpi, RiConstantPool constantPool, Graph graph) {
-        super(CiKind.Object, graph);
-        this.instanceClass = type;
-        this.cpi = cpi;
-        this.constantPool = constantPool;
-    }
-
-    /**
-     * Gets the instance class being allocated by this instruction.
-     * @return the instance class allocated
-     */
-    public RiType instanceClass() {
-        return instanceClass;
-    }
-
-    /**
-     * Gets the exact type produced by this instruction. For allocations of instance classes, this is
-     * always the class allocated.
-     * @return the exact type produced by this instruction
-     */
-    @Override
-    public RiType exactType() {
-        return instanceClass;
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitNewInstance(this);
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("instanceClass", instanceClass);
-        properties.put("cpi", cpi);
-        return properties;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public  T lookup(Class clazz) {
-        if (clazz == EscapeOp.class) {
-            return (T) ESCAPE;
-        }
-        return super.lookup(clazz);
-    }
-
-    private static final EscapeOp ESCAPE = new EscapeOp() {
-
-        @Override
-        public boolean canAnalyze(Node node) {
-            return ((NewInstance) node).instanceClass().isResolved();
-        }
-
-        @Override
-        public boolean escape(Node node, Node usage) {
-            if (usage instanceof LoadField) {
-                LoadField x = (LoadField) usage;
-                assert x.object() == node;
-                return x.field().isResolved() == false;
-            } else if (usage instanceof StoreFieldNode) {
-                StoreFieldNode x = (StoreFieldNode) usage;
-                return x.value() == node && x.object() != node;
-            } else if (usage instanceof StoreIndexedNode) {
-                StoreIndexedNode x = (StoreIndexedNode) usage;
-                assert x.value() == node;
-                return true;
-            } else if (usage instanceof VirtualObjectFieldNode) {
-                return false;
-            } else if (usage instanceof RegisterFinalizer) {
-                RegisterFinalizer x = (RegisterFinalizer) usage;
-                assert x.object() == node;
-                return false;
-            } else {
-                return super.escape(node, usage);
-            }
-        }
-
-        @Override
-        public EscapeField[] fields(Node node) {
-            NewInstance x = (NewInstance) node;
-            RiField[] riFields = x.instanceClass().fields();
-            EscapeField[] fields = new EscapeField[riFields.length];
-            for (int i = 0; i < riFields.length; i++) {
-                RiField field = riFields[i];
-                fields[i] = new EscapeField(field.name(), field, field.kind().stackKind());
-            }
-            return fields;
-        }
-
-        @Override
-        public void beforeUpdate(Node node, Node usage) {
-            if (usage instanceof RegisterFinalizer) {
-                RegisterFinalizer x = (RegisterFinalizer) usage;
-                x.replaceAndDelete(x.next());
-            } else {
-                super.beforeUpdate(node, usage);
-            }
-        }
-
-        @Override
-        public int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState) {
-            if (current instanceof AccessField) {
-                AccessField x = (AccessField) current;
-                if (x.object() == node) {
-                    int field = fieldIndex.get(((AccessField) current).field());
-                    if (current instanceof LoadField) {
-                        assert fieldState[field] != null : field + ", " + ((AccessField) current).field();
-                        x.replaceAtUsages(fieldState[field]);
-                        assert x.usages().size() == 0;
-                        x.replaceAndDelete(x.next());
-                    } else if (current instanceof StoreFieldNode) {
-                        fieldState[field] = ((StoreFieldNode) x).value();
-                        assert x.usages().size() == 0;
-                        x.replaceAndDelete(x.next());
-                        return field;
-                    }
-                }
-            }
-            return -1;
-        }
-    };
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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.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 NewMultiArray} instruction represents an allocation of a multi-dimensional object
- * array.
- */
-public final class NewMultiArray extends NewArray {
-
-    @Input private final NodeInputList dimensions;
-
-    @Override
-    public ValueNode dimension(int index) {
-        return dimensions.get(index);
-    }
-
-    public void setDimension(int index, ValueNode x) {
-        dimensions.set(index, x);
-    }
-
-    /**
-     * The rank of the array allocated by this instruction, i.e. how many array dimensions.
-     */
-    @Override
-    public int dimensionCount() {
-        return dimensions.size();
-    }
-
-    public final RiType elementType;
-    public final int cpi;
-    public final RiConstantPool constantPool;
-
-    /**
-     * Constructs a new NewMultiArray instruction.
-     * @param elementType the element type of the array
-     * @param dimensions the instructions which produce the dimensions for this array
-     * @param cpi the constant pool index for resolution
-     * @param riConstantPool the constant pool for resolution
-     * @param 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);
-        for (int i = 0; i < dimensions.length; i++) {
-            setDimension(i, dimensions[i]);
-        }
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitNewMultiArray(this);
-    }
-
-    /**
-     * Gets the element type of the array.
-     * @return the element type of the array
-     */
-    public RiType elementType() {
-        return elementType;
-    }
-
-    @Override
-    public CiKind elementKind() {
-        return elementType.kind();
-    }
-
-    @Override
-    public RiType exactType() {
-        return elementType.arrayOf();
-    }
-
-    @Override
-    public RiType declaredType() {
-        return exactType();
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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.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 NewObjectArray} instruction represents an allocation of an object array.
- */
-public final class NewObjectArray extends NewArray {
-
-    final RiType elementClass;
-
-    /**
-     * Constructs a new NewObjectArray instruction.
-     * @param elementClass the class of elements in this array
-     * @param length the instruction producing the length of the array
-     * @param graph
-     */
-    public NewObjectArray(RiType elementClass, ValueNode length, Graph graph) {
-        super(length, graph);
-        this.elementClass = elementClass;
-    }
-
-    /**
-     * Gets the type of the elements of the array.
-     * @return the element type of the array
-     */
-    public RiType elementType() {
-        return elementClass;
-    }
-
-    @Override
-    public CiKind elementKind() {
-        return elementClass.kind();
-    }
-
-    @Override
-    public RiType exactType() {
-        return elementClass.arrayOf();
-    }
-
-    @Override
-    public RiType declaredType() {
-        return exactType();
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitNewObjectArray(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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.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 NewTypeArray} class definition.
- */
-public final class NewTypeArray extends NewArray {
-
-    final RiType elementType;
-
-    public NewTypeArray(ValueNode length, RiType elementType, Graph graph) {
-        super(length, graph);
-        this.elementType = elementType;
-    }
-
-    @Override
-    public CiKind elementKind() {
-        return elementType.kind();
-    }
-
-    @Override
-    public RiType declaredType() {
-        return elementType.arrayOf();
-    }
-
-    @Override
-    public RiType exactType() {
-        return elementType.arrayOf();
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitNewTypeArray(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.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.*;
-
-/**
- * Returns -1, 0, or 1 if either x > y, x == y, or x < y.
- */
-public final class NormalizeCompare extends Binary {
-
-    /**
-     * Creates a new compare operation.
-     * @param opcode the bytecode opcode
-     * @param kind the result kind
-     * @param x the first input
-     * @param y the second input
-     */
-    public NormalizeCompare(int opcode, CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, opcode, x, y, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitNormalizeCompare(this);
-    }
-
-    @Override
-    public Map getDebugProperties() {
-        Map properties = super.getDebugProperties();
-        properties.put("isUnorderedLess", isUnorderedLess());
-        return properties;
-    }
-
-    public boolean isUnorderedLess() {
-        return this.opcode == Bytecodes.FCMPL || this.opcode == Bytecodes.DCMPL;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 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 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 Or extends Logic implements Canonicalizable {
-
-    public Or(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.IOR : Bytecodes.LOR, x, y, graph);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (x() == y()) {
-            return x();
-        }
-        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 == -1) {
-                    return Constant.forInt(-1, graph());
-                }
-                if (c == 0) {
-                    return x();
-                }
-            } else {
-                assert kind == CiKind.Long;
-                long c = y().asConstant().asLong();
-                if (c == -1) {
-                    return Constant.forLong(-1, graph());
-                }
-                if (c == 0) {
-                    return x();
-                }
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +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.*;
-import com.oracle.max.graal.compiler.debug.*;
-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.*;
-
-/**
- * The {@code Phi} instruction represents the merging of dataflow in the instruction graph. It refers to a join block
- * and a variable.
- */
-public final class Phi extends FloatingNode implements Canonicalizable {
-
-    @Input private Merge merge;
-
-    @Input private final NodeInputList values = new NodeInputList(this);
-
-    public Merge merge() {
-        return merge;
-    }
-
-    public void setMerge(Merge x) {
-        updateUsages(merge, x);
-        merge = x;
-    }
-
-    public static enum PhiType {
-        Value, // normal value phis
-        Memory, // memory phis
-        Virtual // phis used for VirtualObjectField merges
-    }
-
-    private final PhiType type;
-
-    public Phi(CiKind kind, Merge merge, PhiType type, Graph graph) {
-        super(kind, graph);
-        this.type = type;
-        setMerge(merge);
-    }
-
-    private Phi(CiKind kind, PhiType type, Graph graph) {
-        super(kind, graph);
-        this.type = type;
-    }
-
-    public PhiType type() {
-        return type;
-    }
-
-    @Override
-    public boolean verify() {
-        assertTrue(merge() != null);
-        assertTrue(merge().phiPredecessorCount() == valueCount(), merge().phiPredecessorCount() + "==" + valueCount());
-        return true;
-    }
-
-    /**
-     * Get the instruction that produces the value associated with the i'th predecessor of the join block.
-     *
-     * @param i the index of the predecessor
-     * @return the instruction that produced the value in the i'th predecessor
-     */
-    public ValueNode valueAt(int i) {
-        return values.get(i);
-    }
-
-    public void setValueAt(int i, ValueNode x) {
-        values.set(i, x);
-    }
-
-    /**
-     * Get the number of inputs to this phi (i.e. the number of predecessors to the join block).
-     *
-     * @return the number of inputs in this phi
-     */
-    public int valueCount() {
-        return values.size();
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitPhi(this);
-    }
-
-    @Override
-    public String shortName() {
-        StringBuilder str = new StringBuilder();
-        for (int i = 0; i < valueCount(); ++i) {
-            if (i != 0) {
-                str.append(' ');
-            }
-            str.append(valueAt(i) == null ? "-" : valueAt(i).id());
-        }
-        if (type == PhiType.Value) {
-            return "Phi: (" + str + ")";
-        } else {
-            return type + "Phi: (" + str + ")";
-        }
-    }
-
-    public void addInput(ValueNode x) {
-        values.add(x);
-    }
-
-    public void removeInput(int index) {
-        values.remove(index);
-    }
-
-    @Override
-    public Iterable< ? extends Node> dataInputs() {
-        final Iterator< ? extends Node> input = super.dataInputs().iterator();
-        return new Iterable() {
-
-            @Override
-            public Iterator iterator() {
-                return new FilteringIterator(input, Merge.class);
-            }
-        };
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        if (valueCount() != 2 || merge().endCount() != 2) {
-            return this;
-        }
-        if (merge().phis().size() > 1) { // XXX (gd) disable canonicalization of multiple conditional while we are not able to fuse them and the potentially leftover If in the backend
-            return this;
-        }
-        Node end0 = merge().endAt(0);
-        Node end1 = merge().endAt(1);
-        Node endPred0 = end0.predecessor();
-        Node endPred1 = end1.predecessor();
-        if (endPred0 != endPred1 || !(endPred0 instanceof If)) {
-            return this;
-        }
-        If ifNode = (If) endPred0;
-        boolean inverted = ifNode.trueSuccessor() == end1;
-        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;
-        }
-        if ((!(trueValue instanceof Constant) && trueValue.usages().size() == 1) || (!(falseValue instanceof Constant) && falseValue.usages().size() == 1)) {
-            return this;
-        }
-        BooleanNode compare = ifNode.compare();
-        while (compare instanceof NegateBooleanNode) {
-            compare = ((NegateBooleanNode) compare).value();
-        }
-        if (!(compare instanceof Compare || compare instanceof IsNonNull || compare instanceof NegateBooleanNode || compare instanceof Constant)) {
-            return this;
-        }
-        if (GraalOptions.TraceCanonicalizer) {
-            TTY.println("> Phi canon'ed to Conditional");
-        }
-        reProcess.reProccess(ifNode);
-        return new Conditional(ifNode.compare(), trueValue, falseValue, graph());
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public class Placeholder extends StateSplit {
-
-    public Placeholder(Graph graph) {
-        super(CiKind.Void, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        //assert false;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.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, ValueNode object, LocationNode location, Graph graph) {
-        super(kind, object, location, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitMemoryRead(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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.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, ValueNode object, LocationNode location, Graph graph) {
-        super(CiKind.Illegal, vector, object, location, graph);
-    }
-
-    @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());
-        assert index != null;
-        newLocation.setIndex(index);
-        ReadNode readNode = new ReadNode(location().getValueKind().stackKind(), object(), newLocation, graph());
-        loop.loopEnd().replaceAtPredecessors(readNode);
-        readNode.setNext(loop.loopEnd());
-        nodes.put(this, readNode);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2011, 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.*;
-import com.oracle.max.graal.compiler.debug.*;
-import com.oracle.max.graal.compiler.graph.*;
-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.*;
-
-/**
- * This instruction is used to perform the finalizer registration at the end of the java.lang.Object constructor.
- */
-public final class RegisterFinalizer extends StateSplit implements Canonicalizable {
-
-    @Input private ValueNode object;
-
-    public ValueNode object() {
-        return object;
-    }
-
-    public void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
-    }
-
-    public RegisterFinalizer(ValueNode object, Graph graph) {
-        super(CiKind.Void, graph);
-        setObject(object);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitRegisterFinalizer(this);
-    }
-
-    @Override
-    public Node canonical(NotifyReProcess reProcess) {
-        RiType declaredType = object.declaredType();
-        RiType exactType = object.exactType();
-        if (exactType == null && declaredType != null) {
-            exactType = declaredType.exactType();
-        }
-
-        boolean needsCheck = true;
-        if (exactType != null) {
-            // we have an exact type
-            needsCheck = exactType.hasFinalizer();
-        } else {
-            // if either the declared type of receiver or the holder can be assumed to have no finalizers
-            if (declaredType != null && !declaredType.hasFinalizableSubclass()) {
-                if (((CompilerGraph) graph()).assumptions().recordNoFinalizableSubclassAssumption(declaredType)) {
-                    needsCheck = false;
-                }
-            }
-        }
-
-        if (needsCheck) {
-            if (GraalOptions.TraceCanonicalizer) {
-                TTY.println("Could not canonicalize finalizer " + object + " (declaredType=" + declaredType + ", exactType=" + exactType + ")");
-            }
-        } else {
-            if (GraalOptions.TraceCanonicalizer) {
-                TTY.println("Canonicalized finalizer for object " + object);
-            }
-            return next();
-        }
-
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +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.nodes.base.*;
-import com.oracle.max.graal.compiler.nodes.spi.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code Return} class definition.
- */
-public final class Return extends FixedNode {
-
-    @Input private ValueNode result;
-
-    public ValueNode result() {
-        return result;
-    }
-
-    public void setResult(ValueNode x) {
-        updateUsages(this.result, x);
-        this.result = x;
-    }
-
-    /**
-     * Constructs a new Return instruction.
-     * @param result the instruction producing the result for this return; {@code null} if this
-     * is a void return
-     * @param graph
-     */
-    public Return(ValueNode result, Graph graph) {
-        super(result == null ? CiKind.Void : result.kind, graph);
-        setResult(result);
-    }
-
-    // for copying
-    private Return(CiKind kind, Graph graph) {
-        super(kind, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitReturn(this);
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +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.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 ShiftNode implements Canonicalizable {
-
-    public RightShift(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
-        super(kind, kind == CiKind.Int ? Bytecodes.ISHR : Bytecodes.LSHR, 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 RightShift) {
-                        int total = amount + otherAmount;
-                        if (total != (total & mask)) {
-                            return Constant.forInt(0, graph());
-                        }
-                        return new RightShift(kind, other.x(), Constant.forInt(total, graph()), graph());
-                    }
-                }
-            }
-            if (originalAmout != amount) {
-                return new RightShift(kind, x(), Constant.forInt(amount, graph()), graph());
-            }
-        }
-        return this;
-    }
-}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/package-info.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/package-info.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- */
-
-/**
- * High-level intermediate representation (HIR).
- */
-package com.oracle.max.graal.compiler.ir;
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRAssembler.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRAssembler.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRAssembler.java	Wed Aug 10 00:34:29 2011 +0200
@@ -29,8 +29,8 @@
 import com.oracle.max.graal.compiler.asm.*;
 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.lir.FrameMap.StackBlock;
+import com.oracle.max.graal.compiler.nodes.calc.*;
 import com.oracle.max.graal.compiler.util.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ci.CiTargetMethod.Mark;
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java	Wed Aug 10 00:34:29 2011 +0200
@@ -27,8 +27,8 @@
 import com.oracle.max.asm.*;
 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.nodes.java.*;
 import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.graph.*;
 
@@ -295,6 +295,6 @@
     }
 
     public boolean isExceptionEntry() {
-        return firstInstruction() instanceof ExceptionObject;
+        return firstInstruction() instanceof ExceptionObjectNode;
     }
 }
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBranch.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBranch.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBranch.java	Wed Aug 10 00:34:29 2011 +0200
@@ -23,7 +23,7 @@
 package com.oracle.max.graal.compiler.lir;
 
 import com.oracle.max.asm.*;
-import com.oracle.max.graal.compiler.ir.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
 import com.sun.cri.ci.*;
 
 /**
diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java	Wed Aug 10 00:34:29 2011 +0200
@@ -30,7 +30,7 @@
 import com.oracle.max.graal.compiler.debug.*;
 import com.oracle.max.graal.compiler.gen.*;
 import com.oracle.max.graal.compiler.globalstub.*;
-import com.oracle.max.graal.compiler.ir.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ci.CiTargetMethod.Mark;
 import com.sun.cri.ri.*;
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIROp2.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIROp2.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIROp2.java	Wed Aug 10 00:34:29 2011 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.max.graal.compiler.lir;
 
-import com.oracle.max.graal.compiler.ir.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
 import com.sun.cri.ci.*;
 
 /**
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/AnchorNode.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/AnchorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,48 @@
+/*
+ * 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 com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code Anchor} instruction represents the end of a block with an unconditional jump to another block.
+ */
+public final class AnchorNode extends FixedWithNextNode {
+
+    @Input private final NodeInputList guards = new NodeInputList(this);
+
+    public AnchorNode(Graph graph) {
+        super(CiKind.Illegal, graph);
+    }
+
+    public void addGuard(GuardNode x) {
+        guards.add(x);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitAnchor(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/BooleanNode.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/BooleanNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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.base;
+
+import com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public abstract class BooleanNode extends FloatingNode {
+
+    public BooleanNode(CiKind kind, Graph graph) {
+        super(kind, graph);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/CastNode.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/CastNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,67 @@
+/*
+ * 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.base;
+
+import com.oracle.max.graal.compiler.nodes.calc.*;
+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 ValueNode value;
+
+    public ValueNode value() {
+        return value;
+    }
+
+    public void setValue(ValueNode x) {
+        updateUsages(value, x);
+        value = x;
+    }
+
+    public CastNode(CiKind kind, ValueNode n, Graph graph) {
+        super(kind, graph);
+        setValue(n);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+    }
+
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LIRGeneratorOp.class) {
+            return (T) new LIRGeneratorOp() {
+                @Override
+                public void generate(Node n, LIRGeneratorTool generator) {
+                    CastNode conv = (CastNode) n;
+                    conv.setOperand(generator.load(conv.value()));
+                }
+            };
+        }
+        return super.lookup(clazz);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ConstantNode.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/ConstantNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,180 @@
+/*
+ * 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.GraalCompilation.*;
+
+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 Constant} instruction represents a constant such as an integer value,
+ * long, float, object reference, address, etc.
+ */
+public final class ConstantNode extends BooleanNode {
+
+    @Data public final CiConstant value;
+
+    /**
+     * Constructs a new instruction representing the specified constant.
+     * @param value the constant
+     * @param graph
+     */
+    public ConstantNode(CiConstant value, Graph graph) {
+        super(value.kind.stackKind(), graph);
+        this.value = value;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitConstant(this);
+    }
+
+    /**
+     * Creates an instruction for a double constant.
+     * @param d the double value for which to create the instruction
+     * @param graph
+     * @return an instruction representing the double
+     */
+    public static ConstantNode forDouble(double d, Graph graph) {
+        return new ConstantNode(CiConstant.forDouble(d), graph);
+    }
+
+    /**
+     * Creates an instruction for a float constant.
+     * @param f the float value for which to create the instruction
+     * @return an instruction representing the float
+     */
+    public static ConstantNode forFloat(float f, Graph graph) {
+        return new ConstantNode(CiConstant.forFloat(f), graph);
+    }
+
+    /**
+     * Creates an instruction for an long constant.
+     * @param i the long value for which to create the instruction
+     * @return an instruction representing the long
+     */
+    public static ConstantNode forLong(long i, Graph graph) {
+        return new ConstantNode(CiConstant.forLong(i), graph);
+    }
+
+    /**
+     * Creates an instruction for an integer constant.
+     * @param i the integer value for which to create the instruction
+     * @return an instruction representing the integer
+     */
+    public static ConstantNode forInt(int i, Graph graph) {
+        return new ConstantNode(CiConstant.forInt(i), graph);
+    }
+
+    /**
+     * Creates an instruction for a boolean constant.
+     * @param i the boolean value for which to create the instruction
+     * @return an instruction representing the boolean
+     */
+    public static ConstantNode forBoolean(boolean i, Graph graph) {
+        return new ConstantNode(CiConstant.forBoolean(i), graph);
+    }
+
+    /**
+     * Creates an instruction for an address (jsr/ret address) constant.
+     * @param i the address value for which to create the instruction
+     * @return an instruction representing the address
+     */
+    public static ConstantNode forJsr(int i, Graph graph) {
+        return new ConstantNode(CiConstant.forJsr(i), graph);
+    }
+
+    /**
+     * Creates an instruction for an object constant.
+     * @param o the object value for which to create the instruction
+     * @return an instruction representing the object
+     */
+    public static ConstantNode forObject(Object o, Graph graph) {
+        return new ConstantNode(CiConstant.forObject(o), graph);
+    }
+
+    /**
+     * Creates an instruction for a word constant.
+     * @param val the word value for which to create the instruction
+     * @return an instruction representing the word
+     */
+    public static ConstantNode forWord(long val, Graph graph) {
+        return new ConstantNode(CiConstant.forWord(val), graph);
+    }
+
+    public static ConstantNode defaultForKind(CiKind kind, Graph graph) {
+        switch(kind) {
+            case Boolean:
+                return ConstantNode.forBoolean(false, graph);
+            case Byte:
+            case Char:
+            case Short:
+            case Int:
+                return ConstantNode.forInt(0, graph);
+            case Double:
+                return ConstantNode.forDouble(0.0, graph);
+            case Float:
+                return ConstantNode.forFloat(0.0f, graph);
+            case Long:
+                return ConstantNode.forLong(0L, graph);
+            case Object:
+                return ConstantNode.forObject(null, graph);
+            case Word:
+                return ConstantNode.forWord(0L, graph);
+            default:
+                return null;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + "(" + value + ")";
+    }
+
+    @Override
+    public int valueNumber() {
+        return 0x50000000 | value.hashCode();
+    }
+
+    @Override
+    public RiType declaredType() {
+        RiRuntime runtime = compilation().runtime;
+        if (kind.isPrimitive()) {
+            return runtime.asRiType(kind);
+        }
+        return runtime.getTypeOf(asConstant());
+    }
+
+    @Override
+    public RiType exactType() {
+        return declaredType();
+    }
+
+    @Override
+    public String shortName() {
+        return value.name();
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ControlSplitNode.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/ControlSplitNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,121 @@
+/*
+ * 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.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code BlockEnd} instruction is a base class for all instructions that end a basic
+ * block, including branches, switches, throws, and goto's.
+ */
+public abstract class ControlSplitNode extends FixedNode {
+
+    @Successor    private final NodeSuccessorList blockSuccessors;
+
+    public FixedNode blockSuccessor(int index) {
+        return blockSuccessors.get(index);
+    }
+
+    public void setBlockSuccessor(int index, FixedNode x) {
+        blockSuccessors.set(index, x);
+    }
+
+    public int blockSuccessorCount() {
+        return blockSuccessors.size();
+    }
+
+    protected final double[] branchProbability;
+
+    /**
+     * Constructs a new block end with the specified value type.
+     * @param kind the type of the value produced by this instruction
+     * @param successors the list of successor blocks. If {@code null}, a new one will be created.
+     */
+    public ControlSplitNode(CiKind kind, List blockSuccessors, double[] branchProbability, Graph graph) {
+        this(kind, blockSuccessors.size(), branchProbability, graph);
+        for (int i = 0; i < blockSuccessors.size(); i++) {
+            setBlockSuccessor(i, blockSuccessors.get(i));
+        }
+    }
+
+    public ControlSplitNode(CiKind kind, int blockSuccessorCount, double[] branchProbability, Graph graph) {
+        super(kind, graph);
+        this.blockSuccessors = new NodeSuccessorList(this, blockSuccessorCount);
+        assert branchProbability.length == blockSuccessorCount;
+        this.branchProbability = branchProbability;
+    }
+
+    public double probability(int successorIndex) {
+        return branchProbability[successorIndex];
+    }
+
+    public void setProbability(int successorIndex, double x) {
+        branchProbability[successorIndex] = x;
+    }
+
+    /**
+     * Gets the successor corresponding to the default (fall through) case.
+     * @return the default successor
+     */
+    public FixedNode defaultSuccessor() {
+        return blockSuccessor(blockSuccessorCount() - 1);
+    }
+
+    public Iterable blockSuccessors() {
+        return new Iterable() {
+            @Override
+            public Iterator iterator() {
+                return new Iterator() {
+                    int i = 0;
+                    @Override
+                    public void remove() {
+                        throw new UnsupportedOperationException();
+                    }
+                    @Override
+                    public FixedNode next() {
+                        return ControlSplitNode.this.blockSuccessor(i++);
+                    }
+
+                    @Override
+                    public boolean hasNext() {
+                        return i < ControlSplitNode.this.blockSuccessorCount();
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        StringBuilder str = new StringBuilder();
+        for (int i = 0; i < branchProbability.length; i++) {
+            str.append(i == 0 ? "" : ", ").append(String.format("%7.5f", branchProbability[i]));
+        }
+        properties.put("branchProbability", str.toString());
+        return properties;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/DeoptimizeNode.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/DeoptimizeNode.java	Wed Aug 10 00:34:29 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.base;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+@NodeInfo(shortName = "Deopt")
+public class DeoptimizeNode extends FixedNode {
+
+    public static enum DeoptAction {
+        None,                           // just interpret, do not invalidate nmethod
+        Recompile,                      // recompile the nmethod; need not invalidate
+        InvalidateReprofile,            // invalidate the nmethod, reset IC, maybe recompile
+        InvalidateRecompile,            // invalidate the nmethod, recompile (probably)
+        InvalidateStopCompiling,        // invalidate the nmethod and do not compile
+    }
+
+    private String message;
+    private final DeoptAction action;
+
+    public DeoptimizeNode(DeoptAction action, Graph graph) {
+        super(CiKind.Illegal, graph);
+        this.action = action;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public String message() {
+        return message;
+    }
+
+    public DeoptAction action() {
+        return action;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitDeoptimize(this);
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("message", message);
+        properties.put("action", action);
+        return properties;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/EndNode.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/EndNode.java	Wed Aug 10 00:34:29 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.base;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public final class EndNode extends FixedNode {
+
+    public EndNode(Graph graph) {
+        super(CiKind.Illegal, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitEndNode(this);
+    }
+
+    public MergeNode merge() {
+        if (usages().size() == 0) {
+            return null;
+        } else {
+            assert usages().size() == 1;
+            return (MergeNode) usages().iterator().next();
+        }
+    }
+
+    @Override
+    public boolean verify() {
+        assertTrue(usages().size() <= 1, "at most one usage");
+        return true;
+    }
+
+    @Override
+    public Iterable< ? extends Node> dataUsages() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public Iterable< ? extends Node> cfgSuccessors() {
+        MergeNode merge = this.merge();
+        if (merge == null) {
+            return Collections.emptyList();
+        }
+        return Arrays.asList(merge);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedGuardNode.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/FixedGuardNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,70 @@
+/*
+ * 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.base;
+
+import com.oracle.max.graal.compiler.nodes.base.DeoptimizeNode.DeoptAction;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+public final class FixedGuardNode extends FixedWithNextNode implements Canonicalizable {
+
+    @Input private final NodeInputList conditions = new NodeInputList(this);
+
+    public FixedGuardNode(BooleanNode node, Graph graph) {
+        this(graph);
+        addNode(node);
+    }
+
+    public FixedGuardNode(Graph graph) {
+        super(CiKind.Illegal, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitFixedGuard(this);
+    }
+
+    public void addNode(BooleanNode x) {
+        conditions.add(x);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        for (BooleanNode n : conditions.snapshot()) {
+            if (n instanceof ConstantNode) {
+                ConstantNode c = (ConstantNode) n;
+                if (c.asConstant().asBoolean()) {
+                    conditions.remove(n);
+                } else {
+                    return new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph());
+                }
+            }
+        }
+
+        if (conditions.isEmpty()) {
+            return next();
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedNode.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/FixedNode.java	Wed Aug 10 00:34:29 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.base;
+
+import java.util.*;
+
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+public abstract class FixedNode extends ValueNode {
+
+    private double probability;
+
+    public FixedNode(CiKind kind, Graph graph) {
+        super(kind, graph);
+    }
+
+    public double probability() {
+        return probability;
+    }
+
+    public void setProbability(double probability) {
+        this.probability = probability;
+    }
+
+    protected void copyInto(FixedNode newNode) {
+        newNode.setProbability(probability);
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("probability", String.format(Locale.ENGLISH, "%7.5f", probability));
+        return properties;
+    }
+
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedWithNextNode.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/FixedWithNextNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,50 @@
+/*
+ * 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.base;
+
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+public abstract class FixedWithNextNode extends FixedNode {
+
+    @Successor    private FixedNode next;
+
+    public FixedNode next() {
+        return next;
+    }
+
+    public void setNext(FixedNode x) {
+        updatePredecessors(next, x);
+        next = x;
+    }
+
+    public static final int SYNCHRONIZATION_ENTRY_BCI = -1;
+
+    /**
+     * Constructs a new instruction with the specified value type.
+     * @param kind the value type for this instruction
+     */
+    public FixedWithNextNode(CiKind kind, Graph graph) {
+        super(kind, graph);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FrameState.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FrameState.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FrameState.java	Wed Aug 10 00:34:29 2011 +0200
@@ -26,10 +26,10 @@
 
 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.base.PhiNode.PhiType;
+import com.oracle.max.graal.compiler.nodes.calc.*;
 import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.compiler.nodes.virtual.*;
 import com.oracle.max.graal.compiler.value.*;
 import com.oracle.max.graal.graph.*;
 import com.sun.cri.ci.*;
@@ -124,7 +124,7 @@
     }
 
     public void addVirtualObjectMapping(Node virtualObject) {
-        assert virtualObject instanceof VirtualObjectFieldNode || virtualObject instanceof Phi : virtualObject;
+        assert virtualObject instanceof VirtualObjectFieldNode || virtualObject instanceof PhiNode : virtualObject;
         virtualObjectMappings.add(virtualObject);
     }
 
@@ -330,16 +330,16 @@
      * @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) {
+    public PhiNode setupPhiForStack(MergeNode block, int i) {
         ValueNode p = stackAt(i);
         if (p != null) {
-            if (p instanceof Phi) {
-                Phi phi = (Phi) p;
+            if (p instanceof PhiNode) {
+                PhiNode phi = (PhiNode) p;
                 if (phi.merge() == block) {
                     return phi;
                 }
             }
-            Phi phi = new Phi(p.kind, block, PhiType.Value, graph());
+            PhiNode phi = new PhiNode(p.kind, block, PhiType.Value, graph());
             setValueAt(localsSize + i, phi);
             return phi;
         }
@@ -351,15 +351,15 @@
      * @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) {
+    public PhiNode setupPhiForLocal(MergeNode block, int i) {
         ValueNode p = localAt(i);
-        if (p instanceof Phi) {
-            Phi phi = (Phi) p;
+        if (p instanceof PhiNode) {
+            PhiNode phi = (PhiNode) p;
             if (phi.merge() == block) {
                 return phi;
             }
         }
-        Phi phi = new Phi(p.kind, block, PhiType.Value, graph());
+        PhiNode phi = new PhiNode(p.kind, block, PhiType.Value, graph());
         storeLocal(i, phi);
         return phi;
     }
@@ -399,22 +399,22 @@
         }
     }
 
-    public void merge(Merge block, FrameStateAccess other) {
+    public void merge(MergeNode 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 (x != y || ((x instanceof PhiNode) && ((PhiNode) x).merge() == block)) {
                     if (typeMismatch(x, y)) {
-                        if ((x instanceof Phi) && ((Phi) x).merge() == block) {
+                        if ((x instanceof PhiNode) && ((PhiNode) x).merge() == block) {
                             x.replaceAtUsages(null);
                             x.delete();
                         }
                         setValueAt(i, null);
                         continue;
                     }
-                    Phi phi = null;
+                    PhiNode phi = null;
                     if (i < localsSize) {
                         // this a local
                         phi = setupPhiForLocal(block, i);
@@ -433,16 +433,16 @@
                         phi.addInput((x == y) ? phi : y);
                     }
 
-                    assert phi.valueCount() == block.phiPredecessorCount() + (block instanceof LoopBegin ? 0 : 1) : "valueCount=" + phi.valueCount() + " predSize= " + block.phiPredecessorCount();
+                    assert phi.valueCount() == block.phiPredecessorCount() + (block instanceof LoopBeginNode ? 0 : 1) : "valueCount=" + phi.valueCount() + " predSize= " + block.phiPredecessorCount();
                }
             }
         }
     }
 
-    public Merge block() {
+    public MergeNode block() {
         for (Node n : usages()) {
-            if (n instanceof Merge) {
-                return (Merge) n;
+            if (n instanceof MergeNode) {
+                return (MergeNode) n;
             }
         }
         return null;
@@ -494,20 +494,20 @@
     }
 
     /**
-     * The interface implemented by a client of {@link FrameState#forEachPhi(Merge, PhiProcedure)} and
-     * {@link FrameState#forEachLivePhi(Merge, PhiProcedure)}.
+     * The interface implemented by a client of {@link FrameState#forEachPhi(MergeNode, PhiProcedure)} and
+     * {@link FrameState#forEachLivePhi(MergeNode, PhiProcedure)}.
      */
     public static interface PhiProcedure {
-        boolean doPhi(Phi phi);
+        boolean doPhi(PhiNode phi);
     }
 
     /**
-     * Checks whether this frame state has any {@linkplain Phi phi} statements.
+     * Checks whether this frame state has any {@linkplain PhiNode phi} statements.
      */
     public boolean hasPhis() {
         for (int i = 0; i < valuesSize(); i++) {
             ValueNode value = valueAt(i);
-            if (value instanceof Phi) {
+            if (value instanceof PhiNode) {
                 return true;
             }
         }
@@ -580,8 +580,8 @@
                                 }
                                 currentField = ((VirtualObjectFieldNode) currentField).lastState();
                             } else {
-                                assert currentField instanceof Phi : currentField;
-                                currentField = (FloatingNode) ((Phi) currentField).valueAt(0);
+                                assert currentField instanceof PhiNode : currentField;
+                                currentField = (FloatingNode) ((PhiNode) currentField).valueAt(0);
                             }
                         } while (currentField != null);
                     }
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/GuardNode.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/GuardNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,81 @@
+/*
+ * 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.base;
+
+import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.compiler.debug.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+public final class GuardNode extends FloatingNode implements Canonicalizable {
+
+    @Input private FixedNode anchor;
+    @Input private BooleanNode node;
+
+    public FixedNode anchor() {
+        return anchor;
+    }
+
+    public void setAnchor(FixedNode x) {
+        updateUsages(anchor, x);
+        anchor = x;
+    }
+
+    /**
+     * The instruction that produces the tested boolean value.
+     */
+    public BooleanNode node() {
+        return node;
+    }
+
+    public void setNode(BooleanNode x) {
+        updateUsages(node, x);
+        node = x;
+    }
+
+    public GuardNode(BooleanNode node, Graph graph) {
+        super(CiKind.Illegal, graph);
+        setNode(node);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitGuardNode(this);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (node() instanceof ConstantNode) {
+            ConstantNode c = (ConstantNode) node();
+            if (c.asConstant().asBoolean()) {
+                if (GraalOptions.TraceCanonicalizer) {
+                    TTY.println("Removing redundant floating guard " + this);
+                }
+                return Node.Null;
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/IfNode.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/IfNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,122 @@
+/*
+ * 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 com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code If} instruction represents a branch that can go one of two directions depending on the outcome of a
+ * comparison.
+ */
+public final class IfNode extends ControlSplitNode implements Canonicalizable {
+
+    @Input private BooleanNode compare;
+
+    public BooleanNode compare() {
+        return compare;
+    }
+
+    public void setCompare(BooleanNode x) {
+        updateUsages(compare, x);
+        compare = x;
+    }
+
+    public IfNode(BooleanNode condition, double probability, Graph graph) {
+        super(CiKind.Illegal, 2, new double[] {probability, 1 - probability}, graph);
+        setCompare(condition);
+    }
+
+    /**
+     * Gets the block corresponding to the true successor.
+     *
+     * @return the true successor
+     */
+    public FixedNode trueSuccessor() {
+        return blockSuccessor(0);
+    }
+
+    /**
+     * Gets the block corresponding to the false successor.
+     *
+     * @return the false successor
+     */
+    public FixedNode falseSuccessor() {
+        return blockSuccessor(1);
+    }
+
+    public void setTrueSuccessor(FixedNode node) {
+        setBlockSuccessor(0, node);
+    }
+
+    public void setFalseSuccessor(FixedNode node) {
+        setBlockSuccessor(1, node);
+    }
+
+    /**
+     * Gets the block corresponding to the specified outcome of the branch.
+     *
+     * @param istrue {@code true} if the true successor is requested, {@code false} otherwise
+     * @return the corresponding successor
+     */
+    public FixedNode successor(boolean istrue) {
+        return blockSuccessor(istrue ? 0 : 1);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitIf(this);
+    }
+
+    @Override
+    public boolean verify() {
+        assertTrue(compare() != null);
+        assertTrue(trueSuccessor() != null);
+        assertTrue(falseSuccessor() != null);
+        return true;
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (compare() instanceof ConstantNode) {
+            ConstantNode c = (ConstantNode) compare();
+            if (c.asConstant().asBoolean()) {
+                return trueSuccessor();
+            } else {
+                return falseSuccessor();
+            }
+        }
+        if (trueSuccessor() instanceof EndNode && falseSuccessor() instanceof EndNode) {
+            EndNode trueEnd = (EndNode) trueSuccessor();
+            EndNode falseEnd = (EndNode) falseSuccessor();
+            MergeNode merge = trueEnd.merge();
+            if (merge == falseEnd.merge() && merge.phis().size() == 0 && merge.endCount() == 2) {
+                FixedNode next = merge.next();
+                merge.setNext(null); // disconnect to avoid next from having 2 preds
+                return next;
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/InvokeNode.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/InvokeNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,163 @@
+/*
+ * 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.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.*;
+import com.sun.cri.ri.*;
+
+/**
+ * The {@code Invoke} instruction represents all kinds of method calls.
+ */
+public final class InvokeNode extends AbstractMemoryCheckpointNode implements ExceptionExit {
+
+    @Successor private FixedNode exceptionEdge;
+
+    @Input private final NodeInputList arguments;
+
+    @Override
+    public FixedNode exceptionEdge() {
+        return exceptionEdge;
+    }
+
+    public void setExceptionEdge(FixedNode x) {
+        updatePredecessors(exceptionEdge, x);
+        exceptionEdge = x;
+    }
+
+    private final int argumentCount;
+
+    private boolean canInline = true;
+
+    public boolean canInline() {
+        return canInline;
+    }
+
+    public void setCanInline(boolean b) {
+        canInline = b;
+    }
+
+    public NodeInputList arguments() {
+        return arguments;
+    }
+
+    public final int opcode;
+    public final RiMethod target;
+    public final RiType returnType;
+    public final int bci; // XXX needed because we can not compute the bci from the sateBefore bci of this Invoke was optimized from INVOKEINTERFACE to INVOKESPECIAL
+
+    /**
+     * Constructs a new Invoke instruction.
+     *
+     * @param opcode the opcode of the invoke
+     * @param result the result type
+     * @param args the list of instructions producing arguments to the invocation, including the receiver object
+     * @param isStatic {@code true} if this call is static (no receiver object)
+     * @param target the target method being called
+     */
+    public InvokeNode(int bci, int opcode, CiKind result, ValueNode[] args, RiMethod target, RiType returnType, Graph graph) {
+        super(result, graph);
+        arguments = new NodeInputList(this, args.length);
+        this.opcode = opcode;
+        this.target = target;
+        this.returnType = returnType;
+        this.bci = bci;
+
+        this.argumentCount = args.length;
+        for (int i = 0; i < args.length; i++) {
+            arguments().set(i, args[i]);
+        }
+    }
+
+    /**
+     * Gets the opcode of this invoke instruction.
+     * @return the opcode
+     */
+    public int opcode() {
+        return opcode;
+    }
+
+    /**
+     * Checks whether this is an invocation of a static method.
+     * @return {@code true} if the invocation is a static invocation
+     */
+    public boolean isStatic() {
+        return opcode == Bytecodes.INVOKESTATIC;
+    }
+
+    @Override
+    public RiType declaredType() {
+        return returnType;
+    }
+
+    /**
+     * Gets the instruction that produces the receiver object for this invocation, if any.
+     * @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 ValueNode receiver() {
+        assert !isStatic();
+        return arguments().get(0);
+    }
+
+    /**
+     * Gets the target method for this invocation instruction.
+     * @return the target method
+     */
+    public RiMethod target() {
+        return target;
+    }
+
+    /**
+     * Checks whether this invocation has a receiver object.
+     * @return {@code true} if this invocation has a receiver object; {@code false} otherwise, if this is a
+     *         static call
+     */
+    public boolean hasReceiver() {
+        return !isStatic();
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitInvoke(this);
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + target;
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("opcode", Bytecodes.nameOf(opcode));
+        properties.put("target", CiUtil.format("%H.%n(%p):%r", target, false));
+        properties.put("bci", bci);
+        return properties;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LocalNode.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/LocalNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,95 @@
+/*
+ * 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.nodes.calc.*;
+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 Local} instruction is a placeholder for an incoming argument
+ * to a function call.
+ */
+public final class LocalNode extends FloatingNode {
+
+    @Input    private StartNode start;
+
+    public StartNode start() {
+        return start;
+    }
+
+    public void setStart(StartNode x) {
+        updateUsages(start, x);
+        start = x;
+    }
+
+    private final int index;
+    private RiType declaredType;
+
+    public LocalNode(CiKind kind, int javaIndex, Graph graph) {
+        super(kind, graph);
+        this.index = javaIndex;
+        setStart(graph.start());
+    }
+
+    /**
+     * Gets the index of this local.
+     * @return the index
+     */
+    public int index() {
+        return index;
+    }
+
+    /**
+     * Sets the declared type of this local, e.g. derived from the signature of the method.
+     * @param declaredType the declared type of the local variable
+     */
+    public void setDeclaredType(RiType declaredType) {
+        this.declaredType = declaredType;
+    }
+
+    /**
+     * 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
+     */
+    @Override
+    public RiType declaredType() {
+        return declaredType;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitLocal(this);
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("index", index());
+        return properties;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LoopBeginNode.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/LoopBeginNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,147 @@
+/*
+ * 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.base;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.loop.*;
+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.*;
+
+public class LoopBeginNode extends MergeNode {
+
+    private double loopFrequency;
+
+    public LoopBeginNode(Graph graph) {
+        super(graph);
+        loopFrequency = 1;
+    }
+
+    public double loopFrequency() {
+        return loopFrequency;
+    }
+
+    public void setLoopFrequency(double loopFrequency) {
+        this.loopFrequency = loopFrequency;
+    }
+
+    public LoopEndNode loopEnd() {
+        for (Node usage : usages()) {
+            if (usage instanceof LoopEndNode) {
+                LoopEndNode end = (LoopEndNode) usage;
+                if (end.loopBegin() == this) {
+                    return end;
+                }
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitLoopBegin(this);
+    }
+
+    @Override
+    public int phiPredecessorCount() {
+        return 2;
+    }
+
+    @Override
+    public int phiPredecessorIndex(Node pred) {
+        if (pred == forwardEdge()) {
+            return 0;
+        } else if (pred == this.loopEnd()) {
+            return 1;
+        }
+        throw Util.shouldNotReachHere("unknown pred : " + pred + "(sp=" + forwardEdge() + ", le=" + this.loopEnd() + ")");
+    }
+
+    @Override
+    public Node phiPredecessorAt(int index) {
+        if (index == 0) {
+            return forwardEdge();
+        } else if (index == 1) {
+            return loopEnd();
+        }
+        throw Util.shouldNotReachHere();
+    }
+
+    public Collection inductionVariables() {
+        return Util.filter(this.usages(), InductionVariableNode.class);
+    }
+
+    @Override
+    public Iterable phiPredecessors() {
+        return Arrays.asList(new Node[]{this.forwardEdge(), this.loopEnd()});
+    }
+
+    public EndNode forwardEdge() {
+        return this.endAt(0);
+    }
+
+    public LoopCounterNode loopCounter() {
+        return loopCounter(CiKind.Long);
+    }
+
+    public LoopCounterNode loopCounter(CiKind kind) {
+        for (Node usage : usages()) {
+            if (usage instanceof LoopCounterNode && ((LoopCounterNode) usage).kind == kind) {
+                return (LoopCounterNode) usage;
+            }
+        }
+        return new LoopCounterNode(kind, this, graph());
+    }
+
+    @Override
+    public boolean verify() {
+        assertTrue(loopEnd() != null);
+        assertTrue(forwardEdge() != null);
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "LoopBegin: " + super.toString();
+    }
+
+    @Override
+    public Iterable< ? extends Node> dataUsages() {
+        final Iterator< ? extends Node> dataUsages = super.dataUsages().iterator();
+        return new Iterable() {
+            @Override
+            public Iterator iterator() {
+                return new StateSplit.FilteringIterator(dataUsages, LoopEndNode.class);
+            }
+        };
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("loopFrequency", String.format("%7.1f", loopFrequency));
+        return properties;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LoopEndNode.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/LoopEndNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,58 @@
+/*
+ * 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.base;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public class LoopEndNode extends FixedNode {
+
+    @Input    private LoopBeginNode loopBegin;
+
+    public LoopBeginNode loopBegin() {
+        return loopBegin;
+    }
+
+    public void setLoopBegin(LoopBeginNode x) {
+        updateUsages(this.loopBegin, x);
+        this.loopBegin = x;
+    }
+
+    public LoopEndNode(Graph graph) {
+        super(CiKind.Illegal, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitLoopEnd(this);
+    }
+
+    @Override
+    public Iterable< ? extends Node> dataInputs() {
+        return Collections.emptyList();
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/MaterializeNode.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/MaterializeNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,32 @@
+/*
+ * 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 com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.graph.*;
+
+public final class MaterializeNode extends ConditionalNode {
+    public MaterializeNode(BooleanNode value, Graph graph) {
+        super(value, ConstantNode.forInt(1, graph), ConstantNode.forInt(0, graph), graph);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/MergeNode.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/MergeNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,219 @@
+/*
+ * 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.debug.*;
+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.*;
+
+/**
+ * Denotes the beginning of a basic block, and holds information
+ * about the basic block, including the successor and
+ * predecessor blocks, exception handlers, liveness information, etc.
+ */
+public class MergeNode extends StateSplit {
+
+    @Input    private final NodeInputList ends = new NodeInputList(this);
+
+    public MergeNode(Graph graph) {
+        super(CiKind.Illegal, graph);
+    }
+
+    @Override
+    public boolean needsStateAfter() {
+        return false;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitMerge(this);
+    }
+
+    public int endIndex(EndNode end) {
+        return ends.indexOf(end);
+    }
+
+    public void addEnd(EndNode end) {
+        ends.add(end);
+    }
+
+    public int endCount() {
+        return ends.size();
+    }
+
+    public EndNode endAt(int index) {
+        return ends.get(index);
+    }
+
+    public Iterable phiPredecessors() {
+        return ends;
+    }
+
+    @Override
+    public Iterable cfgPredecessors() {
+        return ends;
+    }
+
+    @Override
+    public Iterable< ? extends Node> dataInputs() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("merge #");
+        builder.append(id());
+        builder.append(" [");
+
+        builder.append("]");
+
+        builder.append(" -> ");
+        boolean hasSucc = false;
+        for (Node s : this.successors()) {
+            if (hasSucc) {
+                builder.append(", ");
+            }
+            builder.append("#");
+            if (s != null) {
+                builder.append(s.id());
+            } else {
+                builder.append("null");
+            }
+            hasSucc = true;
+        }
+        return builder.toString();
+    }
+
+    public void printWithoutPhis(LogStream out) {
+        // print block id
+        out.print("B").print(id()).print(" ");
+
+        // print flags
+        StringBuilder sb = new StringBuilder(8);
+        if (sb.length() != 0) {
+            out.print('(').print(sb.toString()).print(')');
+        }
+
+        // print block bci range
+        out.print('[').print(-1).print(", ").print(-1).print(']');
+
+        // print block successors
+        //if (end != null && end.blockSuccessors().size() > 0) {
+            out.print(" .");
+            for (Node successor : this.successors()) {
+                if (successor instanceof ValueNode) {
+                    out.print((ValueNode) successor);
+                } else {
+                    out.print(successor.toString());
+                }
+            }
+        //}
+
+        // print predecessors
+//        if (!blockPredecessors().isEmpty()) {
+//            out.print(" pred:");
+//            for (Instruction pred : blockPredecessors()) {
+//                out.print(pred.block());
+//            }
+//        }
+    }
+
+    /**
+     * Determines if a given instruction is a phi whose {@linkplain PhiNode#merge() join block} is a given block.
+     *
+     * @param value the instruction to test
+     * @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(ValueNode value) {
+        return value instanceof PhiNode && ((PhiNode) value).merge() == this;
+    }
+
+
+    /**
+     * Formats a given instruction as a value in a {@linkplain FrameState frame state}. If the instruction is a phi defined at a given
+     * block, its {@linkplain PhiNode#valueCount() inputs} are appended to the returned string.
+     *
+     * @param index the index of the value in the frame state
+     * @param value the frame state value
+     * @param block if {@code value} is a phi, then its inputs are formatted if {@code block} is its
+     *            {@linkplain PhiNode#merge() join point}
+     * @return the instruction representation as a string
+     */
+    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 PhiNode) {
+            PhiNode phi = (PhiNode) value;
+            // print phi operands
+            if (phi.merge() == this) {
+                sb.append(" [");
+                for (int j = 0; j < phi.valueCount(); j++) {
+                    sb.append(' ');
+                    ValueNode operand = phi.valueAt(j);
+                    if (operand != null) {
+                        sb.append(Util.valueString(operand));
+                    } else {
+                        sb.append("NULL");
+                    }
+                }
+                sb.append("] ");
+            }
+        }
+        return sb.toString();
+    }
+
+    public void removeEnd(EndNode pred) {
+        int predIndex = ends.indexOf(pred);
+        assert predIndex != -1;
+        ends.remove(predIndex);
+
+        for (Node usage : usages()) {
+            if (usage instanceof PhiNode) {
+                ((PhiNode) usage).removeInput(predIndex);
+            }
+        }
+    }
+
+    public int phiPredecessorCount() {
+        return endCount();
+    }
+
+    public int phiPredecessorIndex(Node pred) {
+        EndNode end = (EndNode) pred;
+        return endIndex(end);
+    }
+
+    public Node phiPredecessorAt(int index) {
+        return endAt(index);
+    }
+
+    public Collection phis() {
+        return Util.filter(this.usages(), PhiNode.class);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/PhiNode.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/PhiNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,186 @@
+/*
+ * 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.*;
+import com.oracle.max.graal.compiler.debug.*;
+import com.oracle.max.graal.compiler.nodes.base.StateSplit.FilteringIterator;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code Phi} instruction represents the merging of dataflow in the instruction graph. It refers to a join block
+ * and a variable.
+ */
+public final class PhiNode extends FloatingNode implements Canonicalizable {
+
+    @Input private MergeNode merge;
+
+    @Input private final NodeInputList values = new NodeInputList(this);
+
+    public MergeNode merge() {
+        return merge;
+    }
+
+    public void setMerge(MergeNode x) {
+        updateUsages(merge, x);
+        merge = x;
+    }
+
+    public static enum PhiType {
+        Value, // normal value phis
+        Memory, // memory phis
+        Virtual // phis used for VirtualObjectField merges
+    }
+
+    private final PhiType type;
+
+    public PhiNode(CiKind kind, MergeNode merge, PhiType type, Graph graph) {
+        super(kind, graph);
+        this.type = type;
+        setMerge(merge);
+    }
+
+    private PhiNode(CiKind kind, PhiType type, Graph graph) {
+        super(kind, graph);
+        this.type = type;
+    }
+
+    public PhiType type() {
+        return type;
+    }
+
+    @Override
+    public boolean verify() {
+        assertTrue(merge() != null);
+        assertTrue(merge().phiPredecessorCount() == valueCount(), merge().phiPredecessorCount() + "==" + valueCount());
+        return true;
+    }
+
+    /**
+     * Get the instruction that produces the value associated with the i'th predecessor of the join block.
+     *
+     * @param i the index of the predecessor
+     * @return the instruction that produced the value in the i'th predecessor
+     */
+    public ValueNode valueAt(int i) {
+        return values.get(i);
+    }
+
+    public void setValueAt(int i, ValueNode x) {
+        values.set(i, x);
+    }
+
+    /**
+     * Get the number of inputs to this phi (i.e. the number of predecessors to the join block).
+     *
+     * @return the number of inputs in this phi
+     */
+    public int valueCount() {
+        return values.size();
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitPhi(this);
+    }
+
+    @Override
+    public String shortName() {
+        StringBuilder str = new StringBuilder();
+        for (int i = 0; i < valueCount(); ++i) {
+            if (i != 0) {
+                str.append(' ');
+            }
+            str.append(valueAt(i) == null ? "-" : valueAt(i).id());
+        }
+        if (type == PhiType.Value) {
+            return "Phi: (" + str + ")";
+        } else {
+            return type + "Phi: (" + str + ")";
+        }
+    }
+
+    public void addInput(ValueNode x) {
+        values.add(x);
+    }
+
+    public void removeInput(int index) {
+        values.remove(index);
+    }
+
+    @Override
+    public Iterable< ? extends Node> dataInputs() {
+        final Iterator< ? extends Node> input = super.dataInputs().iterator();
+        return new Iterable() {
+
+            @Override
+            public Iterator iterator() {
+                return new FilteringIterator(input, MergeNode.class);
+            }
+        };
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (valueCount() != 2 || merge().endCount() != 2) {
+            return this;
+        }
+        if (merge().phis().size() > 1) { // XXX (gd) disable canonicalization of multiple conditional while we are not able to fuse them and the potentially leftover If in the backend
+            return this;
+        }
+        Node end0 = merge().endAt(0);
+        Node end1 = merge().endAt(1);
+        Node endPred0 = end0.predecessor();
+        Node endPred1 = end1.predecessor();
+        if (endPred0 != endPred1 || !(endPred0 instanceof IfNode)) {
+            return this;
+        }
+        IfNode ifNode = (IfNode) endPred0;
+        boolean inverted = ifNode.trueSuccessor() == end1;
+        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;
+        }
+        if ((!(trueValue instanceof ConstantNode) && trueValue.usages().size() == 1) || (!(falseValue instanceof ConstantNode) && falseValue.usages().size() == 1)) {
+            return this;
+        }
+        BooleanNode compare = ifNode.compare();
+        while (compare instanceof NegateBooleanNode) {
+            compare = ((NegateBooleanNode) compare).value();
+        }
+        if (!(compare instanceof CompareNode || compare instanceof IsNonNullNode || compare instanceof NegateBooleanNode || compare instanceof ConstantNode)) {
+            return this;
+        }
+        if (GraalOptions.TraceCanonicalizer) {
+            TTY.println("> Phi canon'ed to Conditional");
+        }
+        reProcess.reProccess(ifNode);
+        return new ConditionalNode(ifNode.compare(), trueValue, falseValue, graph());
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/PlaceholderNode.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/PlaceholderNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,40 @@
+/*
+ * 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.base;
+
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public class PlaceholderNode extends StateSplit {
+
+    public PlaceholderNode(Graph graph) {
+        super(CiKind.Void, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        //assert false;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ReturnNode.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/ReturnNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,65 @@
+/*
+ * 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 com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code Return} class definition.
+ */
+public final class ReturnNode extends FixedNode {
+
+    @Input private ValueNode result;
+
+    public ValueNode result() {
+        return result;
+    }
+
+    public void setResult(ValueNode x) {
+        updateUsages(this.result, x);
+        this.result = x;
+    }
+
+    /**
+     * Constructs a new Return instruction.
+     * @param result the instruction producing the result for this return; {@code null} if this
+     * is a void return
+     * @param graph
+     */
+    public ReturnNode(ValueNode result, Graph graph) {
+        super(result == null ? CiKind.Void : result.kind, graph);
+        setResult(result);
+    }
+
+    // for copying
+    private ReturnNode(CiKind kind, Graph graph) {
+        super(kind, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitReturn(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/StateSplit.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/StateSplit.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/StateSplit.java	Wed Aug 10 00:34:29 2011 +0200
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.max.graal.compiler.ir.*;
 import com.oracle.max.graal.graph.*;
 import com.sun.cri.ci.*;
 
@@ -32,7 +31,7 @@
  * 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 {
+public abstract class StateSplit extends FixedWithNextNode {
 
     @Input private FrameState stateAfter;
 
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/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/base/UnwindNode.java	Wed Aug 10 00:34:29 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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ValueNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ValueNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ValueNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -24,9 +24,8 @@
 
 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.compiler.nodes.virtual.*;
 import com.oracle.max.graal.graph.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
@@ -59,11 +58,11 @@
     }
 
     /**
-     * Checks whether this value is a constant (i.e. it is of type {@link Constant}.
+     * Checks whether this value is a constant (i.e. it is of type {@link ConstantNode}.
      * @return {@code true} if this value is a constant
      */
     public final boolean isConstant() {
-        return this instanceof Constant;
+        return this instanceof ConstantNode;
     }
 
     /**
@@ -71,7 +70,7 @@
      * @return {@code true} if this value represents the null constant
      */
     public final boolean isNullConstant() {
-        return this instanceof Constant && ((Constant) this).value.isNull();
+        return this instanceof ConstantNode && ((ConstantNode) this).value.isNull();
     }
 
     /**
@@ -80,8 +79,8 @@
      * otherwise
      */
     public final CiConstant asConstant() {
-        if (this instanceof Constant) {
-            return ((Constant) this).value;
+        if (this instanceof ConstantNode) {
+            return ((ConstantNode) this).value;
         }
         return null;
     }
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/AndNode.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/calc/AndNode.java	Wed Aug 10 00:34:29 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.calc;
+
+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 AndNode extends LogicNode implements Canonicalizable {
+
+    public AndNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.IAND : Bytecodes.LAND, x, y, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x() == y()) {
+            return x();
+        }
+        if (x().isConstant() && !y().isConstant()) {
+            swapOperands();
+        }
+        if (x().isConstant()) {
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() & y().asConstant().asInt(), graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(x().asConstant().asLong() & y().asConstant().asLong(), graph());
+            }
+        } else if (y().isConstant()) {
+            if (kind == CiKind.Int) {
+                int c = y().asConstant().asInt();
+                if (c == -1) {
+                    return x();
+                }
+                if (c == 0) {
+                    return ConstantNode.forInt(0, graph());
+                }
+            } else {
+                assert kind == CiKind.Long;
+                long c = y().asConstant().asLong();
+                if (c == -1) {
+                    return x();
+                }
+                if (c == 0) {
+                    return ConstantNode.forLong(0, graph());
+                }
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ArithmeticNode.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/calc/ArithmeticNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,67 @@
+/*
+ * 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.calc;
+
+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 ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc.
+ */
+public abstract class ArithmeticNode extends BinaryNode {
+
+    private final boolean isStrictFP;
+
+    /**
+     * Creates a new arithmetic operation.
+     * @param opcode the bytecode opcode
+     * @param kind the result kind of the operation
+     * @param x the first input instruction
+     * @param y the second input instruction
+     * @param isStrictFP indicates this operation has strict rounding semantics
+     */
+    public ArithmeticNode(CiKind kind, int opcode, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
+        super(kind, opcode, x, y, graph);
+        this.isStrictFP = isStrictFP;
+    }
+
+    /**
+     * Checks whether this instruction has strict fp semantics.
+     * @return {@code true} if this instruction has strict fp semantics
+     */
+    public boolean isStrictFP() {
+        return isStrictFP;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitArithmetic(this);
+    }
+
+    public boolean isCommutative() {
+        return Bytecodes.isCommutative(opcode);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/BinaryNode.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/calc/BinaryNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,80 @@
+/*
+ * 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.calc;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.bytecode.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code Op2} class is the base of arithmetic and logic operations with two inputs.
+ */
+public abstract class BinaryNode extends FloatingNode {
+
+    @Input private ValueNode x;
+    @Input private ValueNode y;
+    @Data public final int opcode;
+
+    public ValueNode x() {
+        return x;
+    }
+
+    public void setX(ValueNode x) {
+        updateUsages(this.x, x);
+        this.x = x;
+    }
+
+    public ValueNode y() {
+        return y;
+    }
+
+    public void setY(ValueNode x) {
+        updateUsages(y, x);
+        this.y = x;
+    }
+
+    /**
+     * Creates a new Op2 instance.
+     * @param kind the result type of this instruction
+     * @param opcode the bytecode opcode
+     * @param x the first input instruction
+     * @param y the second input instruction
+     */
+    public BinaryNode(CiKind kind, int opcode, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, graph);
+        this.opcode = opcode;
+        setX(x);
+        setY(y);
+    }
+
+    /**
+     * Swaps the operands of this instruction. This is only legal for commutative operations.
+     */
+    public void swapOperands() {
+        assert Bytecodes.isCommutative(opcode);
+        ValueNode t = x();
+        setX(y());
+        setY(t);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/CompareNode.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/calc/CompareNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2011, 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.calc;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.graph.*;
+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.*;
+
+/* (tw/gd) For high-level optimization purpose the compare node should be a boolean *value* (it is currently only a helper node)
+ * But in the back-end the comparison should not always be materialized (for example in x86 the comparison result will not be in a register but in a flag)
+ *
+ * Compare should probably be made a value (so that it can be canonicalized for example) and in later stages some Compare usage should be transformed
+ * into variants that do not materialize the value (CompareIf, CompareGuard...)
+ *
+ */
+public final class CompareNode extends BooleanNode implements Canonicalizable {
+
+    @Input private ValueNode x;
+    @Input private ValueNode y;
+
+    @Data private Condition condition;
+    @Data private boolean unorderedIsTrue;
+
+    public ValueNode x() {
+        return x;
+    }
+
+    public void setX(ValueNode x) {
+        updateUsages(this.x, x);
+        this.x = x;
+    }
+
+    public ValueNode y() {
+        return y;
+    }
+
+    public void setY(ValueNode x) {
+        updateUsages(y, x);
+        this.y = x;
+    }
+
+    /**
+     * Constructs a new Compare instruction.
+     *
+     * @param x the instruction producing the first input to the instruction
+     * @param condition the condition (comparison operation)
+     * @param y the instruction that produces the second input to this instruction
+     * @param graph
+     */
+    public CompareNode(ValueNode x, Condition condition, ValueNode y, Graph graph) {
+        super(CiKind.Illegal, graph);
+        assert (x == null && y == null) || Util.archKindsEqual(x, y);
+        this.condition = condition;
+        setX(x);
+        setY(y);
+    }
+
+    /**
+     * Gets the condition (comparison operation) for this instruction.
+     *
+     * @return the condition
+     */
+    public Condition condition() {
+        return condition;
+    }
+
+    /**
+     * Checks whether unordered inputs mean true or false.
+     *
+     * @return {@code true} if unordered inputs produce true
+     */
+    public boolean unorderedIsTrue() {
+        return unorderedIsTrue;
+    }
+
+    public void setUnorderedIsTrue(boolean unorderedIsTrue) {
+        this.unorderedIsTrue = unorderedIsTrue;
+    }
+
+    /**
+     * Swaps the operands to this if and mirrors the condition (e.g. > becomes <).
+     *
+     * @see Condition#mirror()
+     */
+    public void swapOperands() {
+        condition = condition.mirror();
+        ValueNode t = x();
+        setX(y());
+        setY(t);
+    }
+
+    public void negate() {
+        condition = condition.negate();
+        unorderedIsTrue = !unorderedIsTrue;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+    }
+
+    @Override
+    public String shortName() {
+        return "Comp " + condition.operator;
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("unorderedIsTrue", unorderedIsTrue());
+        return properties;
+    }
+
+    private Node optimizeMaterialize(CiConstant constant, MaterializeNode materializeNode) {
+        if (constant.kind == CiKind.Int) {
+            boolean isFalseCheck = (constant.asInt() == 0);
+            if (condition == Condition.EQ || condition == Condition.NE) {
+                if (condition == Condition.NE) {
+                    isFalseCheck = !isFalseCheck;
+                }
+                BooleanNode result = materializeNode.condition();
+                if (isFalseCheck) {
+                    result = new NegateBooleanNode(result, graph());
+                }
+                return result;
+            }
+        }
+        return this;
+    }
+
+    private Node optimizeNormalizeCmp(CiConstant constant, NormalizeCompareNode normalizeNode) {
+        if (constant.kind == CiKind.Int && constant.asInt() == 0) {
+            Condition condition = condition();
+            if (normalizeNode == y()) {
+                condition = condition.mirror();
+            }
+            CompareNode result = new CompareNode(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()));
+            return result;
+        }
+        return this;
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && !y().isConstant()) { // move constants to the left (y)
+            swapOperands();
+        } else if (x().isConstant() && y().isConstant()) {
+            CiConstant constX = x().asConstant();
+            CiConstant constY = y().asConstant();
+            Boolean result = condition().foldCondition(constX, constY, ((CompilerGraph) graph()).runtime(), unorderedIsTrue());
+            if (result != null) {
+                return ConstantNode.forBoolean(result, graph());
+            }
+        }
+
+        if (y().isConstant()) {
+            if (x() instanceof MaterializeNode) {
+                return optimizeMaterialize(y().asConstant(), (MaterializeNode) x());
+            } else if (x() instanceof NormalizeCompareNode) {
+                return optimizeNormalizeCmp(y().asConstant(), (NormalizeCompareNode) x());
+            }
+        }
+
+        if (x() == y() && x().kind != CiKind.Float && x().kind != CiKind.Double) {
+            return ConstantNode.forBoolean(condition().check(1, 1), graph());
+        }
+        if ((condition == Condition.NE || condition == Condition.EQ) && x().kind == CiKind.Object) {
+            ValueNode object = null;
+            if (x().isNullConstant()) {
+                object = y();
+            } else if (y().isNullConstant()) {
+                object = x();
+            }
+            if (object != null) {
+                IsNonNullNode nonNull = new IsNonNullNode(object, graph());
+                if (condition == Condition.NE) {
+                    return nonNull;
+                } else {
+                    assert condition == Condition.EQ;
+                    return new NegateBooleanNode(nonNull, graph());
+                }
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/Condition.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/calc/Condition.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,262 @@
+/*
+ * 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.calc;
+
+import com.sun.cri.ci.*;
+import com.sun.cri.ri.*;
+
+/**
+ * Condition codes used in conditionals.
+ */
+public enum Condition {
+    /**
+     * Equal.
+     */
+    EQ("=="),
+
+    /**
+     * Not equal.
+     */
+    NE("!="),
+
+    /**
+     * Signed less than.
+     */
+    LT("<"),
+
+    /**
+     * Signed less than or equal.
+     */
+    LE("<="),
+
+    /**
+     * Signed greater than.
+     */
+    GT(">"),
+
+    /**
+     * Signed greater than or equal.
+     */
+    GE(">="),
+
+    /**
+     * Unsigned greater than or equal ("above than or equal").
+     */
+    AE("|>=|"),
+
+    /**
+     * Unsigned less than or equal ("below than or equal").
+     */
+    BE("|<=|"),
+
+    /**
+     * Unsigned greater than ("above than").
+     */
+    AT("|>|"),
+
+    /**
+     * Unsigned less than ("below than").
+     */
+    BT("|<|"),
+
+    /**
+     * Operation produced an overflow.
+     */
+    OF("overflow"),
+
+    /**
+     * Operation did not produce an overflow.
+     */
+    NOF("noOverflow"),
+
+    TRUE("TRUE");
+
+    public final String operator;
+
+    private Condition(String operator) {
+        this.operator = operator;
+    }
+
+    public boolean check(int left, int right) {
+        switch (this) {
+            case EQ: return left == right;
+            case NE: return left != right;
+            case LT: return left < right;
+            case LE: return left <= right;
+            case GT: return left > right;
+            case GE: return left >= right;
+            case BT: return (left & 0xffffffffL) < (right & 0xffffffffL);
+            case BE: return (left & 0xffffffffL) <= (right & 0xffffffffL);
+            case AT: return (left & 0xffffffffL) > (right & 0xffffffffL);
+            case AE: return (left & 0xffffffffL) >= (right & 0xffffffffL);
+        }
+        throw new IllegalArgumentException();
+    }
+
+    /**
+     * Negate this conditional.
+     * @return the condition that represents the negation
+     */
+    public final Condition negate() {
+        switch (this) {
+            case EQ: return NE;
+            case NE: return EQ;
+            case LT: return GE;
+            case LE: return GT;
+            case GT: return LE;
+            case GE: return LT;
+            case BT: return AE;
+            case BE: return AT;
+            case AT: return BE;
+            case AE: return BT;
+            case OF: return NOF;
+            case NOF: return OF;
+        }
+        throw new IllegalArgumentException(this.toString());
+    }
+
+    /**
+     * Mirror this conditional (i.e. commute "a op b" to "b op' a")
+     * @return the condition representing the equivalent commuted operation
+     */
+    public final Condition mirror() {
+        switch (this) {
+            case EQ: return EQ;
+            case NE: return NE;
+            case LT: return GT;
+            case LE: return GE;
+            case GT: return LT;
+            case GE: return LE;
+            case BT: return AT;
+            case BE: return AE;
+            case AT: return BT;
+            case AE: return BE;
+        }
+        throw new IllegalArgumentException();
+    }
+
+    /**
+     * Checks if this conditional operation is commutative.
+     * @return {@code true} if this operation is commutative
+     */
+    public final boolean isCommutative() {
+        return this == EQ || this == NE;
+    }
+
+    /**
+     * Attempts to fold a comparison between two constants and return the result.
+     * @param lt the constant on the left side of the comparison
+     * @param rt the constant on the right side of the comparison
+     * @param runtime the RiRuntime (might be needed to compare runtime-specific types)
+     * @return {@link Boolean#TRUE} if the comparison is known to be true,
+     * {@link Boolean#FALSE} if the comparison is known to be false, {@code null} otherwise.
+     */
+    public Boolean foldCondition(CiConstant lt, CiConstant rt, RiRuntime runtime, boolean unorderedIsTrue) {
+        switch (lt.kind) {
+            case Boolean:
+            case Int: {
+                int x = lt.asInt();
+                int y = rt.asInt();
+                switch (this) {
+                    case EQ: return x == y;
+                    case NE: return x != y;
+                    case LT: return x < y;
+                    case LE: return x <= y;
+                    case GT: return x > y;
+                    case GE: return x >= y;
+                    case AE: return toUnsigned(x) >= toUnsigned(y);
+                    case BE: return toUnsigned(x) <= toUnsigned(y);
+                    case AT: return toUnsigned(x) > toUnsigned(y);
+                    case BT: return toUnsigned(x) < toUnsigned(y);
+                }
+                break;
+            }
+            case Long: {
+                long x = lt.asLong();
+                long y = rt.asLong();
+                switch (this) {
+                    case EQ: return x == y;
+                    case NE: return x != y;
+                    case LT: return x < y;
+                    case LE: return x <= y;
+                    case GT: return x > y;
+                    case GE: return x >= y;
+                }
+                break;
+            }
+            case Object: {
+                switch (this) {
+                    case EQ: return runtime.areConstantObjectsEqual(lt, rt);
+                    case NE: return !runtime.areConstantObjectsEqual(lt, rt);
+                }
+                break;
+            }
+            case Float: {
+                float x = lt.asFloat();
+                float y = rt.asFloat();
+                if (Float.isNaN(x) || Float.isNaN(y)) {
+                    return unorderedIsTrue;
+                }
+                switch (this) {
+                    case EQ: return x == y;
+                    case NE: return x != y;
+                    case BT:
+                    case LT: return x < y;
+                    case BE:
+                    case LE: return x <= y;
+                    case AT:
+                    case GT: return x > y;
+                    case AE:
+                    case GE: return x >= y;
+                }
+            }
+            case Double: {
+                double x = lt.asDouble();
+                double y = rt.asDouble();
+                if (Double.isNaN(x) || Double.isNaN(y)) {
+                    return unorderedIsTrue;
+                }
+                switch (this) {
+                    case EQ: return x == y;
+                    case NE: return x != y;
+                    case BT:
+                    case LT: return x < y;
+                    case BE:
+                    case LE: return x <= y;
+                    case AT:
+                    case GT: return x > y;
+                    case AE:
+                    case GE: return x >= y;
+                }
+            }
+        }
+        return null;
+    }
+
+    private long toUnsigned(int x) {
+        if (x < 0) {
+            return ((long) (x & 0x7FFFFFFF)) + ((long) Integer.MAX_VALUE) + 1;
+        }
+        return x;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ConditionalNode.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/calc/ConditionalNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,167 @@
+/*
+ * 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.calc;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.base.PhiNode.PhiType;
+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 Conditional} class represents a comparison that yields one of two values. Note that these nodes are not
+ * built directly from the bytecode but are introduced by conditional expression elimination.
+ */
+public class ConditionalNode extends BinaryNode implements Canonicalizable {
+
+    @Input private BooleanNode condition;
+
+    public BooleanNode condition() {
+        return condition;
+    }
+
+    public void setCondition(BooleanNode n) {
+        updateUsages(condition, n);
+        condition = n;
+    }
+
+    /**
+     * Constructs a new IfOp.
+     *
+     * @param x the instruction producing the first value to be compared
+     * @param condition the condition of the comparison
+     * @param y the instruction producing the second value to be compared
+     * @param trueValue the value produced if the condition is true
+     * @param falseValue the value produced if the condition is false
+     */
+    public ConditionalNode(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);
+    }
+
+    // for copying
+    private ConditionalNode(CiKind kind, Graph graph) {
+        super(kind, Bytecodes.ILLEGAL, null, null, graph);
+    }
+
+    public ValueNode trueValue() {
+        return x();
+    }
+
+    public ValueNode falseValue() {
+        return y();
+    }
+
+    public void setTrueValue(ValueNode value) {
+        setX(value);
+    }
+
+    public void setFalseValue(ValueNode value) {
+        setY(value);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LIRGeneratorOp.class) {
+            return (T) LIRGEN;
+        }
+        return super.lookup(clazz);
+    }
+
+    public static class ConditionalStructure {
+
+        public final IfNode ifNode;
+        public final PhiNode phi;
+        public final MergeNode merge;
+
+        public ConditionalStructure(IfNode ifNode, PhiNode phi, MergeNode merge) {
+            this.ifNode = ifNode;
+            this.phi = phi;
+            this.merge = merge;
+        }
+    }
+
+    public static ConditionalStructure createConditionalStructure(BooleanNode condition, ValueNode trueValue, ValueNode falseValue) {
+        return createConditionalStructure(condition, trueValue, falseValue, 0.5);
+    }
+
+    public static ConditionalStructure createConditionalStructure(BooleanNode condition, ValueNode trueValue, ValueNode falseValue, double trueProbability) {
+        Graph graph = condition.graph();
+        CiKind kind = trueValue.kind.meet(falseValue.kind);
+        IfNode ifNode = new IfNode(condition, trueProbability, graph);
+        EndNode trueEnd = new EndNode(graph);
+        EndNode falseEnd = new EndNode(graph);
+        ifNode.setTrueSuccessor(trueEnd);
+        ifNode.setFalseSuccessor(falseEnd);
+        MergeNode merge = new MergeNode(graph);
+        merge.addEnd(trueEnd);
+        merge.addEnd(falseEnd);
+        PhiNode phi = new PhiNode(kind, merge, PhiType.Value, graph);
+        phi.addInput(trueValue);
+        phi.addInput(falseValue);
+        return new ConditionalStructure(ifNode, phi, merge);
+    }
+
+    private static final LIRGeneratorOp LIRGEN = new LIRGeneratorOp() {
+
+        @Override
+        public void generate(Node n, LIRGeneratorTool generator) {
+            generator.visitConditional((ConditionalNode) n);
+        }
+    };
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (condition instanceof ConstantNode) {
+            ConstantNode c = (ConstantNode) condition;
+            if (c.asConstant().asBoolean()) {
+                return trueValue();
+            } else {
+                return falseValue();
+            }
+        }
+        if (trueValue() == falseValue()) {
+            return trueValue();
+        }
+        if (!(this instanceof MaterializeNode) && trueValue() instanceof ConstantNode && falseValue() instanceof ConstantNode && trueValue().kind == CiKind.Int && falseValue().kind == CiKind.Int) {
+            int trueInt = trueValue().asConstant().asInt();
+            int falseInt = falseValue().asConstant().asInt();
+            if (trueInt == 0 && falseInt == 1) {
+                reProcess.reProccess(condition); // because we negate it
+                return new MaterializeNode(new NegateBooleanNode(condition, graph()), graph());
+            } else if (trueInt == 1 && falseInt == 0) {
+                return new MaterializeNode(condition, graph());
+            }
+        } else if (falseValue() instanceof ConstantNode && !(trueValue() instanceof ConstantNode)) {
+            ValueNode temp = trueValue();
+            setTrueValue(falseValue());
+            setFalseValue(temp);
+            condition = new NegateBooleanNode(condition, graph());
+            setCondition(condition);
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ConvertNode.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/calc/ConvertNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,64 @@
+/*
+ * 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.calc;
+
+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 Convert} class represents a conversion between primitive types.
+ */
+public final class ConvertNode extends FloatingNode {
+    @Input private ValueNode value;
+
+    @Data public final int opcode;
+
+    public ValueNode value() {
+        return value;
+    }
+
+    public void setValue(ValueNode x) {
+        updateUsages(value, x);
+        value = x;
+    }
+
+    /**
+     * Constructs a new Convert instance.
+     * @param opcode the bytecode representing the operation
+     * @param value the instruction producing the input value
+     * @param kind the result type of this instruction
+     * @param graph
+     */
+    public ConvertNode(int opcode, ValueNode value, CiKind kind, Graph graph) {
+        super(kind, graph);
+        this.opcode = opcode;
+        setValue(value);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitConvert(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatAddNode.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/calc/FloatAddNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,66 @@
+/*
+ * 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.calc;
+
+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 FloatAddNode extends FloatArithmeticNode implements Canonicalizable {
+
+    public FloatAddNode(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
+        super(kind, kind == CiKind.Double ? Bytecodes.DADD : Bytecodes.FADD, x, y, isStrictFP, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && !y().isConstant()) {
+            swapOperands();
+        }
+        if (x().isConstant()) {
+            if (kind == CiKind.Float) {
+                return ConstantNode.forFloat(x().asConstant().asFloat() + y().asConstant().asFloat(), graph());
+            } else {
+                assert kind == CiKind.Double;
+                return ConstantNode.forDouble(x().asConstant().asDouble() + y().asConstant().asDouble(), graph());
+            }
+        } else if (y().isConstant()) {
+            if (kind == CiKind.Float) {
+                float c = y().asConstant().asFloat();
+                if (c == 0.0f) {
+                    return x();
+                }
+            } else {
+                assert kind == CiKind.Double;
+                double c = y().asConstant().asDouble();
+                if (c == 0.0) {
+                    return x();
+                }
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatArithmeticNode.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/calc/FloatArithmeticNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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.calc;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+public abstract class FloatArithmeticNode extends ArithmeticNode {
+
+    public FloatArithmeticNode(CiKind kind, int opcode, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
+        super(kind, opcode, x, y, isStrictFP, graph);
+    }
+
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatDivNode.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/calc/FloatDivNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,50 @@
+/*
+ * 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.calc;
+
+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 FloatDivNode extends FloatArithmeticNode implements Canonicalizable {
+
+    public FloatDivNode(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
+        super(kind, kind == CiKind.Double ? Bytecodes.DDIV : Bytecodes.FDIV, x, y, isStrictFP, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && y().isConstant()) {
+            if (kind == CiKind.Float) {
+                return ConstantNode.forFloat(x().asConstant().asFloat() / y().asConstant().asFloat(), graph());
+            } else {
+                assert kind == CiKind.Double;
+                return ConstantNode.forDouble(x().asConstant().asDouble() / y().asConstant().asDouble(), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatMulNode.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/calc/FloatMulNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,66 @@
+/*
+ * 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.calc;
+
+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 FloatMulNode extends FloatArithmeticNode implements Canonicalizable {
+
+    public FloatMulNode(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
+        super(kind, kind == CiKind.Double ? Bytecodes.DMUL : Bytecodes.FMUL, x, y, isStrictFP, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && !y().isConstant()) {
+            swapOperands();
+        }
+        if (x().isConstant()) {
+            if (kind == CiKind.Float) {
+                return ConstantNode.forFloat(x().asConstant().asFloat() * y().asConstant().asFloat(), graph());
+            } else {
+                assert kind == CiKind.Double;
+                return ConstantNode.forDouble(x().asConstant().asDouble() * y().asConstant().asDouble(), graph());
+            }
+        } else if (y().isConstant()) {
+            if (kind == CiKind.Float) {
+                float c = y().asConstant().asFloat();
+                if (c == 0.0f) {
+                    return ConstantNode.forFloat(0.0f, graph());
+                }
+            } else {
+                assert kind == CiKind.Double;
+                double c = y().asConstant().asDouble();
+                if (c == 0.0) {
+                    return ConstantNode.forDouble(0.0, graph());
+                }
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatRemNode.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/calc/FloatRemNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,50 @@
+/*
+ * 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.calc;
+
+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 FloatRemNode extends FloatArithmeticNode implements Canonicalizable {
+
+    public FloatRemNode(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
+        super(kind, kind == CiKind.Double ? Bytecodes.DREM : Bytecodes.FREM, x, y, isStrictFP, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && y().isConstant()) {
+            if (kind == CiKind.Float) {
+                return ConstantNode.forFloat(x().asConstant().asFloat() % y().asConstant().asFloat(), graph());
+            } else {
+                assert kind == CiKind.Double;
+                return ConstantNode.forDouble(x().asConstant().asDouble() % y().asConstant().asDouble(), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatSubNode.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/calc/FloatSubNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,73 @@
+/*
+ * 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.calc;
+
+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 FloatSubNode extends FloatArithmeticNode implements Canonicalizable {
+
+    public FloatSubNode(CiKind kind, ValueNode x, ValueNode y, boolean isStrictFP, Graph graph) {
+        super(kind, kind == CiKind.Double ? Bytecodes.DSUB : Bytecodes.FSUB, x, y, isStrictFP, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x() == y()) {
+            if (kind == CiKind.Float) {
+                return ConstantNode.forFloat(0.0f, graph());
+            } else {
+                assert kind == CiKind.Double;
+                return ConstantNode.forDouble(0.0, graph());
+            }
+        }
+        if (x().isConstant() && y().isConstant()) {
+            if (kind == CiKind.Float) {
+                return ConstantNode.forFloat(x().asConstant().asFloat() - y().asConstant().asFloat(), graph());
+            } else {
+                assert kind == CiKind.Double;
+                return ConstantNode.forDouble(x().asConstant().asDouble() - y().asConstant().asDouble(), graph());
+            }
+        } else if (y().isConstant()) {
+            if (kind == CiKind.Float) {
+                float c = y().asConstant().asFloat();
+                if (c == 0.0f) {
+                    return x();
+                }
+                return new FloatAddNode(kind, x(), ConstantNode.forFloat(-c, graph()), isStrictFP(), graph());
+            } else {
+                assert kind == CiKind.Double;
+                double c = y().asConstant().asDouble();
+                if (c == 0.0) {
+                    return x();
+                }
+                return new FloatAddNode(kind, x(), ConstantNode.forDouble(-c, graph()), isStrictFP(), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatingNode.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/calc/FloatingNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,33 @@
+/*
+ * 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.calc;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+public abstract class FloatingNode extends ValueNode implements Node.ValueNumberable {
+    public FloatingNode(CiKind kind, Graph graph) {
+        super(kind, graph);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerAddNode.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/calc/IntegerAddNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2011, 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.calc;
+
+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 IntegerAddNode extends IntegerArithmeticNode implements Canonicalizable {
+
+    public IntegerAddNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.IADD : Bytecodes.LADD, x, y, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && !y().isConstant()) {
+            swapOperands();
+        }
+        if (x().isConstant()) {
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() + y().asConstant().asInt(), graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerAddVectorNode.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/calc/IntegerAddVectorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,63 @@
+/*
+ * 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.calc;
+
+import java.util.*;
+
+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.*;
+
+
+public final class IntegerAddVectorNode extends AbstractVectorNode {
+    @Input private ValueNode value;
+
+    public ValueNode value() {
+        return value;
+    }
+
+    public void setValue(ValueNode x) {
+        updateUsages(value, x);
+        value = x;
+    }
+
+    public IntegerAddVectorNode(AbstractVectorNode vector, ValueNode value, Graph graph) {
+        super(CiKind.Illegal, vector, graph);
+        setValue(value);
+    }
+
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LIRGeneratorOp.class) {
+            return null;
+        }
+        return super.lookup(clazz);
+    }
+
+    @Override
+    public void addToLoop(LoopBeginNode loop, IdentityHashMap nodes) {
+        nodes.put(this, new IntegerAddNode(CiKind.Int, nodes.get(vector()), value(), graph()));
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerArithmeticNode.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/calc/IntegerArithmeticNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2011, 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.calc;
+
+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.*;
+
+
+public abstract class IntegerArithmeticNode extends ArithmeticNode {
+
+    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(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 ?
+        switch(v1.kind) {
+            case Int:
+                return new IntegerAddNode(CiKind.Int, v1, v2, graph);
+            case Long:
+                return new IntegerAddNode(CiKind.Long, v1, v2, graph);
+            default:
+                throw Util.shouldNotReachHere();
+        }
+    }
+
+    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 ?
+        switch(v1.kind) {
+            case Int:
+                return new IntegerMulNode(CiKind.Int, v1, v2, graph);
+            case Long:
+                return new IntegerMulNode(CiKind.Long, v1, v2, graph);
+            default:
+                throw Util.shouldNotReachHere();
+        }
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerDivNode.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/calc/IntegerDivNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,59 @@
+/*
+ * 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.calc;
+
+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 IntegerDivNode extends IntegerArithmeticNode implements Canonicalizable {
+
+    public IntegerDivNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.IDIV : Bytecodes.LDIV, x, y, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && y().isConstant()) {
+            long yConst = y().asConstant().asLong();
+            if (yConst == 0) {
+                return this; // this will trap, can not canonicalize
+            }
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() / (int) yConst, graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(x().asConstant().asLong() / yConst, graph());
+            }
+        } else if (y().isConstant()) {
+            long c = y().asConstant().asLong();
+            if (c == 1) {
+                return x();
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerMulNode.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/calc/IntegerMulNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,64 @@
+/*
+ * 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.calc;
+
+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 IntegerMulNode extends IntegerArithmeticNode implements Canonicalizable {
+
+    public IntegerMulNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.IMUL : Bytecodes.LMUL, x, y, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && !y().isConstant()) {
+            swapOperands();
+        }
+        if (x().isConstant()) {
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() * y().asConstant().asInt(), graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(x().asConstant().asLong() * y().asConstant().asLong(), graph());
+            }
+        } else if (y().isConstant()) {
+            long c = y().asConstant().asLong();
+            if (c == 1) {
+                return x();
+            }
+            if (c == 0) {
+                return ConstantNode.forInt(0, graph());
+            }
+            if (c > 0 && CiUtil.isPowerOf2(c)) {
+                return new LeftShiftNode(kind, x(), ConstantNode.forInt(CiUtil.log2(c), graph()), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerRemNode.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/calc/IntegerRemNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,64 @@
+/*
+ * 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.calc;
+
+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 IntegerRemNode extends IntegerArithmeticNode implements Canonicalizable {
+
+    public IntegerRemNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.IREM : Bytecodes.LREM, x, y, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant() && y().isConstant()) {
+            long yConst = y().asConstant().asLong();
+            if (yConst == 0) {
+                return this; // this will trap, can not canonicalize
+            }
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() % (int) yConst, graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(x().asConstant().asLong() % yConst, graph());
+            }
+        } else if (y().isConstant()) {
+            long c = y().asConstant().asLong();
+            if (c == 1 || c == -1) {
+                if (kind == CiKind.Int) {
+                    return ConstantNode.forInt(0, graph());
+                } else {
+                    assert kind == CiKind.Long;
+                    return ConstantNode.forLong(0, graph());
+                }
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerSubNode.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/calc/IntegerSubNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,74 @@
+/*
+ * 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.calc;
+
+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 IntegerSubNode extends IntegerArithmeticNode implements Canonicalizable {
+
+    public IntegerSubNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.ISUB : Bytecodes.LSUB, x, y, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x() == y()) {
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(0, graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(0, graph());
+            }
+        }
+        if (x().isConstant() && y().isConstant()) {
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() - y().asConstant().asInt(), graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(x().asConstant().asLong() - y().asConstant().asLong(), graph());
+            }
+        } else if (y().isConstant()) {
+            long c = y().asConstant().asLong();
+            if (c == 0) {
+                return x();
+            }
+            if (kind == CiKind.Int) {
+                return new IntegerAddNode(kind, x(), ConstantNode.forInt((int) -c, graph()), graph());
+            } else {
+                assert kind == CiKind.Long;
+                return new IntegerAddNode(kind, x(), ConstantNode.forLong(-c, graph()), graph());
+            }
+        } else if (x().isConstant()) {
+            long c = x().asConstant().asLong();
+            if (c == 0) {
+                return new NegateNode(y(), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IsNonNullNode.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/calc/IsNonNullNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,89 @@
+/*
+ * 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.calc;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.java.*;
+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 NullCheck} class represents an explicit null check instruction.
+ */
+public final class IsNonNullNode extends BooleanNode implements Canonicalizable {
+
+    @Input private ValueNode object;
+
+    public ValueNode object() {
+        return object;
+    }
+
+    public void setObject(ValueNode x) {
+        updateUsages(object, x);
+        object = x;
+    }
+
+    /**
+     * Constructs a new NullCheck instruction.
+     *
+     * @param object the instruction producing the object to check against null
+     * @param graph
+     */
+    public IsNonNullNode(ValueNode object, Graph graph) {
+        super(CiKind.Object, graph);
+        assert object == null || object.kind == CiKind.Object : object;
+        setObject(object);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        // Nothing to do.
+    }
+
+    @Override
+    public RiType declaredType() {
+        // null check does not alter the type of the object
+        return object().declaredType();
+    }
+
+    @Override
+    public RiType exactType() {
+        // null check does not alter the type of the object
+        return object().exactType();
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (object() instanceof NewInstanceNode || object() instanceof NewArrayNode) {
+            return ConstantNode.forBoolean(true, graph());
+        }
+        CiConstant constant = object().asConstant();
+        if (constant != null) {
+            assert constant.kind == CiKind.Object;
+            return ConstantNode.forBoolean(constant.isNonNull(), graph());
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/LeftShiftNode.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/calc/LeftShiftNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,88 @@
+/*
+ * 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.calc;
+
+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 LeftShiftNode extends ShiftNode implements Canonicalizable {
+
+    public LeftShiftNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.ISHL : Bytecodes.LSHL, 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 ConstantNode.forInt(x().asConstant().asInt() << amount, graph());
+                } else {
+                    assert kind == CiKind.Long;
+                    return ConstantNode.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 LeftShiftNode) {
+                        int total = amount + otherAmount;
+                        if (total != (total & mask)) {
+                            return ConstantNode.forInt(0, graph());
+                        }
+                        return new LeftShiftNode(kind, other.x(), ConstantNode.forInt(total, graph()), graph());
+                    } else if ((other instanceof RightShiftNode || other instanceof UnsignedRightShiftNode) && otherAmount == amount) {
+                        if (kind == CiKind.Long) {
+                            return new AndNode(kind, other.x(), ConstantNode.forLong(-1L << amount, graph()), graph());
+                        } else {
+                            assert kind == CiKind.Int;
+                            return new AndNode(kind, other.x(), ConstantNode.forInt(-1 << amount, graph()), graph());
+                        }
+                    }
+                }
+            }
+            if (originalAmout != amount) {
+                return new LeftShiftNode(kind, x(), ConstantNode.forInt(amount, graph()), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/LogicNode.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/calc/LogicNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,49 @@
+/*
+ * 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.calc;
+
+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 LogicOp} class definition.
+ */
+public abstract class LogicNode extends BinaryNode {
+
+    /**
+     * Constructs a new logic operation instruction.
+     * @param opcode the opcode of the logic operation
+     * @param x the first input into this instruction
+     * @param y the second input into this instruction
+     */
+    public LogicNode(CiKind kind, int opcode, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, opcode, x, y, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitLogic(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NegateBooleanNode.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/calc/NegateBooleanNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,61 @@
+/*
+ * 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.calc;
+
+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 NegateBooleanNode extends BooleanNode implements Canonicalizable {
+
+    @Input private BooleanNode value;
+
+    public BooleanNode value() {
+        return value;
+    }
+
+    public void setValue(BooleanNode x) {
+        updateUsages(value, x);
+        value = x;
+    }
+
+    public NegateBooleanNode(BooleanNode value, Graph graph) {
+        super(CiKind.Int, graph);
+        setValue(value);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (value() instanceof NegateBooleanNode) {
+            return ((NegateBooleanNode) value()).value();
+        } else if (value() instanceof ConstantNode) {
+            return ConstantNode.forBoolean(!value().asConstant().asBoolean(), graph());
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NegateNode.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/calc/NegateNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,86 @@
+/*
+ * 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.calc;
+
+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 NegateOp} instruction negates its operand.
+ */
+public final class NegateNode extends FloatingNode implements Canonicalizable {
+
+    @Input
+    private ValueNode x;
+
+    public ValueNode x() {
+        return x;
+    }
+
+    public void setX(ValueNode x) {
+        updateUsages(this.x, x);
+        this.x = x;
+    }
+
+    /**
+     * Creates new NegateOp instance.
+     *
+     * @param x the instruction producing the value that is input to this instruction
+     */
+    public NegateNode(ValueNode x, Graph graph) {
+        super(x.kind, graph);
+        setX(x);
+    }
+
+    // for copying
+    private NegateNode(CiKind kind, Graph graph) {
+        super(kind, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitNegate(this);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x().isConstant()) {
+            switch (x().kind) {
+                case Int:
+                    return ConstantNode.forInt(-x().asConstant().asInt(), graph());
+                case Long:
+                    return ConstantNode.forLong(-x().asConstant().asLong(), graph());
+                case Float:
+                    return ConstantNode.forFloat(-x().asConstant().asFloat(), graph());
+                case Double:
+                    return ConstantNode.forDouble(-x().asConstant().asDouble(), graph());
+            }
+        }
+        if (x() instanceof NegateNode) {
+            return ((NegateNode) x()).x();
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NormalizeCompareNode.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/calc/NormalizeCompareNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,64 @@
+/*
+ * 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.calc;
+
+import java.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.*;
+
+/**
+ * Returns -1, 0, or 1 if either x > y, x == y, or x < y.
+ */
+public final class NormalizeCompareNode extends BinaryNode {
+
+    /**
+     * Creates a new compare operation.
+     * @param opcode the bytecode opcode
+     * @param kind the result kind
+     * @param x the first input
+     * @param y the second input
+     */
+    public NormalizeCompareNode(int opcode, CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, opcode, x, y, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitNormalizeCompare(this);
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("isUnorderedLess", isUnorderedLess());
+        return properties;
+    }
+
+    public boolean isUnorderedLess() {
+        return this.opcode == Bytecodes.FCMPL || this.opcode == Bytecodes.DCMPL;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/OrNode.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/calc/OrNode.java	Wed Aug 10 00:34:29 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.calc;
+
+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 OrNode extends LogicNode implements Canonicalizable {
+
+    public OrNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.IOR : Bytecodes.LOR, x, y, graph);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (x() == y()) {
+            return x();
+        }
+        if (x().isConstant() && !y().isConstant()) {
+            swapOperands();
+        }
+        if (x().isConstant()) {
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() | y().asConstant().asInt(), graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(x().asConstant().asLong() | y().asConstant().asLong(), graph());
+            }
+        } else if (y().isConstant()) {
+            if (kind == CiKind.Int) {
+                int c = y().asConstant().asInt();
+                if (c == -1) {
+                    return ConstantNode.forInt(-1, graph());
+                }
+                if (c == 0) {
+                    return x();
+                }
+            } else {
+                assert kind == CiKind.Long;
+                long c = y().asConstant().asLong();
+                if (c == -1) {
+                    return ConstantNode.forLong(-1, graph());
+                }
+                if (c == 0) {
+                    return x();
+                }
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/RightShiftNode.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/calc/RightShiftNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,81 @@
+/*
+ * 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.calc;
+
+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 RightShiftNode extends ShiftNode implements Canonicalizable {
+
+    public RightShiftNode(CiKind kind, ValueNode x, ValueNode y, Graph graph) {
+        super(kind, kind == CiKind.Int ? Bytecodes.ISHR : Bytecodes.LSHR, 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 ConstantNode.forInt(x().asConstant().asInt() >> amount, graph());
+                } else {
+                    assert kind == CiKind.Long;
+                    return ConstantNode.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 RightShiftNode) {
+                        int total = amount + otherAmount;
+                        if (total != (total & mask)) {
+                            return ConstantNode.forInt(0, graph());
+                        }
+                        return new RightShiftNode(kind, other.x(), ConstantNode.forInt(total, graph()), graph());
+                    }
+                }
+            }
+            if (originalAmout != amount) {
+                return new RightShiftNode(kind, x(), ConstantNode.forInt(amount, graph()), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/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/calc/ShiftNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,50 @@
+/*
+ * 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.calc;
+
+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 BinaryNode {
+
+    /**
+     * 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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/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/calc/UnsignedRightShiftNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,88 @@
+/*
+ * 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.calc;
+
+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 ConstantNode.forInt(x().asConstant().asInt() >>> amount, graph());
+                } else {
+                    assert kind == CiKind.Long;
+                    return ConstantNode.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 ConstantNode.forInt(0, graph());
+                        }
+                        return new UnsignedRightShiftNode(kind, other.x(), ConstantNode.forInt(total, graph()), graph());
+                    } else if (other instanceof LeftShiftNode && otherAmount == amount) {
+                        if (kind == CiKind.Long) {
+                            return new AndNode(kind, other.x(), ConstantNode.forLong(-1L >>> amount, graph()), graph());
+                        } else {
+                            assert kind == CiKind.Int;
+                            return new AndNode(kind, other.x(), ConstantNode.forInt(-1 >>> amount, graph()), graph());
+                        }
+                    }
+                }
+            }
+            if (originalAmout != amount) {
+                return new UnsignedRightShiftNode(kind, x(), ConstantNode.forInt(amount, graph()), graph());
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/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/calc/XorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,74 @@
+/*
+ * 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.calc;
+
+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 LogicNode 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 ConstantNode.forInt(0, graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.forLong(0L, graph());
+            }
+        }
+        if (x().isConstant() && !y().isConstant()) {
+            swapOperands();
+        }
+        if (x().isConstant()) {
+            if (kind == CiKind.Int) {
+                return ConstantNode.forInt(x().asConstant().asInt() ^ y().asConstant().asInt(), graph());
+            } else {
+                assert kind == CiKind.Long;
+                return ConstantNode.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/SwitchNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/SwitchNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/TableSwitchNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/TableSwitchNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/WriteMemoryCheckpointNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/cfg/WriteMemoryCheckpointNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AbstractMemoryCheckpointNode.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/AbstractMemoryCheckpointNode.java	Wed Aug 10 00:34:29 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 java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public abstract class AbstractMemoryCheckpointNode extends StateSplit {
+
+    @Input    private final NodeInputList mergedNodes = new NodeInputList(this);
+
+    private static final int SUCCESSOR_COUNT = 0;
+    private static final int INPUT_COUNT = 0;
+
+    public AbstractMemoryCheckpointNode(Graph graph) {
+        this(CiKind.Illegal, graph);
+    }
+
+    public AbstractMemoryCheckpointNode(CiKind result, Graph graph) {
+        super(result, graph);
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map debugProperties = super.getDebugProperties();
+        debugProperties.put("memoryCheckpoint", "true");
+        return debugProperties;
+    }
+
+    public NodeInputList mergedNodes() {
+        return mergedNodes;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AbstractVectorNode.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/AbstractVectorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,83 @@
+/*
+ * 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.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public abstract class AbstractVectorNode extends StateSplit {
+    @Input private AbstractVectorNode vector;
+
+    public AbstractVectorNode vector() {
+        return vector;
+    }
+
+    public void setVector(AbstractVectorNode x) {
+        updateUsages(vector, x);
+        vector = x;
+    }
+
+    public AbstractVectorNode(CiKind kind, AbstractVectorNode vector, Graph graph) {
+        super(kind, graph);
+        setVector(vector);
+    }
+
+    protected static AbstractVectorNode findCommonNode(AbstractVectorNode left, AbstractVectorNode right, List leftList, List rightList) {
+        Set occured = new HashSet();
+        AbstractVectorNode common = null;
+        AbstractVectorNode cur = left;
+        while (cur != null) {
+            occured.add(cur);
+            cur = cur.vector();
+        }
+
+        cur = right;
+        while (cur != null) {
+            if (occured.contains(cur)) {
+                common = cur;
+                break;
+            }
+            cur = cur.vector();
+        }
+
+        fillUntil(left, cur, leftList);
+        fillUntil(right, cur, rightList);
+        return common;
+    }
+
+    private static void fillUntil(AbstractVectorNode left, AbstractVectorNode until, List leftList) {
+        AbstractVectorNode cur = left;
+        while (cur != null && cur != until) {
+            leftList.add(cur);
+            cur = cur.vector();
+        }
+    }
+
+    public void addToLoop(LoopBeginNode loop, IdentityHashMap nodes) {
+        throw new IllegalStateException("unimplemented");
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AccessNode.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/AccessNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,76 @@
+/*
+ * 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.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public abstract class AccessNode extends AbstractMemoryCheckpointNode {
+    @Input private ValueNode object;
+    @Input private GuardNode guard;
+    @Input private LocationNode location;
+    @Input private final NodeInputList dependencies = new NodeInputList(this);
+
+    public ValueNode object() {
+        return object;
+    }
+
+    public void setObject(ValueNode x) {
+        updateUsages(object, x);
+        object = x;
+    }
+
+    public GuardNode guard() {
+        return guard;
+    }
+
+    public void setGuard(GuardNode x) {
+        updateUsages(guard, x);
+        guard = x;
+    }
+
+    public LocationNode location() {
+        return location;
+    }
+
+    public void setLocation(LocationNode x) {
+        updateUsages(location, x);
+        location = x;
+    }
+
+    public AccessNode(CiKind kind, ValueNode object, LocationNode location, Graph graph) {
+        super(kind, graph);
+        setLocation(location);
+        setObject(object);
+    }
+
+    public void addDependency(Node x) {
+        dependencies.add(x);
+    }
+
+    public NodeInputList dependencies() {
+        return dependencies;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AccessVectorNode.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/AccessVectorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,58 @@
+/*
+ * 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.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public abstract class AccessVectorNode extends AbstractVectorNode {
+    @Input private ValueNode object;
+    @Input private LocationNode location;
+    @Input private final NodeInputList dependencies = new NodeInputList(this);
+
+    public ValueNode object() {
+        return object;
+    }
+
+    public void setObject(ValueNode x) {
+        updateUsages(object, x);
+        object = x;
+    }
+
+    public LocationNode location() {
+        return location;
+    }
+
+    public void setLocation(LocationNode x) {
+        updateUsages(location, x);
+        location = x;
+    }
+
+    public AccessVectorNode(CiKind kind, AbstractVectorNode vector, ValueNode object, LocationNode location, Graph graph) {
+        super(kind, vector, graph);
+        setObject(object);
+        setLocation(location);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/CreateVectorNode.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/CreateVectorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,154 @@
+/*
+ * 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.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.base.PhiNode.PhiType;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+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 ValueNode length;
+
+    public ValueNode length() {
+        return length;
+    }
+
+    public void setLength(ValueNode x) {
+        updateUsages(length, x);
+        length = x;
+    }
+
+    private boolean reversed;
+
+    public boolean reversed() {
+        return reversed;
+    }
+
+    public void setReversed(boolean r) {
+        reversed = r;
+    }
+
+    public CreateVectorNode(boolean reversed, ValueNode length, Graph graph) {
+        super(CiKind.Illegal, null, graph);
+        setLength(length);
+        setReversed(reversed);
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map debugProperties = super.getDebugProperties();
+        debugProperties.put("reversed", reversed);
+        return debugProperties;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LIRGeneratorOp.class) {
+            return null;
+        } else if (clazz == LoweringOp.class) {
+            return (T) LOWERING_OP;
+        }
+        return super.lookup(clazz);
+    }
+
+    private LoopBeginNode createLoop(Map map) {
+        EndNode end = new EndNode(graph());
+        LoopBeginNode loopBegin = new LoopBeginNode(graph());
+        loopBegin.addEnd(end);
+        PhiNode loopVariable = new PhiNode(CiKind.Int, loopBegin, PhiType.Value, graph());
+
+        if (reversed) {
+            IntegerSubNode add = new IntegerSubNode(CiKind.Int, loopVariable, ConstantNode.forInt(1, graph()), graph());
+            loopVariable.addInput(new IntegerSubNode(CiKind.Int, length(), ConstantNode.forInt(1, graph()), graph()));
+            loopVariable.addInput(add);
+        } else {
+            IntegerAddNode add = new IntegerAddNode(CiKind.Int, loopVariable, ConstantNode.forInt(1, graph()), graph());
+            loopVariable.addInput(ConstantNode.forInt(0, graph()));
+            loopVariable.addInput(add);
+        }
+
+        LoopEndNode loopEnd = new LoopEndNode(graph());
+        loopEnd.setLoopBegin(loopBegin);
+        loopBegin.setStateAfter(stateAfter());
+        CompareNode condition;
+        if (reversed) {
+            condition = new CompareNode(loopVariable, Condition.GE, ConstantNode.forInt(0, graph()), graph());
+        } else {
+            condition = new CompareNode(loopVariable, Condition.LT, length(), graph());
+        }
+        int expectedLength = 100; // TODO: it may be possible to get a more accurate estimate...?
+        if (length().isConstant()) {
+            expectedLength = length().asConstant().asInt();
+        }
+        IfNode ifNode = new IfNode(condition, 1.0 / expectedLength, graph());
+        loopBegin.setNext(ifNode);
+        ifNode.setTrueSuccessor(loopEnd);
+        this.replaceAtPredecessors(end);
+        ifNode.setFalseSuccessor(this);
+        map.put(this, loopVariable);
+        return loopBegin;
+    }
+
+    private static final LoweringOp LOWERING_OP = new LoweringOp() {
+        @Override
+        public void lower(Node n, CiLoweringTool tool) {
+            CreateVectorNode vectorNode = (CreateVectorNode) n;
+
+            IdentityHashMap nodes = new IdentityHashMap();
+            LoopBeginNode begin = vectorNode.createLoop(nodes);
+            for (Node use : vectorNode.usages()) {
+                processUse(begin, use, nodes);
+            }
+        }
+
+        private void processUse(LoopBeginNode loop, Node use, IdentityHashMap nodes) {
+            AbstractVectorNode vectorNode = (AbstractVectorNode) use;
+            if (nodes.containsKey(vectorNode)) {
+                return;
+            }
+            nodes.put(vectorNode, null);
+
+            // Make sure inputs are evaluated.
+            for (Node input : use.inputs()) {
+                if (input instanceof AbstractVectorNode) {
+                    AbstractVectorNode abstractVectorNodeInput = (AbstractVectorNode) input;
+                    processUse(loop, abstractVectorNodeInput, nodes);
+                }
+            }
+
+            vectorNode.addToLoop(loop, nodes);
+
+            // Go on to usages.
+            for (Node usage : use.usages()) {
+                processUse(loop, usage, nodes);
+            }
+        }
+    };
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/LocationNode.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/LocationNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,114 @@
+/*
+ * 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.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+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.Scale;
+
+
+public final class LocationNode extends FloatingNode {
+    @Input private ValueNode index;
+
+    @Data private int displacement;
+    @Data private boolean indexScalingEnabled = true;
+    @Data private CiKind valueKind;
+    @Data private Object locationIdentity;
+
+    public ValueNode index() {
+        return index;
+    }
+
+    public void setIndex(ValueNode x) {
+        updateUsages(index, x);
+        index = x;
+    }
+
+    public static final Object UNSAFE_ACCESS_LOCATION = new Object();
+    public static final Object FINAL_LOCATION = new Object();
+
+    public static Object getArrayLocation(CiKind elementKind) {
+        return elementKind;
+    }
+
+    public int displacement() {
+        return displacement;
+    }
+
+    /**
+     * @return whether scaling of the index by the value kind's size is enabled (the default) or disabled.
+     */
+    public boolean indexScalingEnabled() {
+        return indexScalingEnabled;
+    }
+
+    /**
+     * Enables or disables scaling of the index by the value kind's size. Has no effect if the index input is not used.
+     */
+    public void setIndexScalingEnabled(boolean enable) {
+        this.indexScalingEnabled = enable;
+    }
+
+    public static LocationNode create(Object identity, CiKind kind, int displacement, Graph graph) {
+        LocationNode result = new LocationNode(identity, kind, displacement, graph);
+        return graph.value(result);
+    }
+
+    private LocationNode(Object identity, CiKind kind, int displacement, Graph graph) {
+        super(CiKind.Illegal, graph);
+        this.displacement = displacement;
+        this.valueKind = kind;
+        this.locationIdentity = identity;
+    }
+
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LIRGeneratorOp.class) {
+            return null;
+        }
+        return super.lookup(clazz);
+    }
+
+    public CiKind getValueKind() {
+        return valueKind;
+    }
+
+    public CiAddress createAddress(LIRGeneratorTool lirGenerator, ValueNode object) {
+        CiValue indexValue = CiValue.IllegalValue;
+        Scale indexScale = Scale.Times1;
+        if (this.index() != null) {
+            indexValue = lirGenerator.load(this.index());
+            if (indexScalingEnabled) {
+                indexScale = Scale.fromInt(valueKind.sizeInBytes(lirGenerator.target().wordSize));
+            }
+        }
+        return new CiAddress(valueKind, lirGenerator.load(object), indexValue, indexScale, displacement);
+    }
+
+    public Object locationIdentity() {
+        return locationIdentity;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/LookupSwitchNode.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/LookupSwitchNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,72 @@
+/*
+ * 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 java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+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 LookupSwitchNode extends SwitchNode {
+
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
+    final int[] keys;
+
+    /**
+     * Constructs a new LookupSwitch instruction.
+     * @param value the instruction producing the value being switched on
+     * @param successors the list of successors
+     * @param keys the list of keys, sorted
+     * @param stateAfter the state after the switch
+     * @param graph
+     */
+    public LookupSwitchNode(ValueNode value, List successors, int[] keys, double[] probability, Graph graph) {
+        super(value, successors, probability, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+        this.keys = keys;
+    }
+
+    /**
+     * Gets the key at the specified index.
+     * @param i the index
+     * @return the key at that index
+     */
+    public int keyAt(int i) {
+        return keys[i];
+    }
+
+    public int keysLength() {
+        return keys.length;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitLookupSwitch(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ReadNode.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/ReadNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,41 @@
+/*
+ * 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.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, ValueNode object, LocationNode location, Graph graph) {
+        super(kind, object, location, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitMemoryRead(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ReadVectorNode.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/ReadVectorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,58 @@
+/*
+ * 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.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, ValueNode object, LocationNode location, Graph graph) {
+        super(CiKind.Illegal, vector, object, location, graph);
+    }
+
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LIRGeneratorOp.class) {
+            return null;
+        }
+        return super.lookup(clazz);
+    }
+
+    @Override
+    public void addToLoop(LoopBeginNode loop, IdentityHashMap nodes) {
+        LocationNode newLocation = LocationNode.create(LocationNode.getArrayLocation(location().getValueKind()), location().getValueKind(), location().displacement(), graph());
+        ValueNode index = nodes.get(vector());
+        assert index != null;
+        newLocation.setIndex(index);
+        ReadNode readNode = new ReadNode(location().getValueKind().stackKind(), object(), newLocation, graph());
+        loop.loopEnd().replaceAtPredecessors(readNode);
+        readNode.setNext(loop.loopEnd());
+        nodes.put(this, readNode);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ShiftNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ShiftNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreFieldNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreFieldNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreIndexedNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/StoreIndexedNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/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/extended/SwitchNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,67 @@
+/*
+ * 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.extended;
+
+import java.util.*;
+
+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 ControlSplitNode {
+
+    @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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/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/extended/TableSwitchNode.java	Wed Aug 10 00:34:29 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 java.util.*;
+
+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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/TypeCheckNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/TypeCheckNode.java	Tue Aug 09 23:56:10 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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnsignedRightShiftNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnsignedRightShiftNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnwindNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/UnwindNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ValueAnchorNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ValueAnchorNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ValueAnchorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -22,7 +22,6 @@
  */
 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.*;
@@ -31,7 +30,7 @@
 /**
  * The ValueAnchor instruction keeps non-CFG nodes above a certain point in the graph.
  */
-public final class ValueAnchorNode extends FixedNodeWithNext {
+public final class ValueAnchorNode extends FixedWithNextNode {
     @Input private ValueNode object;
 
     public ValueNode object() {
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectFieldNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectFieldNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/VirtualObjectNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/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/extended/WriteMemoryCheckpointNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,47 @@
+/*
+ * 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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -22,7 +22,6 @@
  */
 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.*;
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteVectorNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteVectorNode.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteVectorNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -24,7 +24,6 @@
 
 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.*;
@@ -57,7 +56,7 @@
     }
 
     @Override
-    public void addToLoop(LoopBegin loop, IdentityHashMap nodes) {
+    public void addToLoop(LoopBeginNode 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());
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/XorNode.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/XorNode.java	Tue Aug 09 23:56:10 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.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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessArrayNode.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/java/AccessArrayNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,56 @@
+/*
+ * 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.java;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * This the base class of all array operations.
+ */
+public abstract class AccessArrayNode extends StateSplit {
+
+    @Input    private ValueNode array;
+
+    public ValueNode array() {
+        return array;
+    }
+
+    public void setArray(ValueNode x) {
+        updateUsages(array, x);
+        array = x;
+    }
+
+    /**
+     * Creates a new AccessArray instruction.
+     * @param kind the type of the result of this instruction
+     * @param array the instruction that produces the array object value
+     * @param graph
+     */
+    public AccessArrayNode(CiKind kind, ValueNode array, Graph graph) {
+        super(kind, graph);
+        setArray(array);
+    }
+
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessFieldNode.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/java/AccessFieldNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,96 @@
+/*
+ * 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.java;
+
+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.*;
+
+/**
+ * The base class of all instructions that access fields.
+ */
+public abstract class AccessFieldNode extends StateSplit {
+
+    @Input    private ValueNode object;
+
+    public ValueNode object() {
+        return object;
+    }
+
+    public void setObject(ValueNode x) {
+        updateUsages(object, x);
+        object = x;
+    }
+
+    protected final RiField field;
+
+    /**
+     * Constructs a new access field object.
+     * @param kind the result kind of the access
+     * @param object the instruction producing the receiver object
+     * @param field the compiler interface representation of the field
+     * @param graph
+     */
+    public AccessFieldNode(CiKind kind, ValueNode object, RiField field, Graph graph) {
+        super(kind, graph);
+        this.field = field;
+        setObject(object);
+        assert field.isResolved();
+        assert field.holder().isInitialized();
+    }
+
+    /**
+     * Gets the compiler interface field for this field access.
+     * @return the compiler interface field for this field access
+     */
+    public RiField field() {
+        return field;
+    }
+
+    /**
+     * Checks whether this field access is an access to a static field.
+     * @return {@code true} if this field access is to a static field
+     */
+    public boolean isStatic() {
+        return Modifier.isStatic(field.accessFlags());
+    }
+
+    /**
+     * Checks whether this field is declared volatile.
+     * @return {@code true} if the field is resolved and declared volatile
+     */
+    public boolean isVolatile() {
+        return Modifier.isVolatile(field.accessFlags());
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("field", field);
+        return properties;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessIndexedNode.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/java/AccessIndexedNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,83 @@
+/*
+ * 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.java;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code AccessIndexed} class is the base class of instructions that read or write
+ * elements of an array.
+ */
+public abstract class AccessIndexedNode extends AccessArrayNode {
+
+    @Input    private ValueNode index;
+
+    @Input    private ValueNode length;
+
+    public ValueNode index() {
+        return index;
+    }
+
+    public void setIndex(ValueNode x) {
+        updateUsages(index, x);
+        index = x;
+    }
+
+    public ValueNode length() {
+        return length;
+    }
+
+    public void setLength(ValueNode x) {
+        updateUsages(length, x);
+        length = x;
+    }
+
+    private final CiKind elementType;
+
+    /**
+     * Create an new AccessIndexed instruction.
+     * @param kind the result kind of the access
+     * @param array the instruction producing the array
+     * @param index the instruction producing the index
+     * @param length the instruction producing the length (used in bounds check elimination?)
+     * @param elementKind the type of the elements of the array
+     * @param graph
+     */
+    protected AccessIndexedNode(CiKind kind, ValueNode array, ValueNode index, ValueNode length, CiKind elementKind, Graph graph) {
+        super(kind, array, graph);
+        setIndex(index);
+        setLength(length);
+        this.elementType = elementKind;
+    }
+
+    /**
+     * Gets the element type of the array.
+     * @return the element type
+     */
+    public CiKind elementKind() {
+        return elementType;
+    }
+
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessMonitorNode.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/java/AccessMonitorNode.java	Wed Aug 10 00:34:29 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.java;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.extended.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code AccessMonitor} instruction is the base class of both monitor acquisition and release.
+ */
+public abstract class AccessMonitorNode extends AbstractMemoryCheckpointNode {
+
+    @Input private ValueNode object;
+    @Input private ValueNode lockAddress;
+
+    public ValueNode object() {
+        return object;
+    }
+
+    public void setObject(ValueNode x) {
+        updateUsages(object, x);
+        object = x;
+    }
+
+    public ValueNode lockAddress() {
+        return lockAddress;
+    }
+
+    public void setLockAddress(ValueNode x) {
+        updateUsages(lockAddress, x);
+        lockAddress = x;
+    }
+
+    /**
+     * The lock number of this monitor access.
+     */
+    public final int lockNumber;
+
+    /**
+     * Creates a new AccessMonitor instruction.
+     *
+     * @param object the instruction producing the object
+     * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
+     * @param lockNumber the number of the lock being acquired
+     * @param graph
+     */
+    public AccessMonitorNode(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) {
+        super(CiKind.Illegal, graph);
+        this.lockNumber = lockNumber;
+        setObject(object);
+        setLockAddress(lockAddress);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/ArrayLengthNode.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/java/ArrayLengthNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,84 @@
+/*
+ * 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.java;
+
+import com.oracle.max.graal.compiler.graph.*;
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+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 ArrayLength} instruction gets the length of an array.
+ */
+public final class ArrayLengthNode extends FloatingNode implements Canonicalizable {
+
+    @Input private ValueNode array;
+
+    public ValueNode array() {
+        return array;
+    }
+
+    public void setArray(ValueNode x) {
+        updateUsages(array, x);
+        array = x;
+    }
+
+    /**
+     * Constructs a new ArrayLength instruction.
+     *
+     * @param array the instruction producing the array
+     * @param newFrameState the state after executing this instruction
+     */
+    public ArrayLengthNode(ValueNode array, Graph graph) {
+        super(CiKind.Int, graph);
+        setArray(array);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitArrayLength(this);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (array() instanceof NewArrayNode) {
+            ValueNode length = ((NewArrayNode) array()).dimension(0);
+            assert length != null;
+            return length;
+        }
+        CiConstant constantValue = null;
+        if (array().isConstant()) {
+            constantValue = array().asConstant();
+            if (constantValue != null && constantValue.isNonNull()) {
+                if (graph() instanceof CompilerGraph) {
+                    RiRuntime runtime = ((CompilerGraph) graph()).runtime();
+                    return ConstantNode.forInt(runtime.getArrayLength(constantValue), graph());
+                }
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/CheckCastNode.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/java/CheckCastNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,90 @@
+/*
+ * 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.java;
+
+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.*;
+import com.sun.cri.ri.*;
+
+/**
+ * The {@code CheckCast} instruction represents a {@link Bytecodes#CHECKCAST}.
+ */
+public final class CheckCastNode extends TypeCheckNode implements Canonicalizable {
+
+    /**
+     * Creates a new CheckCast instruction.
+     *
+     * @param targetClass the class being cast to
+     * @param object the instruction producing the object
+     * @param graph
+     */
+    public CheckCastNode(ValueNode targetClassInstruction, ValueNode object, Graph graph) {
+        super(targetClassInstruction, object, CiKind.Object, graph);
+    }
+
+    /**
+     * Gets the declared type of the result of this instruction.
+     *
+     * @return the declared type of the result
+     */
+    @Override
+    public RiType declaredType() {
+        return targetClass();
+    }
+
+    /**
+     * Gets the exact type of the result of this instruction.
+     *
+     * @return the exact type of the result
+     */
+    @Override
+    public RiType exactType() {
+        return targetClass().isResolved() ? targetClass().exactType() : null;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitCheckCast(this);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (object().exactType() != null) {
+            return object();
+        }
+        CiConstant constant = object().asConstant();
+        if (constant != null) {
+            assert constant.kind == CiKind.Object;
+            if (constant.isNull()) {
+                return object();
+            } else {
+                // this should never happen - non-null constants are always expected to provide an exactType
+                assert false;
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/ExceptionObjectNode.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/java/ExceptionObjectNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,47 @@
+/*
+ * 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.java;
+
+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 ExceptionObject} instruction represents the incoming exception object to an exception handler.
+ */
+public final class ExceptionObjectNode extends StateSplit {
+
+    /**
+     * Constructs a new ExceptionObject instruction.
+     * @param graph
+     */
+    public ExceptionObjectNode(Graph graph) {
+        super(CiKind.Object, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitExceptionObject(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/InstanceOfNode.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/java/InstanceOfNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,67 @@
+/*
+ * 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.java;
+
+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 InstanceOf} instruction represents an instanceof test.
+ */
+public final class InstanceOfNode extends TypeCheckNode implements Canonicalizable {
+
+    /**
+     * Constructs a new InstanceOf instruction.
+     *
+     * @param targetClass the target class of the instanceof check
+     * @param object the instruction producing the object input to this instruction
+     * @param graph
+     */
+    public InstanceOfNode(ConstantNode targetClassInstruction, ValueNode object, boolean nullIsTrue, Graph graph) {
+        super(targetClassInstruction, object, CiKind.Illegal, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (object().exactType() != null) {
+            return ConstantNode.forBoolean(object().exactType().isSubtypeOf(targetClass()), graph());
+        }
+        CiConstant constant = object().asConstant();
+        if (constant != null) {
+            assert constant.kind == CiKind.Object;
+            if (constant.isNull()) {
+                return ConstantNode.forBoolean(false, graph());
+            } else {
+                // this should never happen - non-null constants are always expected to provide an exactType
+                assert false;
+            }
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/IsTypeNode.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/java/IsTypeNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,100 @@
+/*
+ * 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.java;
+
+import java.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.ci.*;
+import com.sun.cri.ri.*;
+
+/**
+ * The {@code TypeCheck} class represents an explicit type check instruction.
+ */
+public final class IsTypeNode extends BooleanNode implements Canonicalizable {
+
+    @Input private ValueNode object;
+
+    public ValueNode object() {
+        return object;
+    }
+
+    public void setObject(ValueNode x) {
+        updateUsages(object, x);
+        object = x;
+    }
+
+    private final RiType type;
+
+    /**
+     * Constructs a new IsType instruction.
+     *
+     * @param object the instruction producing the object to check against the given type
+     * @param graph
+     */
+    public IsTypeNode(ValueNode object, RiType type, Graph graph) {
+        super(CiKind.Object, graph);
+        assert type.isResolved();
+        assert object == null || object.kind == CiKind.Object;
+        this.type = type;
+        setObject(object);
+    }
+
+    public RiType type() {
+        return type;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        // Nothing to do.
+    }
+
+    @Override
+    public RiType declaredType() {
+        // type check does not alter the type of the object
+        return object().declaredType();
+    }
+
+    @Override
+    public RiType exactType() {
+        return type;
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("type", type);
+        return properties;
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (object().exactType() != null) {
+            return ConstantNode.forBoolean(object().exactType() == type(), graph());
+        }
+        // constants return the correct exactType, so they are handled by the code above
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/LoadFieldNode.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/java/LoadFieldNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,109 @@
+/*
+ * 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.java;
+
+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 LoadField} instruction represents a read of a static or instance field.
+ */
+public final class LoadFieldNode extends AccessFieldNode implements Canonicalizable {
+
+    /**
+     * Creates a new LoadField instance.
+     *
+     * @param object the receiver object
+     * @param field the compiler interface field
+     * @param isStatic indicates if the field is static
+     * @param stateAfter the state after the field access
+     * @param graph
+     * @param isLoaded indicates if the class is loaded
+     */
+    public LoadFieldNode(ValueNode object, RiField field, Graph graph) {
+        super(field.kind().stackKind(), object, field, graph);
+    }
+
+    /**
+     * Gets the declared type of the field being accessed.
+     *
+     * @return the declared type of the field being accessed.
+     */
+    @Override
+    public RiType declaredType() {
+        return field().type();
+    }
+
+    /**
+     * Gets the exact type of the field being accessed. If the field type is a primitive array or an instance class and
+     * the class is loaded and final, then the exact type is the same as the declared type. Otherwise it is {@code null}
+     *
+     * @return the exact type of the field if known; {@code null} otherwise
+     */
+    @Override
+    public RiType exactType() {
+        RiType declared = declaredType();
+        return declared != null && declared.isResolved() ? declared.exactType() : null;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitLoadField(this);
+    }
+
+    @Override
+    public boolean needsStateAfter() {
+        return false;
+    }
+
+    /**
+     * Gets a constant value to which this load can be reduced.
+     *
+     * @return {@code null} if this load cannot be reduced to a constant
+     */
+    private CiConstant constantValue() {
+        if (isStatic()) {
+            return field.constantValue(null);
+        } else if (object().isConstant()) {
+            return field.constantValue(object().asConstant());
+        }
+        return null;
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        CiConstant constant = null;
+        if (isStatic()) {
+            constant = field().constantValue(null);
+        } else if (object().isConstant()) {
+            constant = field().constantValue(object().asConstant());
+        }
+        if (constant != null) {
+            return new ConstantNode(constant, graph());
+        }
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/LoadIndexedNode.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/java/LoadIndexedNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,89 @@
+/*
+ * 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.java;
+
+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 LoadIndexed} instruction represents a read from an element of an array.
+ */
+public final class LoadIndexedNode extends AccessIndexedNode {
+
+    /**
+     * Creates a new LoadIndexed 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 graph
+     */
+    public LoadIndexedNode(ValueNode array, ValueNode index, ValueNode length, CiKind elementKind, Graph graph) {
+        super(elementKind.stackKind(), array, index, length, elementKind, graph);
+    }
+
+    /**
+     * Gets the declared type of this instruction's result.
+     * @return the declared type
+     */
+    @Override
+    public RiType declaredType() {
+        RiType arrayType = array().declaredType();
+        if (arrayType == null) {
+            return null;
+        }
+        return arrayType.componentType();
+    }
+
+    /**
+     * Gets the exact type of this instruction's result.
+     * @return the exact type
+     */
+    @Override
+    public RiType exactType() {
+        RiType declared = declaredType();
+        return declared != null && declared.isResolved() ? declared.exactType() : null;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitLoadIndexed(this);
+    }
+
+    @Override
+    public boolean needsStateAfter() {
+        return false;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LoweringOp.class) {
+            return (T) DELEGATE_TO_RUNTIME;
+        }
+        return super.lookup(clazz);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MathIntrinsicNode.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/java/MathIntrinsicNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,62 @@
+/*
+ * 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.java;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+
+public class MathIntrinsicNode extends FloatingNode {
+
+    @Input private ValueNode x;
+    @Data private final Operation operation;
+
+    public enum Operation {
+        ABS, SQRT,
+    }
+
+    public ValueNode x() {
+        return x;
+    }
+
+    private void setX(ValueNode x) {
+        updateUsages(this.x, x);
+        this.x = x;
+    }
+
+    public Operation operation() {
+        return operation;
+    }
+
+    public MathIntrinsicNode(ValueNode x, Operation op, Graph graph) {
+        super(x.kind, graph);
+        setX(x);
+        this.operation = op;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitMathIntrinsic(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorAddressNode.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/java/MonitorAddressNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010, 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.java;
+
+import java.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.ci.*;
+
+/**
+ * Instruction that is used to refer to the address of an on-stack monitor.
+ */
+public final class MonitorAddressNode extends ValueNode {
+
+    private int monitorIndex;
+
+    public MonitorAddressNode(int monitorIndex, Graph graph) {
+        super(CiKind.Word, graph);
+        this.monitorIndex = monitorIndex;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitMonitorAddress(this);
+    }
+
+    public int monitorIndex() {
+        return monitorIndex;
+    }
+
+    public void setMonitorIndex(int monitorIndex) {
+        this.monitorIndex = monitorIndex;
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("monitorIndex", monitorIndex);
+        return properties;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorEnterNode.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/java/MonitorEnterNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,50 @@
+/*
+ * 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.java;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+
+/**
+ * The {@code MonitorEnter} instruction represents the acquisition of a monitor.
+ */
+public final class MonitorEnterNode extends AccessMonitorNode {
+
+    /**
+     * Creates a new MonitorEnter instruction.
+     *
+     * @param object the instruction producing the object
+     * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
+     * @param lockNumber the number of the lock
+     * @param graph
+     */
+    public MonitorEnterNode(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) {
+        super(object, lockAddress, lockNumber, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitMonitorEnter(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorExitNode.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/java/MonitorExitNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,50 @@
+/*
+ * 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.java;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+
+/**
+ * The {@code MonitorExit} instruction represents a monitor release.
+ */
+public final class MonitorExitNode extends AccessMonitorNode {
+
+    /**
+     * Creates a new MonitorExit instruction.
+     *
+     * @param object the instruction produces the object value
+     * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
+     * @param lockNumber the number of the lock
+     * @param graph
+     */
+    public MonitorExitNode(ValueNode object, ValueNode lockAddress, int lockNumber, Graph graph) {
+        super(object, lockAddress, lockNumber, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitMonitorExit(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewArrayNode.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/java/NewArrayNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,179 @@
+/*
+ * 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.java;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.compiler.nodes.virtual.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code NewArray} class is the base of all instructions that allocate arrays.
+ */
+public abstract class NewArrayNode extends FixedWithNextNode {
+
+    @Input    private ValueNode length;
+
+    public ValueNode length() {
+        return length;
+    }
+
+    public void setLength(ValueNode x) {
+        updateUsages(this.length, x);
+        this.length = x;
+    }
+
+    /**
+     * Constructs a new NewArray instruction.
+     * @param length the instruction that produces the length for this allocation
+     * @param graph
+     */
+    protected NewArrayNode(ValueNode length, Graph graph) {
+        super(CiKind.Object, graph);
+        setLength(length);
+    }
+
+    /**
+     * The list of instructions which produce input for this instruction.
+     */
+    public ValueNode dimension(int index) {
+        assert index == 0;
+        return length();
+    }
+
+    /**
+     * The rank of the array allocated by this instruction, i.e. how many array dimensions.
+     */
+    public int dimensionCount() {
+        return 1;
+    }
+
+    public abstract CiKind elementKind();
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("exactType", exactType());
+        return properties;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == EscapeOp.class) {
+            return (T) ESCAPE;
+        }
+        return super.lookup(clazz);
+    }
+
+    private static final EscapeOp ESCAPE = new EscapeOp() {
+
+        @Override
+        public boolean canAnalyze(Node node) {
+            NewArrayNode x = (NewArrayNode) node;
+            CiConstant length = x.dimension(0).asConstant();
+            return length != null && length.asInt() >= 0 && length.asInt() < GraalOptions.MaximumEscapeAnalysisArrayLength;
+        }
+
+        @Override
+        public boolean escape(Node node, Node usage) {
+            if (usage instanceof LoadIndexedNode) {
+                LoadIndexedNode x = (LoadIndexedNode) usage;
+                assert x.array() == node;
+                CiConstant index = x.index().asConstant();
+                CiConstant length = ((NewArrayNode) node).dimension(0).asConstant();
+                if (index == null || length == null || index.asInt() < 0 || index.asInt() >= length.asInt()) {
+                    return true;
+                }
+                return false;
+            } else if (usage instanceof StoreFieldNode) {
+                StoreFieldNode x = (StoreFieldNode) usage;
+                assert x.value() == node;
+                return true;
+            } else if (usage instanceof StoreIndexedNode) {
+                StoreIndexedNode x = (StoreIndexedNode) usage;
+                CiConstant index = x.index().asConstant();
+                CiConstant length = ((NewArrayNode) node).dimension(0).asConstant();
+                if (index == null || length == null || index.asInt() < 0 || index.asInt() >= length.asInt()) {
+                    return true;
+                }
+                return x.value() == node && x.array() != node;
+            } else if (usage instanceof ArrayLengthNode) {
+                ArrayLengthNode x = (ArrayLengthNode) usage;
+                assert x.array() == node;
+                return false;
+            } else if (usage instanceof VirtualObjectFieldNode) {
+                return false;
+            } else {
+                return super.escape(node, usage);
+            }
+        }
+
+        @Override
+        public EscapeField[] fields(Node node) {
+            NewArrayNode x = (NewArrayNode) node;
+            int length = x.dimension(0).asConstant().asInt();
+            EscapeField[] fields = new EscapeField[length];
+            for (int i = 0; i < length; i++) {
+                Integer representation = i;
+                fields[i] = new EscapeField("[" + i + "]", representation, ((NewArrayNode) node).elementKind());
+            }
+            return fields;
+        }
+
+        @Override
+        public void beforeUpdate(Node node, Node usage) {
+            if (usage instanceof ArrayLengthNode) {
+                ArrayLengthNode x = (ArrayLengthNode) usage;
+                x.replaceAndDelete(((NewArrayNode) node).dimension(0));
+            } else {
+                super.beforeUpdate(node, usage);
+            }
+        }
+
+        @Override
+        public int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState) {
+            if (current instanceof AccessIndexedNode) {
+                AccessIndexedNode x = (AccessIndexedNode) current;
+                if (x.array() == node) {
+                    int index = ((AccessIndexedNode) current).index().asConstant().asInt();
+                    if (current instanceof LoadIndexedNode) {
+                        x.replaceAtUsages(fieldState[index]);
+                        assert x.usages().size() == 0;
+                        x.replaceAndDelete(x.next());
+                    } else if (current instanceof StoreIndexedNode) {
+                        fieldState[index] = ((StoreIndexedNode) x).value();
+                        assert x.usages().size() == 0;
+                        x.replaceAndDelete(x.next());
+                        return index;
+                    }
+                }
+            }
+            return -1;
+        }
+    };
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewInstanceNode.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/java/NewInstanceNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,171 @@
+/*
+ * 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.java;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.compiler.nodes.virtual.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+import com.sun.cri.ri.*;
+
+/**
+ * The {@code NewInstance} instruction represents the allocation of an instance class object.
+ */
+public final class NewInstanceNode extends FixedWithNextNode {
+
+    final RiType instanceClass;
+    public final int cpi;
+    public final RiConstantPool constantPool;
+
+    /**
+     * Constructs a NewInstance instruction.
+     * @param type the class being allocated
+     * @param cpi the constant pool index
+     * @param graph
+     */
+    public NewInstanceNode(RiType type, int cpi, RiConstantPool constantPool, Graph graph) {
+        super(CiKind.Object, graph);
+        this.instanceClass = type;
+        this.cpi = cpi;
+        this.constantPool = constantPool;
+    }
+
+    /**
+     * Gets the instance class being allocated by this instruction.
+     * @return the instance class allocated
+     */
+    public RiType instanceClass() {
+        return instanceClass;
+    }
+
+    /**
+     * Gets the exact type produced by this instruction. For allocations of instance classes, this is
+     * always the class allocated.
+     * @return the exact type produced by this instruction
+     */
+    @Override
+    public RiType exactType() {
+        return instanceClass;
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitNewInstance(this);
+    }
+
+    @Override
+    public Map getDebugProperties() {
+        Map properties = super.getDebugProperties();
+        properties.put("instanceClass", instanceClass);
+        properties.put("cpi", cpi);
+        return properties;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == EscapeOp.class) {
+            return (T) ESCAPE;
+        }
+        return super.lookup(clazz);
+    }
+
+    private static final EscapeOp ESCAPE = new EscapeOp() {
+
+        @Override
+        public boolean canAnalyze(Node node) {
+            return ((NewInstanceNode) node).instanceClass().isResolved();
+        }
+
+        @Override
+        public boolean escape(Node node, Node usage) {
+            if (usage instanceof LoadFieldNode) {
+                LoadFieldNode x = (LoadFieldNode) usage;
+                assert x.object() == node;
+                return x.field().isResolved() == false;
+            } else if (usage instanceof StoreFieldNode) {
+                StoreFieldNode x = (StoreFieldNode) usage;
+                return x.value() == node && x.object() != node;
+            } else if (usage instanceof StoreIndexedNode) {
+                StoreIndexedNode x = (StoreIndexedNode) usage;
+                assert x.value() == node;
+                return true;
+            } else if (usage instanceof VirtualObjectFieldNode) {
+                return false;
+            } else if (usage instanceof RegisterFinalizerNode) {
+                RegisterFinalizerNode x = (RegisterFinalizerNode) usage;
+                assert x.object() == node;
+                return false;
+            } else {
+                return super.escape(node, usage);
+            }
+        }
+
+        @Override
+        public EscapeField[] fields(Node node) {
+            NewInstanceNode x = (NewInstanceNode) node;
+            RiField[] riFields = x.instanceClass().fields();
+            EscapeField[] fields = new EscapeField[riFields.length];
+            for (int i = 0; i < riFields.length; i++) {
+                RiField field = riFields[i];
+                fields[i] = new EscapeField(field.name(), field, field.kind().stackKind());
+            }
+            return fields;
+        }
+
+        @Override
+        public void beforeUpdate(Node node, Node usage) {
+            if (usage instanceof RegisterFinalizerNode) {
+                RegisterFinalizerNode x = (RegisterFinalizerNode) usage;
+                x.replaceAndDelete(x.next());
+            } else {
+                super.beforeUpdate(node, usage);
+            }
+        }
+
+        @Override
+        public int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState) {
+            if (current instanceof AccessFieldNode) {
+                AccessFieldNode x = (AccessFieldNode) current;
+                if (x.object() == node) {
+                    int field = fieldIndex.get(((AccessFieldNode) current).field());
+                    if (current instanceof LoadFieldNode) {
+                        assert fieldState[field] != null : field + ", " + ((AccessFieldNode) current).field();
+                        x.replaceAtUsages(fieldState[field]);
+                        assert x.usages().size() == 0;
+                        x.replaceAndDelete(x.next());
+                    } else if (current instanceof StoreFieldNode) {
+                        fieldState[field] = ((StoreFieldNode) x).value();
+                        assert x.usages().size() == 0;
+                        x.replaceAndDelete(x.next());
+                        return field;
+                    }
+                }
+            }
+            return -1;
+        }
+    };
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewMultiArrayNode.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/java/NewMultiArrayNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,107 @@
+/*
+ * 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.java;
+
+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 NewMultiArray} instruction represents an allocation of a multi-dimensional object
+ * array.
+ */
+public final class NewMultiArrayNode extends NewArrayNode {
+
+    @Input private final NodeInputList dimensions;
+
+    @Override
+    public ValueNode dimension(int index) {
+        return dimensions.get(index);
+    }
+
+    public void setDimension(int index, ValueNode x) {
+        dimensions.set(index, x);
+    }
+
+    /**
+     * The rank of the array allocated by this instruction, i.e. how many array dimensions.
+     */
+    @Override
+    public int dimensionCount() {
+        return dimensions.size();
+    }
+
+    public final RiType elementType;
+    public final int cpi;
+    public final RiConstantPool constantPool;
+
+    /**
+     * Constructs a new NewMultiArray instruction.
+     * @param elementType the element type of the array
+     * @param dimensions the instructions which produce the dimensions for this array
+     * @param cpi the constant pool index for resolution
+     * @param riConstantPool the constant pool for resolution
+     * @param graph
+     */
+    public NewMultiArrayNode(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);
+        for (int i = 0; i < dimensions.length; i++) {
+            setDimension(i, dimensions[i]);
+        }
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitNewMultiArray(this);
+    }
+
+    /**
+     * Gets the element type of the array.
+     * @return the element type of the array
+     */
+    public RiType elementType() {
+        return elementType;
+    }
+
+    @Override
+    public CiKind elementKind() {
+        return elementType.kind();
+    }
+
+    @Override
+    public RiType exactType() {
+        return elementType.arrayOf();
+    }
+
+    @Override
+    public RiType declaredType() {
+        return exactType();
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewObjectArrayNode.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/java/NewObjectArrayNode.java	Wed Aug 10 00:34:29 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.java;
+
+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 NewObjectArray} instruction represents an allocation of an object array.
+ */
+public final class NewObjectArrayNode extends NewArrayNode {
+
+    final RiType elementClass;
+
+    /**
+     * Constructs a new NewObjectArray instruction.
+     * @param elementClass the class of elements in this array
+     * @param length the instruction producing the length of the array
+     * @param graph
+     */
+    public NewObjectArrayNode(RiType elementClass, ValueNode length, Graph graph) {
+        super(length, graph);
+        this.elementClass = elementClass;
+    }
+
+    /**
+     * Gets the type of the elements of the array.
+     * @return the element type of the array
+     */
+    public RiType elementType() {
+        return elementClass;
+    }
+
+    @Override
+    public CiKind elementKind() {
+        return elementClass.kind();
+    }
+
+    @Override
+    public RiType exactType() {
+        return elementClass.arrayOf();
+    }
+
+    @Override
+    public RiType declaredType() {
+        return exactType();
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitNewObjectArray(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewTypeArrayNode.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/java/NewTypeArrayNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,62 @@
+/*
+ * 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.java;
+
+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 NewTypeArray} class definition.
+ */
+public final class NewTypeArrayNode extends NewArrayNode {
+
+    final RiType elementType;
+
+    public NewTypeArrayNode(ValueNode length, RiType elementType, Graph graph) {
+        super(length, graph);
+        this.elementType = elementType;
+    }
+
+    @Override
+    public CiKind elementKind() {
+        return elementType.kind();
+    }
+
+    @Override
+    public RiType declaredType() {
+        return elementType.arrayOf();
+    }
+
+    @Override
+    public RiType exactType() {
+        return elementType.arrayOf();
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitNewTypeArray(this);
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/RegisterFinalizerNode.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/java/RegisterFinalizerNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2011, 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.java;
+
+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.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.*;
+
+/**
+ * This instruction is used to perform the finalizer registration at the end of the java.lang.Object constructor.
+ */
+public final class RegisterFinalizerNode extends StateSplit implements Canonicalizable {
+
+    @Input private ValueNode object;
+
+    public ValueNode object() {
+        return object;
+    }
+
+    public void setObject(ValueNode x) {
+        updateUsages(object, x);
+        object = x;
+    }
+
+    public RegisterFinalizerNode(ValueNode object, Graph graph) {
+        super(CiKind.Void, graph);
+        setObject(object);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitRegisterFinalizer(this);
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        RiType declaredType = object.declaredType();
+        RiType exactType = object.exactType();
+        if (exactType == null && declaredType != null) {
+            exactType = declaredType.exactType();
+        }
+
+        boolean needsCheck = true;
+        if (exactType != null) {
+            // we have an exact type
+            needsCheck = exactType.hasFinalizer();
+        } else {
+            // if either the declared type of receiver or the holder can be assumed to have no finalizers
+            if (declaredType != null && !declaredType.hasFinalizableSubclass()) {
+                if (((CompilerGraph) graph()).assumptions().recordNoFinalizableSubclassAssumption(declaredType)) {
+                    needsCheck = false;
+                }
+            }
+        }
+
+        if (needsCheck) {
+            if (GraalOptions.TraceCanonicalizer) {
+                TTY.println("Could not canonicalize finalizer " + object + " (declaredType=" + declaredType + ", exactType=" + exactType + ")");
+            }
+        } else {
+            if (GraalOptions.TraceCanonicalizer) {
+                TTY.println("Canonicalized finalizer for object " + object);
+            }
+            return next();
+        }
+
+        return this;
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/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/java/StoreFieldNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,73 @@
+/*
+ * 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.java;
+
+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 AccessFieldNode {
+
+    @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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/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/java/StoreIndexedNode.java	Wed Aug 10 00:34:29 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.java;
+
+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 AccessIndexedNode {
+
+    @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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/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/java/TypeCheckNode.java	Wed Aug 10 00:34:29 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.java;
+
+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 ConstantNode ? (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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/BasicInductionVariableNode.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/loop/BasicInductionVariableNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,125 @@
+/*
+ * 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.loop;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.base.PhiNode.PhiType;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+/**
+ * LinearInductionVariable that is computed in the loops thanks to Phi(init, this + stride).
+ * This will keep at least one register busy in the whole loop body
+ */
+public class BasicInductionVariableNode extends LinearInductionVariableNode implements Canonicalizable{
+    public static final BIVLoweringOp LOWERING = new BIVLoweringOp();
+    @Input private LoopCounterNode loopCounter;
+
+    public BasicInductionVariableNode(CiKind kind, ValueNode init, ValueNode stride, LoopCounterNode counter, Graph graph) {
+        super(kind, init, stride, graph);
+        setLoopCounter(counter);
+    }
+
+    public LoopCounterNode loopCounter() {
+        return loopCounter;
+    }
+
+    public void setLoopCounter(LoopCounterNode loopCounter) {
+        updateUsages(this.loopCounter, loopCounter);
+        this.loopCounter = loopCounter;
+    }
+
+    public ValueNode init() {
+        return a();
+    }
+
+    public void setInit(ValueNode init) {
+        setA(init);
+    }
+
+    public ValueNode stride() {
+        return b();
+    }
+
+    public void setStride(ValueNode stride) {
+        setB(stride);
+    }
+
+    @Override
+    public LoopBeginNode loopBegin() {
+        return loopCounter().loopBegin();
+    }
+
+    @Override
+    public void peelOneIteration() {
+        this.setInit(IntegerArithmeticNode.add(init(), stride()));
+    }
+
+    /**
+     * Will lessen the register pressure but augment the code complexity with a multiplication.
+     * @return the new DerivedInductionVariable
+     */
+    public DerivedInductionVariableNode toDerivedInductionVariable() {
+        DerivedInductionVariableNode newDIV = new DerivedInductionVariableNode(kind, init(), stride(), loopCounter(), graph());
+        this.replaceAndDelete(newDIV);
+        return newDIV;
+    }
+
+    @Override
+    public Node canonical(NotifyReProcess reProcess) {
+        if (this.init().isConstant() && this.init().asConstant().asLong() == 0
+                        && this.stride().isConstant() && this.stride().asConstant().asLong() == 1) {
+            return this.loopCounter();
+        }
+        return this;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LoweringOp.class) {
+            return (T) LOWERING;
+        }
+        return super.lookup(clazz);
+    }
+
+    public static class BIVLoweringOp implements LoweringOp {
+        @Override
+        public void lower(Node n, CiLoweringTool tool) {
+            BasicInductionVariableNode biv = (BasicInductionVariableNode) n;
+            PhiNode phi = this.ivToPhi(biv.loopBegin(), biv.init(), biv.stride(), biv.kind);
+            biv.replaceAtNonIVUsages(phi);
+        }
+
+        public PhiNode ivToPhi(LoopBeginNode loopBegin, ValueNode init, ValueNode stride, CiKind kind) {
+            PhiNode phi = new PhiNode(kind, loopBegin, PhiType.Value, loopBegin.graph());
+            IntegerArithmeticNode after = IntegerArithmeticNode.add(phi, stride);
+            phi.addInput(init);
+            phi.addInput(after);
+            return phi;
+        }
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/DerivedInductionVariableNode.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/loop/DerivedInductionVariableNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,125 @@
+/*
+ * 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.loop;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+/**
+ * LinearInductionVariable that is computed in the loops with offset + scale * base.
+ * This is computed in the loop only when necessary, puts less pressure on registers.
+ */
+public class DerivedInductionVariableNode extends LinearInductionVariableNode {
+    @Input private InductionVariableNode base;
+
+    public DerivedInductionVariableNode(CiKind kind, ValueNode offset, ValueNode scale, InductionVariableNode base, Graph graph) {
+        super(kind, offset, scale, graph);
+        setBase(base);
+    }
+
+    public InductionVariableNode base() {
+        return base;
+    }
+
+    public void setBase(InductionVariableNode base) {
+        updateUsages(this.base, base);
+        this.base = base;
+    }
+
+    public ValueNode offset() {
+        return a();
+    }
+
+    public void setOffset(ValueNode offset) {
+        setA(offset);
+    }
+
+    public ValueNode scale() {
+        return b();
+    }
+
+    public void setScale(ValueNode scale) {
+        setB(scale);
+    }
+
+    @Override
+    public LoopBeginNode loopBegin() {
+        return base().loopBegin();
+    }
+
+    @Override
+    public void peelOneIteration() {
+        // nop
+    }
+
+    /**
+     * This will apply strength reduction to this induction variable but will augment register pressure in the loop.
+     * @return the new BasicInductionVariable
+     */
+    public BasicInductionVariableNode toBasicInductionVariable() {
+        InductionVariableNode base = base();
+        if (base instanceof DerivedInductionVariableNode) {
+            base = ((DerivedInductionVariableNode) base).toBasicInductionVariable();
+        }
+        ValueNode init;
+        ValueNode stride;
+        LoopCounterNode counter;
+        if (base instanceof BasicInductionVariableNode) {
+            BasicInductionVariableNode basic = (BasicInductionVariableNode) base;
+            // let the canonicalizer do its job with this
+            init = IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), basic.init()));
+            stride = IntegerArithmeticNode.mul(scale(), basic.stride());
+            counter = basic.loopCounter();
+        } else {
+            assert base instanceof LoopCounterNode;
+            init = offset();
+            stride = scale();
+            counter = (LoopCounterNode) base;
+        }
+        BasicInductionVariableNode newBIV = new BasicInductionVariableNode(kind, init, stride, counter, graph());
+        this.replaceAndDelete(newBIV);
+        return newBIV;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LoweringOp.class) {
+            return (T) LOWERING;
+        }
+        return super.lookup(clazz);
+    }
+
+    private static final LoweringOp LOWERING = new LoweringOp() {
+        @Override
+        public void lower(Node n, CiLoweringTool tool) {
+            DerivedInductionVariableNode div = (DerivedInductionVariableNode) n;
+            IntegerArithmeticNode computed = IntegerArithmeticNode.add(div.offset(), IntegerArithmeticNode.mul(div.scale(), div.base()));
+            div.replaceAtNonIVUsages(computed);
+        }
+    };
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/InductionVariableNode.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/loop/InductionVariableNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,54 @@
+/*
+ * 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.loop;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+import com.oracle.max.graal.compiler.nodes.spi.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+public abstract class InductionVariableNode extends FloatingNode {
+
+    public InductionVariableNode(CiKind kind, Graph graph) {
+        super(kind, graph);
+        assert kind.isInt() || kind.isLong();
+    }
+
+    public abstract LoopBeginNode loopBegin();
+
+    public abstract void peelOneIteration();
+
+    public void replaceAtNonIVUsages(Node other) {
+        for (Node usage : this.usages().snapshot()) {
+            if (!(usage instanceof InductionVariableNode)) {
+                usage.replaceFirstInput(this, other);
+            }
+        }
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        // nop
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/LinearInductionVariableNode.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/loop/LinearInductionVariableNode.java	Wed Aug 10 00:34:29 2011 +0200
@@ -0,0 +1,64 @@
+/*
+ * 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.loop;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * InductionVariable of the form a+b*x.
+ */
+public abstract class LinearInductionVariableNode extends InductionVariableNode {
+    @Input private ValueNode a;
+    @Input private ValueNode b;
+
+    public LinearInductionVariableNode(CiKind kind, ValueNode a, ValueNode b, Graph graph) {
+        super(kind, graph);
+        setA(a);
+        setB(b);
+    }
+
+    protected ValueNode a() {
+        return a;
+    }
+
+    protected ValueNode b() {
+        return b;
+    }
+
+    protected void setA(ValueNode a) {
+        updateUsages(this.a, a);
+        this.a = a;
+    }
+
+
+    protected void setB(ValueNode b) {
+        updateUsages(this.b, b);
+        this.b = b;
+    }
+
+    public boolean isLinearInductionVariableInput(Node n) {
+        return n == a() || n == b();
+    }
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/LoopCounterNode.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/loop/LoopCounterNode.java	Wed Aug 10 00:34:29 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.loop;
+
+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.*;
+
+/**
+ * Counts loop iterations from 0 to Niter.
+ * If used directly (and not just by BasicInductionVariables) computed with Phi(0, this + 1)
+ */
+public final class LoopCounterNode extends InductionVariableNode {
+    @Input private LoopBeginNode loopBegin;
+
+    @Override
+    public LoopBeginNode loopBegin() {
+        return loopBegin;
+    }
+
+    public void setLoopBegin(LoopBeginNode x) {
+        updateUsages(loopBegin, x);
+        loopBegin = x;
+    }
+
+    public LoopCounterNode(CiKind kind, LoopBeginNode loop, Graph graph) {
+        super(kind, graph);
+        setLoopBegin(loop);
+    }
+
+    @Override
+    public void peelOneIteration() {
+        BasicInductionVariableNode biv = null;
+        for (Node usage : usages()) {
+            if (!(usage instanceof InductionVariableNode && ((InductionVariableNode) usage).loopBegin() == this.loopBegin())) {
+                if (biv == null) {
+                    biv = createBasicInductionVariable();
+                    biv.peelOneIteration();
+                }
+                usage.inputs().replace(this, biv);
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public  T lookup(Class clazz) {
+        if (clazz == LoweringOp.class) {
+            return (T) LOWERING;
+        }
+        return super.lookup(clazz);
+    }
+
+    private BasicInductionVariableNode createBasicInductionVariable() {
+        Graph graph = graph();
+        return new BasicInductionVariableNode(kind, ConstantNode.forInt(0, graph), ConstantNode.forInt(1, graph), this, graph);
+    }
+
+    private static final LoweringOp LOWERING = new LoweringOp() {
+        @Override
+        public void lower(Node n, CiLoweringTool tool) {
+            LoopCounterNode loopCounter = (LoopCounterNode) n;
+            Graph graph = n.graph();
+            PhiNode phi = BasicInductionVariableNode.LOWERING.ivToPhi(loopCounter.loopBegin(), ConstantNode.forInt(0, graph), ConstantNode.forInt(1, graph), loopCounter.kind);
+            loopCounter.replaceAtNonIVUsages(phi);
+        }
+    };
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeOp.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeOp.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeOp.java	Wed Aug 10 00:34:29 2011 +0200
@@ -24,8 +24,9 @@
 
 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.calc.*;
+import com.oracle.max.graal.compiler.nodes.java.*;
 import com.oracle.max.graal.graph.*;
 
 
@@ -34,20 +35,20 @@
     public abstract boolean canAnalyze(Node node);
 
     public boolean escape(Node node, Node usage) {
-        if (usage instanceof IsNonNull) {
-            IsNonNull x = (IsNonNull) usage;
+        if (usage instanceof IsNonNullNode) {
+            IsNonNullNode x = (IsNonNullNode) usage;
             assert x.object() == node;
             return false;
-        } else if (usage instanceof IsType) {
-            IsType x = (IsType) usage;
+        } else if (usage instanceof IsTypeNode) {
+            IsTypeNode x = (IsTypeNode) 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;
+        } else if (usage instanceof AccessMonitorNode) {
+            AccessMonitorNode x = (AccessMonitorNode) usage;
             assert x.object() == node;
             return false;
         } else {
@@ -58,17 +59,17 @@
     public abstract EscapeField[] fields(Node node);
 
     public void beforeUpdate(Node node, Node usage) {
-        if (usage instanceof IsNonNull) {
-            IsNonNull x = (IsNonNull) usage;
+        if (usage instanceof IsNonNullNode) {
+            IsNonNullNode x = (IsNonNullNode) usage;
             // TODO (ls) not sure about this...
-            x.replaceAndDelete(Constant.forBoolean(true, node.graph()));
-        } else if (usage instanceof IsType) {
-            IsType x = (IsType) usage;
+            x.replaceAndDelete(ConstantNode.forBoolean(true, node.graph()));
+        } else if (usage instanceof IsTypeNode) {
+            IsTypeNode x = (IsTypeNode) 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(ConstantNode.forBoolean(true, node.graph()));
+        } else if (usage instanceof AccessMonitorNode) {
+            AccessMonitorNode x = (AccessMonitorNode) usage;
             x.replaceAndDelete(x.next());
         }
     }
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ExceptionExit.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/ExceptionExit.java	Wed Aug 10 00:34:29 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.compiler.nodes.base.*;
+
+
+public interface ExceptionExit {
+    FixedNode exceptionEdge();
+}
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorTool.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorTool.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorTool.java	Wed Aug 10 00:34:29 2011 +0200
@@ -22,8 +22,8 @@
  */
 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.calc.*;
 import com.sun.cri.ci.*;
 
 public abstract class LIRGeneratorTool extends ValueVisitor {
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ValueVisitor.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ValueVisitor.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ValueVisitor.java	Wed Aug 10 00:34:29 2011 +0200
@@ -22,10 +22,10 @@
  */
 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.calc.*;
 import com.oracle.max.graal.compiler.nodes.extended.*;
+import com.oracle.max.graal.compiler.nodes.java.*;
 
 /**
  * The {@link ValueVisitor} implements one half of the visitor
@@ -34,48 +34,48 @@
  */
 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 visitArithmetic(ArithmeticNode i);
+    public abstract void visitArrayLength(ArrayLengthNode i);
+    public abstract void visitMerge(MergeNode i);
+    public abstract void visitCheckCast(CheckCastNode i);
+    public abstract void visitNormalizeCompare(NormalizeCompareNode i);
+    public abstract void visitConstant(ConstantNode i);
+    public abstract void visitConvert(ConvertNode i);
+    public abstract void visitConditional(ConditionalNode i);
+    public abstract void visitExceptionObject(ExceptionObjectNode 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 visitAnchor(AnchorNode i);
+    public abstract void visitIf(IfNode i);
+    public abstract void visitInvoke(InvokeNode i);
+    public abstract void visitLoadField(LoadFieldNode i);
+    public abstract void visitLoadIndexed(LoadIndexedNode i);
+    public abstract void visitLocal(LocalNode i);
+    public abstract void visitLogic(LogicNode i);
+    public abstract void visitLookupSwitch(LookupSwitchNode 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 visitMonitorAddress(MonitorAddressNode monitorAddress);
+    public abstract void visitMonitorEnter(MonitorEnterNode i);
+    public abstract void visitMonitorExit(MonitorExitNode i);
+    public abstract void visitNegate(NegateNode i);
+    public abstract void visitNewInstance(NewInstanceNode i);
+    public abstract void visitNewMultiArray(NewMultiArrayNode i);
+    public abstract void visitNewObjectArray(NewObjectArrayNode i);
+    public abstract void visitNewTypeArray(NewTypeArrayNode i);
+    public abstract void visitFixedGuard(FixedGuardNode fixedGuard);
+    public abstract void visitPhi(PhiNode i);
+    public abstract void visitRegisterFinalizer(RegisterFinalizerNode i);
+    public abstract void visitReturn(ReturnNode 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 visitDeoptimize(DeoptimizeNode deoptimize);
     public abstract void visitUnwind(UnwindNode unwind);
-    public abstract void visitLoopBegin(LoopBegin loopBegin);
-    public abstract void visitLoopEnd(LoopEnd loopEnd);
+    public abstract void visitLoopBegin(LoopBeginNode loopBegin);
+    public abstract void visitLoopEnd(LoopEndNode loopEnd);
     public abstract void visitValueAnchor(ValueAnchorNode valueAnchor);
     public abstract void visitGuardNode(GuardNode guardNode);
-    public abstract void visitMathIntrinsic(MathIntrinsic node);
+    public abstract void visitMathIntrinsic(MathIntrinsicNode node);
 }
diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/virtual/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/virtual/VirtualObjectFieldNode.java	Wed Aug 10 00:34:29 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.virtual;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.base.*;
+import com.oracle.max.graal.compiler.nodes.calc.*;
+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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/virtual/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/virtual/VirtualObjectNode.java	Wed Aug 10 00:34:29 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.virtual;
+
+import java.util.*;
+
+import com.oracle.max.graal.compiler.nodes.calc.*;
+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 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java	Tue Aug 09 23:56:10 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java	Wed Aug 10 00:34:29 2011 +0200
@@ -75,7 +75,7 @@
  *
  * 
  • * Add a field to optionally store an {@link com.oracle.max.graal.compiler.ir.Info} object for each HIR node, and remove the - * {@link com.oracle.max.graal.compiler.ir.FixedNodeWithNext#exceptionHandlers} field, the {@link com.oracle.max.graal.compiler.ir.FixedNodeWithNext#bci} field, and any fields to store the Java + * {@link com.oracle.max.graal.compiler.nodes.base.FixedWithNextNode#exceptionHandlers} field, the {@link com.oracle.max.graal.compiler.nodes.base.FixedWithNextNode#bci} field, and any fields to store the Java * frame state in subclasses. Benefit: saves space if most HIR nodes do not have exception handlers, a bci or Java frame * state. Removes virtual dispatch on accessing debug information for nodes. Allows any node, regardless of its type, to * have info attached.
  • @@ -113,7 +113,7 @@ *
  • * Tiered compilation support. C1 supported the ability to add instrumentation to branches, invocations, and checkcasts * in order to feed profile information to the C2 compiler in a tiered compilation setup. It relied on adding some - * information to the HIR nodes that represent these operations ({@link Invoke}, {@link CheckCast}, etc). All of this + * information to the HIR nodes that represent these operations ({@link InvokeNode}, {@link CheckCastNode}, etc). All of this * logic was removed to simplify both the front end and back end in anticipation of designing a future instrumentation * API. XIR should be general enough to allow instrumentation code to be added to invocation and checkcast sites, but * currently has no support for adding code at branches. diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ComputeProbabilityPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ComputeProbabilityPhase.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ComputeProbabilityPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -27,7 +27,7 @@ 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.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.graph.*; @@ -85,14 +85,14 @@ } public static class LoopInfo { - public final LoopBegin loopBegin; + public final LoopBeginNode loopBegin; public final Set requires = new HashSet(4); private double loopFrequency = -1; public boolean ended = false; - public LoopInfo(LoopBegin loopBegin) { + public LoopInfo(LoopBeginNode loopBegin) { this.loopBegin = loopBegin; } @@ -121,7 +121,7 @@ } public Set loopInfos = new HashSet(); - public Map> mergeLoops = new HashMap>(); + public Map> mergeLoops = new HashMap>(); private class Probability implements MergeableState { public double probability; @@ -142,7 +142,7 @@ } @Override - public boolean merge(Merge merge, Collection withStates) { + public boolean merge(MergeNode merge, Collection withStates) { if (merge.endCount() > 1) { HashSet intersection = new HashSet(loops); for (Probability other : withStates) { @@ -183,14 +183,14 @@ } @Override - public void loopBegin(LoopBegin loopBegin) { + public void loopBegin(LoopBeginNode loopBegin) { loopInfo = new LoopInfo(loopBegin); loopInfos.add(loopInfo); loops.add(loopInfo); } @Override - public void loopEnd(LoopEnd loopEnd, Probability loopEndState) { + public void loopEnd(LoopEndNode loopEnd, Probability loopEndState) { assert loopInfo != null; for (LoopInfo innerLoop : loopEndState.loops) { if (innerLoop != loopInfo && !loops.contains(innerLoop)) { @@ -204,14 +204,14 @@ public void afterSplit(FixedNode node) { assert node.predecessor() != null; Node pred = node.predecessor(); - if (pred instanceof Invoke) { - Invoke x = (Invoke) pred; + if (pred instanceof InvokeNode) { + InvokeNode x = (InvokeNode) pred; if (x.next() != node) { probability = 0; } } else { - assert pred instanceof ControlSplit; - ControlSplit x = (ControlSplit) pred; + assert pred instanceof ControlSplitNode; + ControlSplitNode x = (ControlSplitNode) pred; double sum = 0; for (int i = 0; i < x.blockSuccessorCount(); i++) { if (x.blockSuccessor(i) == node) { @@ -249,7 +249,7 @@ } @Override - public boolean merge(Merge merge, Collection withStates) { + public boolean merge(MergeNode merge, Collection withStates) { assert merge.endCount() == withStates.size() + 1; if (merge.endCount() > 1) { Set loops = mergeLoops.get(merge); @@ -265,12 +265,12 @@ } @Override - public void loopBegin(LoopBegin loopBegin) { + public void loopBegin(LoopBeginNode loopBegin) { count *= loopBegin.loopFrequency(); } @Override - public void loopEnd(LoopEnd loopEnd, LoopCount loopEndState) { + public void loopEnd(LoopEndNode loopEnd, LoopCount loopEndState) { // nothing to do... } diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -25,7 +25,8 @@ 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.ir.*; +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.graph.collections.*; @@ -47,8 +48,8 @@ deleteNodes(); // remove chained Merges - for (Merge merge : graph.getNodes(Merge.class)) { - if (merge.endCount() == 1 && !(merge instanceof LoopBegin)) { + for (MergeNode merge : graph.getNodes(MergeNode.class)) { + if (merge.endCount() == 1 && !(merge instanceof LoopBeginNode)) { replacePhis(merge); EndNode endNode = merge.endAt(0); FixedNode next = merge.next(); @@ -84,18 +85,18 @@ if (!flood.isMarked(node)) { if (node instanceof EndNode) { EndNode end = (EndNode) node; - Merge merge = end.merge(); + MergeNode merge = end.merge(); if (merge != null && flood.isMarked(merge)) { // We are a dead end node leading to a live merge. merge.removeEnd(end); } - } else if (node instanceof LoopEnd) { - LoopBegin loop = ((LoopEnd) node).loopBegin(); + } else if (node instanceof LoopEndNode) { + LoopBeginNode loop = ((LoopEndNode) node).loopBegin(); if (flood.isMarked(loop)) { if (GraalOptions.TraceDeadCodeElimination) { TTY.println("Removing loop with unreachable end: " + loop); } - ((LoopEnd) node).setLoopBegin(null); + ((LoopEndNode) node).setLoopBegin(null); EndNode endNode = loop.endAt(0); assert endNode.predecessor() != null; replacePhis(loop); @@ -111,10 +112,10 @@ } } - private void replacePhis(Merge merge) { + private void replacePhis(MergeNode merge) { for (Node usage : merge.usages().snapshot()) { - assert usage instanceof Phi; - usage.replaceAndDelete(((Phi) usage).valueAt(0)); + assert usage instanceof PhiNode; + usage.replaceAndDelete(((PhiNode) usage).valueAt(0)); } } @@ -133,7 +134,7 @@ private void iterateInputs() { for (Node node : graph.getNodes()) { - if (node instanceof Local) { + if (node instanceof LocalNode) { flood.add(node); } if (flood.isMarked(node)) { diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -28,11 +28,11 @@ import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.gen.*; 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.base.PhiNode.PhiType; +import com.oracle.max.graal.compiler.nodes.calc.*; import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.compiler.nodes.virtual.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.graph.*; @@ -51,7 +51,7 @@ this.virtualObject = virtualObject; this.virtualObjectField = null; for (int i = 0; i < fields.length; i++) { - fieldState[i] = Constant.defaultForKind(fields[i].kind(), virtualObject.graph()); + fieldState[i] = ConstantNode.defaultForKind(fields[i].kind(), virtualObject.graph()); virtualObjectField = new VirtualObjectFieldNode(virtualObject, virtualObjectField, fieldState[i], i, virtualObject.graph()); } } @@ -72,18 +72,18 @@ } @Override - public boolean merge(Merge merge, Collection withStates) { - Phi vobjPhi = null; - Phi[] valuePhis = new Phi[fieldState.length]; + public boolean merge(MergeNode merge, Collection withStates) { + PhiNode vobjPhi = null; + PhiNode[] valuePhis = new PhiNode[fieldState.length]; for (BlockExitState other : withStates) { if (virtualObjectField != other.virtualObjectField && vobjPhi == null) { - vobjPhi = new Phi(CiKind.Illegal, merge, PhiType.Virtual, virtualObject.graph()); + vobjPhi = new PhiNode(CiKind.Illegal, merge, PhiType.Virtual, virtualObject.graph()); vobjPhi.addInput(virtualObjectField); virtualObjectField = vobjPhi; } for (int i2 = 0; i2 < fieldState.length; i2++) { if (fieldState[i2] != other.fieldState[i2] && valuePhis[i2] == null) { - valuePhis[i2] = new Phi(fieldState[i2].kind, merge, PhiType.Value, virtualObject.graph()); + valuePhis[i2] = new PhiNode(fieldState[i2].kind, merge, PhiType.Value, virtualObject.graph()); valuePhis[i2].addInput(fieldState[i2]); fieldState[i2] = valuePhis[i2]; } @@ -110,13 +110,13 @@ } @Override - public void loopBegin(LoopBegin loopBegin) { - Phi vobjPhi = null; - vobjPhi = new Phi(CiKind.Illegal, loopBegin, PhiType.Virtual, virtualObject.graph()); + public void loopBegin(LoopBeginNode loopBegin) { + PhiNode vobjPhi = null; + vobjPhi = new PhiNode(CiKind.Illegal, loopBegin, PhiType.Virtual, virtualObject.graph()); vobjPhi.addInput(virtualObjectField); virtualObjectField = vobjPhi; for (int i2 = 0; i2 < fieldState.length; i2++) { - Phi valuePhi = new Phi(fieldState[i2].kind, loopBegin, PhiType.Value, virtualObject.graph()); + PhiNode valuePhi = new PhiNode(fieldState[i2].kind, loopBegin, PhiType.Value, virtualObject.graph()); valuePhi.addInput(fieldState[i2]); fieldState[i2] = valuePhi; updateField(i2); @@ -124,15 +124,15 @@ } @Override - public void loopEnd(LoopEnd x, BlockExitState loopEndState) { - while (!(virtualObjectField instanceof Phi)) { + public void loopEnd(LoopEndNode x, BlockExitState loopEndState) { + while (!(virtualObjectField instanceof PhiNode)) { virtualObjectField = ((VirtualObjectFieldNode) virtualObjectField).lastState(); } - ((Phi) virtualObjectField).addInput(loopEndState.virtualObjectField); - assert ((Phi) virtualObjectField).valueCount() == 2; + ((PhiNode) virtualObjectField).addInput(loopEndState.virtualObjectField); + assert ((PhiNode) virtualObjectField).valueCount() == 2; for (int i2 = 0; i2 < fieldState.length; i2++) { - ((Phi) fieldState[i2]).addInput(loopEndState.fieldState[i2]); - assert ((Phi) fieldState[i2]).valueCount() == 2; + ((PhiNode) fieldState[i2]).addInput(loopEndState.fieldState[i2]); + assert ((PhiNode) fieldState[i2]).valueCount() == 2; } } @@ -166,7 +166,7 @@ } public void removeAllocation() { - assert node instanceof FixedNodeWithNext; + assert node instanceof FixedWithNextNode; escapeFields = op.fields(node); for (int i = 0; i < escapeFields.length; i++) { @@ -177,7 +177,7 @@ TTY.println("new virtual object: " + virtual); } node.replaceAtUsages(virtual); - final FixedNode next = ((FixedNodeWithNext) node).next(); + final FixedNode next = ((FixedWithNextNode) node).next(); node.replaceAndDelete(next); final BlockExitState startState = new BlockExitState(escapeFields, virtual); @@ -219,7 +219,7 @@ EscapeOp op = node.lookup(EscapeOp.class); if (op != null && op.canAnalyze(node)) { Set exits = new HashSet(); - Set invokes = new HashSet(); + Set invokes = new HashSet(); int iterations = 0; int minimumWeight = GraalOptions.ForcedInlineEscapeWeight; @@ -283,15 +283,15 @@ } } - private double analyze(EscapeOp op, Node node, Collection exits, Collection invokes) { + private double analyze(EscapeOp op, Node node, Collection exits, Collection invokes) { double weight = 0; for (Node usage : node.usages()) { boolean escapes = op.escape(node, usage); if (escapes) { if (usage instanceof FrameState) { // nothing to do... - } else if (usage instanceof Invoke) { - invokes.add((Invoke) usage); + } else if (usage instanceof InvokeNode) { + invokes.add((InvokeNode) usage); } else { exits.add(usage); if (!GraalOptions.TraceEscapeAnalysis) { diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -35,11 +35,11 @@ import com.oracle.max.graal.compiler.graph.BlockMap.BranchOverride; import com.oracle.max.graal.compiler.graph.BlockMap.DeoptBlock; 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.base.DeoptimizeNode.DeoptAction; +import com.oracle.max.graal.compiler.nodes.calc.*; import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.java.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.compiler.util.LoopUtil.Loop; @@ -105,7 +105,7 @@ } }); - private FixedNodeWithNext lastInstr; // the last instruction added + private FixedWithNextNode lastInstr; // the last instruction added private final Set blocksOnWorklist = new HashSet(); private final Set blocksVisited = new HashSet(); @@ -175,20 +175,20 @@ } // 1. create the start block - Block startBlock = nextBlock(FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI); + Block startBlock = nextBlock(FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI); markOnWorkList(startBlock); - lastInstr = (FixedNodeWithNext) createTarget(startBlock, frameState); + lastInstr = (FixedWithNextNode) createTarget(startBlock, frameState); graph.start().setNext(lastInstr); if (isSynchronized(method.accessFlags())) { // 4A.1 add a monitor enter to the start block methodSynchronizedObject = synchronizedObject(frameState, method); - genMonitorEnter(methodSynchronizedObject, FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI); + genMonitorEnter(methodSynchronizedObject, FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI); } // 4B.1 simply finish the start block finishStartBlock(startBlock); - unwindHandler = new CiExceptionHandler(0, method.code().length, FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI, 0, null); + unwindHandler = new CiExceptionHandler(0, method.code().length, FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI, 0, null); // 5. SKIPPED: look for intrinsics @@ -204,8 +204,8 @@ // remove Placeholders for (Node n : graph.getNodes()) { - if (n instanceof Placeholder && !loopExits.isMarked(n)) { - Placeholder p = (Placeholder) n; + if (n instanceof PlaceholderNode && !loopExits.isMarked(n)) { + PlaceholderNode p = (PlaceholderNode) n; p.replaceAndDelete(p.next()); } } @@ -314,13 +314,13 @@ assert existingState.localsSize() == newState.localsSize(); assert existingState.stackSize() == newState.stackSize(); - if (first instanceof Placeholder) { - Placeholder p = (Placeholder) first; + if (first instanceof PlaceholderNode) { + PlaceholderNode p = (PlaceholderNode) first; if (p.predecessor() == null) { p.setStateAfter(newState.duplicate(bci)); return; } else { - Merge merge = new Merge(graph); + MergeNode merge = new MergeNode(graph); FixedNode next = p.next(); EndNode end = new EndNode(graph); p.setNext(end); @@ -328,18 +328,18 @@ merge.addEnd(end); merge.setStateAfter(existingState); p.setStateAfter(existingState.duplicate(bci)); - if (!(next instanceof LoopEnd)) { + if (!(next instanceof LoopEndNode)) { target.firstInstruction = merge; } first = merge; } } - existingState.merge((Merge) first, newState); + existingState.merge((MergeNode) first, newState); } } - private void insertLoopPhis(LoopBegin loopBegin, FrameState newState) { + private void insertLoopPhis(LoopBeginNode loopBegin, FrameState newState) { int stackSize = newState.stackSize(); for (int i = 0; i < stackSize; i++) { // always insert phis for the stack @@ -382,7 +382,7 @@ } private FixedNode handleException(ValueNode exceptionObject, int bci) { - assert bci == FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI || bci == bci() : "invalid bci"; + assert bci == FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI || bci == bci() : "invalid bci"; if (GraalOptions.UseExceptionProbability && method.invocationCount() > GraalOptions.MatureInvocationCount) { if (exceptionObject == null && method.exceptionProbability(bci) == 0) { @@ -423,19 +423,19 @@ if (dispatchBlock == null) { assert isCatchAll(firstHandler); int handlerBCI = firstHandler.handlerBCI(); - if (handlerBCI == FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI) { + if (handlerBCI == FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI) { dispatchBlock = unwindBlock(bci); } else { dispatchBlock = blockFromBci[handlerBCI]; } } - Placeholder p = new Placeholder(graph); + PlaceholderNode p = new PlaceholderNode(graph); p.setStateAfter(frameState.duplicateWithoutStack(bci)); ValueNode currentExceptionObject; - ExceptionObject newObj = null; + ExceptionObjectNode newObj = null; if (exceptionObject == null) { - newObj = new ExceptionObject(graph); + newObj = new ExceptionObjectNode(graph); currentExceptionObject = newObj; } else { currentExceptionObject = exceptionObject; @@ -446,7 +446,7 @@ } FixedNode target = createTarget(dispatchBlock, stateWithException); if (exceptionObject == null) { - ExceptionObject eObj = (ExceptionObject) currentExceptionObject; + ExceptionObjectNode eObj = (ExceptionObjectNode) currentExceptionObject; eObj.setNext(target); p.setNext(eObj); } else { @@ -465,10 +465,10 @@ RiType riType = (RiType) con; if (!riType.isResolved()) { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateRecompile, graph)); - frameState.push(CiKind.Object, append(Constant.forObject(null, graph))); + append(new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph)); + frameState.push(CiKind.Object, append(ConstantNode.forObject(null, graph))); } else { - frameState.push(CiKind.Object, append(new Constant(riType.getEncoding(Representation.JavaClass), graph))); + frameState.push(CiKind.Object, append(new ConstantNode(riType.getEncoding(Representation.JavaClass), graph))); } } else if (con instanceof CiConstant) { CiConstant constant = (CiConstant) con; @@ -481,8 +481,8 @@ private void genLoadIndexed(CiKind kind) { 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)); + ValueNode length = append(new ArrayLengthNode(array, graph)); + ValueNode v = append(new LoadIndexedNode(array, index, length, kind, graph)); frameState.push(kind.stackKind(), v); } @@ -490,7 +490,7 @@ ValueNode value = frameState.pop(kind.stackKind()); ValueNode index = frameState.ipop(); ValueNode array = frameState.apop(); - ValueNode length = append(new ArrayLength(array, graph)); + ValueNode length = append(new ArrayLengthNode(array, graph)); StoreIndexedNode result = new StoreIndexedNode(array, index, length, kind, value, graph); append(result); } @@ -584,28 +584,28 @@ ValueNode y = frameState.pop(result); ValueNode x = frameState.pop(result); boolean isStrictFP = isStrict(method.accessFlags()); - Arithmetic v; + ArithmeticNode v; switch(opcode){ case IADD: - case LADD: v = new IntegerAdd(result, x, y, graph); break; + case LADD: v = new IntegerAddNode(result, x, y, graph); break; case FADD: - case DADD: v = new FloatAdd(result, x, y, isStrictFP, graph); break; + case DADD: v = new FloatAddNode(result, x, y, isStrictFP, graph); break; case ISUB: - case LSUB: v = new IntegerSub(result, x, y, graph); break; + case LSUB: v = new IntegerSubNode(result, x, y, graph); break; case FSUB: - case DSUB: v = new FloatSub(result, x, y, isStrictFP, graph); break; + case DSUB: v = new FloatSubNode(result, x, y, isStrictFP, graph); break; case IMUL: - case LMUL: v = new IntegerMul(result, x, y, graph); break; + case LMUL: v = new IntegerMulNode(result, x, y, graph); break; case FMUL: - case DMUL: v = new FloatMul(result, x, y, isStrictFP, graph); break; + case DMUL: v = new FloatMulNode(result, x, y, isStrictFP, graph); break; case IDIV: - case LDIV: v = new IntegerDiv(result, x, y, graph); break; + case LDIV: v = new IntegerDivNode(result, x, y, graph); break; case FDIV: - case DDIV: v = new FloatDiv(result, x, y, isStrictFP, graph); break; + case DDIV: v = new FloatDivNode(result, x, y, isStrictFP, graph); break; case IREM: - case LREM: v = new IntegerRem(result, x, y, graph); break; + case LREM: v = new IntegerRemNode(result, x, y, graph); break; case FREM: - case DREM: v = new FloatRem(result, x, y, isStrictFP, graph); break; + case DREM: v = new FloatRemNode(result, x, y, isStrictFP, graph); break; default: throw new CiBailout("should not reach"); } @@ -617,7 +617,7 @@ } private void genNegateOp(CiKind kind) { - frameState.push(kind, append(new Negate(frameState.pop(kind), graph))); + frameState.push(kind, append(new NegateNode(frameState.pop(kind), graph))); } private void genShiftOp(CiKind kind, int opcode) { @@ -626,9 +626,9 @@ ShiftNode v; switch(opcode){ case ISHL: - case LSHL: v = new LeftShift(kind, x, s, graph); break; + case LSHL: v = new LeftShiftNode(kind, x, s, graph); break; case ISHR: - case LSHR: v = new RightShift(kind, x, s, graph); break; + case LSHR: v = new RightShiftNode(kind, x, s, graph); break; case IUSHR: case LUSHR: v = new UnsignedRightShiftNode(kind, x, s, graph); break; default: @@ -640,12 +640,12 @@ private void genLogicOp(CiKind kind, int opcode) { ValueNode y = frameState.pop(kind); ValueNode x = frameState.pop(kind); - Logic v; + LogicNode v; switch(opcode){ case IAND: - case LAND: v = new And(kind, x, y, graph); break; + case LAND: v = new AndNode(kind, x, y, graph); break; case IOR: - case LOR: v = new Or(kind, x, y, graph); break; + case LOR: v = new OrNode(kind, x, y, graph); break; case IXOR: case LXOR: v = new XorNode(kind, x, y, graph); break; default: @@ -657,7 +657,7 @@ private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { ValueNode y = frameState.pop(kind); ValueNode x = frameState.pop(kind); - ValueNode value = append(new NormalizeCompare(opcode, resultKind, x, y, graph)); + ValueNode value = append(new NormalizeCompareNode(opcode, resultKind, x, y, graph)); if (!resultKind.isVoid()) { frameState.ipush(value); } @@ -665,15 +665,15 @@ private void genConvert(int opcode, CiKind from, CiKind to) { CiKind tt = to.stackKind(); - frameState.push(tt, append(new Convert(opcode, frameState.pop(from.stackKind()), tt, graph))); + frameState.push(tt, append(new ConvertNode(opcode, frameState.pop(from.stackKind()), tt, graph))); } private void genIncrement() { int index = stream().readLocalIndex(); int delta = stream().readIncrement(); ValueNode x = frameState.localAt(index); - ValueNode y = append(Constant.forInt(delta, graph)); - frameState.storeLocal(index, append(new IntegerAdd(CiKind.Int, x, y, graph))); + ValueNode y = append(ConstantNode.forInt(delta, graph)); + frameState.storeLocal(index, append(new IntegerAddNode(CiKind.Int, x, y, graph))); } private void genGoto(int fromBCI, int toBCI) { @@ -690,7 +690,7 @@ probability = 0.5; } - If ifNode = new If(new Compare(x, cond, y, graph), probability, graph); + IfNode ifNode = new IfNode(new CompareNode(x, cond, y, graph), probability, graph); append(ifNode); BlockMap.BranchOverride override = branchOverride.get(bci()); FixedNode tsucc; @@ -730,7 +730,7 @@ private void genThrow(int bci) { ValueNode exception = frameState.apop(); - FixedGuard node = new FixedGuard(new IsNonNull(exception, graph), graph); + FixedGuardNode node = new FixedGuardNode(new IsNonNullNode(exception, graph), graph); append(node); FixedNode entry = handleException(exception, bci); @@ -744,7 +744,7 @@ private void genCheckCast() { int cpi = stream().readCPI(); RiType type = constantPool.lookupType(cpi, CHECKCAST); - Constant typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type.isResolved()); + ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type.isResolved()); ValueNode object = frameState.apop(); if (typeInstruction != null) { // InstanceOf instanceOf = new InstanceOf(typeInstruction, object, true, graph); @@ -753,7 +753,7 @@ // CastNode castNode = new CastNode(object.kind, object, graph); // castNode.inputs().add(fixedGuard); // frameState.apush(castNode); - frameState.apush(new CheckCast(typeInstruction, object, graph)); + frameState.apush(new CheckCastNode(typeInstruction, object, graph)); } else { frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } @@ -762,10 +762,10 @@ private void genInstanceOf() { int cpi = stream().readCPI(); RiType type = constantPool.lookupType(cpi, INSTANCEOF); - Constant typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type.isResolved()); + ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type.isResolved()); ValueNode object = frameState.apop(); if (typeInstruction != null) { - frameState.ipush(append(new MaterializeNode(new InstanceOf(typeInstruction, object, false, graph), graph))); + frameState.ipush(append(new MaterializeNode(new InstanceOfNode(typeInstruction, object, false, graph), graph))); } else { frameState.ipush(appendConstant(CiConstant.INT_0)); } @@ -774,11 +774,11 @@ void genNewInstance(int cpi) { RiType type = constantPool.lookupType(cpi, NEW); if (type.isResolved()) { - NewInstance n = new NewInstance(type, cpi, constantPool, graph); + NewInstanceNode n = new NewInstanceNode(type, cpi, constantPool, graph); frameState.apush(append(n)); } else { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateRecompile, graph)); + append(new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph)); frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } } @@ -786,7 +786,7 @@ private void genNewTypeArray(int typeCode) { CiKind kind = CiKind.fromArrayTypeCode(typeCode); RiType elementType = runtime.asRiType(kind); - NewTypeArray nta = new NewTypeArray(frameState.ipop(), elementType, graph); + NewTypeArrayNode nta = new NewTypeArrayNode(frameState.ipop(), elementType, graph); frameState.apush(append(nta)); } @@ -794,11 +794,11 @@ RiType type = constantPool.lookupType(cpi, ANEWARRAY); ValueNode length = frameState.ipop(); if (type.isResolved()) { - NewArray n = new NewObjectArray(type, length, graph); + NewArrayNode n = new NewObjectArrayNode(type, length, graph); frameState.apush(append(n)); } else { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateRecompile, graph)); + append(new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph)); frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } @@ -812,11 +812,11 @@ dims[i] = frameState.ipop(); } if (type.isResolved()) { - NewArray n = new NewMultiArray(type, dims, cpi, constantPool, graph); + NewArrayNode n = new NewMultiArrayNode(type, dims, cpi, constantPool, graph); frameState.apush(append(n)); } else { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateRecompile, graph)); + append(new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph)); frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } } @@ -825,12 +825,12 @@ CiKind kind = field.kind(); ValueNode receiver = frameState.apop(); if (field.isResolved() && field.holder().isInitialized()) { - LoadField load = new LoadField(receiver, field, graph); + LoadFieldNode load = new LoadFieldNode(receiver, field, graph); appendOptimizedLoadField(kind, load); } else { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateRecompile, graph)); - frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph))); + append(new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph)); + frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, graph))); } } @@ -842,7 +842,7 @@ appendOptimizedStoreField(store); } else { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateRecompile, graph)); + append(new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph)); } } @@ -859,11 +859,11 @@ ValueNode container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized); CiKind kind = field.kind(); if (container != null) { - LoadField load = new LoadField(container, field, graph); + LoadFieldNode load = new LoadFieldNode(container, field, graph); appendOptimizedLoadField(kind, load); } else { // deopt will be generated by genTypeOrDeopt, not needed here - frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph))); + frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, graph))); } } } @@ -880,12 +880,12 @@ } } - private Constant genTypeOrDeopt(RiType.Representation representation, RiType holder, boolean initialized) { + private ConstantNode genTypeOrDeopt(RiType.Representation representation, RiType holder, boolean initialized) { if (initialized) { return appendConstant(holder.getEncoding(representation)); } else { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateRecompile, graph)); + append(new DeoptimizeNode(DeoptAction.InvalidateRecompile, graph)); return null; } } @@ -894,7 +894,7 @@ append(store); } - private void appendOptimizedLoadField(CiKind kind, LoadField load) { + private void appendOptimizedLoadField(CiKind kind, LoadFieldNode load) { // append the load to the instruction ValueNode optimized = append(load); frameState.push(kind.stackKind(), optimized); @@ -969,12 +969,12 @@ CiKind resultType = returnKind(target); if (GraalOptions.DeoptALot) { storeResultGraph = false; - Deoptimize deoptimize = new Deoptimize(DeoptAction.None, graph); + DeoptimizeNode deoptimize = new DeoptimizeNode(DeoptAction.None, graph); deoptimize.setMessage("invoke " + target.name()); append(deoptimize); - frameState.pushReturn(resultType, Constant.defaultForKind(resultType, graph)); + frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, graph)); } else { - Invoke invoke = new Invoke(bci(), opcode, resultType.stackKind(), args, target, target.signature().returnType(method.holder()), graph); + InvokeNode invoke = new InvokeNode(bci(), opcode, resultType.stackKind(), args, target, target.signature().returnType(method.holder()), graph); ValueNode result = appendWithBCI(invoke); invoke.setExceptionEdge(handleException(null, bci())); // if (invoke.exceptionEdge() == null) { @@ -1003,7 +1003,7 @@ private void callRegisterFinalizer() { // append a call to the finalizer registration - append(new RegisterFinalizer(frameState.loadLocal(0), graph)); + append(new RegisterFinalizerNode(frameState.loadLocal(0), graph)); } private void genReturn(ValueNode x) { @@ -1016,15 +1016,15 @@ private void genMonitorEnter(ValueNode x, int bci) { int lockNumber = frameState.locksSize(); - MonitorAddress lockAddress = null; + MonitorAddressNode lockAddress = null; if (runtime.sizeOfBasicObjectLock() != 0) { - lockAddress = new MonitorAddress(lockNumber, graph); + lockAddress = new MonitorAddressNode(lockNumber, graph); append(lockAddress); } - MonitorEnter monitorEnter = new MonitorEnter(x, lockAddress, lockNumber, graph); + MonitorEnterNode monitorEnter = new MonitorEnterNode(x, lockAddress, lockNumber, graph); appendWithBCI(monitorEnter); frameState.lock(x); - if (bci == FixedNodeWithNext.SYNCHRONIZATION_ENTRY_BCI) { + if (bci == FixedWithNextNode.SYNCHRONIZATION_ENTRY_BCI) { monitorEnter.setStateAfter(frameState.create(0)); } } @@ -1034,12 +1034,12 @@ if (lockNumber < 0) { throw new CiBailout("monitor stack underflow"); } - MonitorAddress lockAddress = null; + MonitorAddressNode lockAddress = null; if (runtime.sizeOfBasicObjectLock() != 0) { - lockAddress = new MonitorAddress(lockNumber, graph); + lockAddress = new MonitorAddressNode(lockNumber, graph); append(lockAddress); } - appendWithBCI(new MonitorExit(x, lockAddress, lockNumber, graph)); + appendWithBCI(new MonitorExitNode(x, lockAddress, lockNumber, graph)); frameState.unlock(); } @@ -1056,7 +1056,7 @@ ValueNode value = frameState.ipop(); BytecodeTableSwitch ts = new BytecodeTableSwitch(stream(), bci); int max = ts.numberOfCases(); - List list = new ArrayList(max + 1); + List list = new ArrayList(max + 1); List offsetList = new ArrayList(max + 1); for (int i = 0; i < max; i++) { // add all successors to the successor list @@ -1095,7 +1095,7 @@ ValueNode value = frameState.ipop(); BytecodeLookupSwitch ls = new BytecodeLookupSwitch(stream(), bci); int max = ls.numberOfCases(); - List list = new ArrayList(max + 1); + List list = new ArrayList(max + 1); List offsetList = new ArrayList(max + 1); int[] keys = new int[max]; for (int i = 0; i < max; i++) { @@ -1108,22 +1108,22 @@ int offset = ls.defaultOffset(); list.add(null); offsetList.add(offset); - LookupSwitch lookupSwitch = new LookupSwitch(value, list, keys, switchProbability(list.size(), bci), graph); + LookupSwitchNode lookupSwitch = new LookupSwitchNode(value, list, keys, switchProbability(list.size(), bci), graph); for (int i = 0; i < offsetList.size(); ++i) { lookupSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState)); } append(lookupSwitch); } - private Constant appendConstant(CiConstant constant) { - return new Constant(constant, graph); + private ConstantNode appendConstant(CiConstant constant) { + return new ConstantNode(constant, graph); } private ValueNode append(FixedNode fixed) { - if (fixed instanceof Deoptimize && lastInstr.predecessor() != null) { + if (fixed instanceof DeoptimizeNode && lastInstr.predecessor() != null) { Node cur = lastInstr; Node prev = cur; - while (cur != cur.graph().start() && !(cur instanceof ControlSplit)) { + while (cur != cur.graph().start() && !(cur instanceof ControlSplitNode)) { assert cur.predecessor() != null; prev = cur; cur = cur.predecessor(); @@ -1131,18 +1131,18 @@ break; } - if (cur instanceof ExceptionObject) { + if (cur instanceof ExceptionObjectNode) { break; } } - if (cur instanceof If) { - If ifNode = (If) cur; + if (cur instanceof IfNode) { + IfNode ifNode = (IfNode) cur; if (ifNode.falseSuccessor() == prev) { FixedNode successor = ifNode.trueSuccessor(); ifNode.setTrueSuccessor(null); BooleanNode condition = ifNode.compare(); - FixedGuard fixedGuard = new FixedGuard(condition, graph); + FixedGuardNode fixedGuard = new FixedGuardNode(condition, graph); fixedGuard.setNext(successor); ifNode.replaceAndDelete(fixedGuard); lastInstr = null; @@ -1159,7 +1159,7 @@ return fixed; } - private ValueNode append(FixedNodeWithNext x) { + private ValueNode append(FixedWithNextNode x) { return appendWithBCI(x); } @@ -1167,7 +1167,7 @@ return v; } - private ValueNode appendWithBCI(FixedNodeWithNext x) { + private ValueNode appendWithBCI(FixedWithNextNode 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); @@ -1190,18 +1190,18 @@ if (block.firstInstruction == null) { if (block.isLoopHeader) { - LoopBegin loopBegin = new LoopBegin(graph); + LoopBeginNode loopBegin = new LoopBeginNode(graph); loopBegin.addEnd(new EndNode(graph)); - LoopEnd loopEnd = new LoopEnd(graph); + LoopEndNode loopEnd = new LoopEndNode(graph); loopEnd.setLoopBegin(loopBegin); - Placeholder pBegin = new Placeholder(graph); + PlaceholderNode pBegin = new PlaceholderNode(graph); pBegin.setNext(loopBegin.forwardEdge()); - Placeholder pEnd = new Placeholder(graph); + PlaceholderNode pEnd = new PlaceholderNode(graph); pEnd.setNext(loopEnd); loopBegin.setStateAfter(stateAfter.duplicate(block.startBci)); block.firstInstruction = pBegin; } else { - block.firstInstruction = new Placeholder(graph); + block.firstInstruction = new PlaceholderNode(graph); } } mergeOrClone(block, stateAfter); @@ -1214,15 +1214,15 @@ result = block.firstInstruction; } - assert result instanceof Merge || result instanceof Placeholder : result; + assert result instanceof MergeNode || result instanceof PlaceholderNode : result; - if (result instanceof Merge) { - if (result instanceof LoopBegin) { - result = ((LoopBegin) result).forwardEdge(); + if (result instanceof MergeNode) { + if (result instanceof LoopBeginNode) { + result = ((LoopBeginNode) result).forwardEdge(); } else { EndNode end = new EndNode(graph); - ((Merge) result).addEnd(end); - Placeholder p = new Placeholder(graph); + ((MergeNode) result).addEnd(end); + PlaceholderNode p = new PlaceholderNode(graph); int bci = block.startBci; if (block instanceof ExceptionBlock) { bci = ((ExceptionBlock) block).deoptBci; @@ -1232,13 +1232,13 @@ result = p; } } - assert !(result instanceof LoopBegin || result instanceof Merge); + assert !(result instanceof LoopBeginNode || result instanceof MergeNode); return result; } private ValueNode synchronizedObject(FrameStateAccess state, RiMethod target) { if (isStatic(target.accessFlags())) { - Constant classConstant = new Constant(target.holder().getEncoding(Representation.JavaClass), graph); + ConstantNode classConstant = new ConstantNode(target.holder().getEncoding(Representation.JavaClass), graph); return append(classConstant); } else { return state.localAt(0); @@ -1259,7 +1259,7 @@ markVisited(block); // now parse the block if (block.isLoopHeader) { - LoopBegin begin = loopBegin(block); + LoopBeginNode begin = loopBegin(block); FrameState preLoopState = ((StateSplit) block.firstInstruction).stateAfter(); assert preLoopState != null; FrameState duplicate = preLoopState.duplicate(preLoopState.bci); @@ -1288,8 +1288,8 @@ } for (Block b : blocksVisited) { if (b.isLoopHeader) { - LoopBegin begin = loopBegin(b); - LoopEnd loopEnd = begin.loopEnd(); + LoopBeginNode begin = loopBegin(b); + LoopEndNode loopEnd = begin.loopEnd(); StateSplit loopEndPred = (StateSplit) loopEnd.predecessor(); // This can happen with degenerated loops like this one: @@ -1306,7 +1306,7 @@ } else { loopEndPred.delete(); loopEnd.delete(); - Merge merge = new Merge(graph); + MergeNode merge = new MergeNode(graph); merge.addEnd(begin.forwardEdge()); FixedNode next = begin.next(); begin.setNext(null); @@ -1318,15 +1318,15 @@ } } - private static LoopBegin loopBegin(Block block) { + private static LoopBeginNode loopBegin(Block block) { EndNode endNode = (EndNode) block.firstInstruction.next(); - LoopBegin loopBegin = (LoopBegin) endNode.merge(); + LoopBeginNode loopBegin = (LoopBeginNode) endNode.merge(); return loopBegin; } private void createDeoptBlock(DeoptBlock block) { storeResultGraph = false; - append(new Deoptimize(DeoptAction.InvalidateReprofile, graph)); + append(new DeoptimizeNode(DeoptAction.InvalidateReprofile, graph)); } private void createUnwindBlock(Block block) { @@ -1349,7 +1349,7 @@ if (Modifier.isSynchronized(method.accessFlags())) { genMonitorExit(methodSynchronizedObject); } - Return returnNode = new Return(x, graph); + ReturnNode returnNode = new ReturnNode(x, graph); graph.setReturn(returnNode); append(returnNode); } @@ -1365,12 +1365,12 @@ RiType catchType = block.handler.catchType(); - Constant typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, catchType, catchType.isResolved()); + ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, catchType, catchType.isResolved()); if (typeInstruction != null) { FixedNode catchSuccessor = createTarget(blockFromBci[block.handler.handlerBCI()], frameState); FixedNode nextDispatch = createTarget(nextBlock, frameState); ValueNode exception = frameState.stackAt(0); - If ifNode = new If(new InstanceOf(typeInstruction, exception, false, graph), 0.5, graph); + IfNode ifNode = new IfNode(new InstanceOfNode(typeInstruction, exception, false, graph), 0.5, graph); append(ifNode); ifNode.setTrueSuccessor(catchSuccessor); ifNode.setFalseSuccessor(nextDispatch); @@ -1670,7 +1670,7 @@ } private void genArrayLength() { - frameState.ipush(append(new ArrayLength(frameState.apop(), graph))); + frameState.ipush(append(new ArrayLengthNode(frameState.apop(), graph))); } /** diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -28,10 +28,10 @@ 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.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.extended.*; +import com.oracle.max.graal.compiler.nodes.base.DeoptimizeNode.DeoptAction; +import com.oracle.max.graal.compiler.nodes.calc.*; +import com.oracle.max.graal.compiler.nodes.java.*; import com.oracle.max.graal.extensions.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; @@ -53,15 +53,15 @@ private final IR ir; private int inliningSize; - private final Collection hints; + private final Collection hints; - public InliningPhase(GraalCompilation compilation, IR ir, Collection hints) { + public InliningPhase(GraalCompilation compilation, IR ir, Collection hints) { this.compilation = compilation; this.ir = ir; this.hints = hints; } - private Queue newInvokes = new ArrayDeque(); + private Queue newInvokes = new ArrayDeque(); private CompilerGraph graph; @Override @@ -74,15 +74,15 @@ if (hints != null) { newInvokes.addAll(hints); } else { - for (Invoke invoke : graph.getNodes(Invoke.class)) { + for (InvokeNode invoke : graph.getNodes(InvokeNode.class)) { newInvokes.add(invoke); } } for (int iterations = 0; iterations < MAX_ITERATIONS; iterations++) { - Queue queue = newInvokes; - newInvokes = new ArrayDeque(); - for (Invoke invoke : queue) { + Queue queue = newInvokes; + newInvokes = new ArrayDeque(); + for (InvokeNode invoke : queue) { if (!invoke.isDeleted()) { if (GraalOptions.Meter) { GraalMetrics.InlineConsidered++; @@ -136,7 +136,7 @@ } } - private RiMethod inlineInvoke(Invoke invoke, int iterations, float ratio) { + private RiMethod inlineInvoke(InvokeNode invoke, int iterations, float ratio) { RiMethod parent = invoke.stateAfter().method(); RiTypeProfile profile = parent.typeProfile(invoke.bci); if (GraalOptions.Intrinsify) { @@ -195,8 +195,8 @@ // type check and inlining... concrete = profile.types[0].resolveMethodImpl(invoke.target); if (concrete != null && checkTargetConditions(concrete, iterations) && checkSizeConditions(parent, iterations, concrete, invoke, profile, ratio)) { - IsType isType = new IsType(invoke.receiver(), profile.types[0], compilation.graph); - FixedGuard guard = new FixedGuard(isType, graph); + IsTypeNode isType = new IsTypeNode(invoke.receiver(), profile.types[0], compilation.graph); + FixedGuardNode guard = new FixedGuardNode(isType, graph); assert invoke.predecessor() != null; invoke.predecessor().replaceFirstSuccessor(invoke, guard); guard.setNext(invoke); @@ -225,7 +225,7 @@ return CiUtil.format("%H.%n(%p):%r", method, false) + " (" + method.codeSize() + " bytes)"; } - private String methodName(RiMethod method, Invoke invoke) { + private String methodName(RiMethod method, InvokeNode invoke) { if (invoke != null) { RiMethod parent = invoke.stateAfter().method(); return parent.name() + "@" + invoke.bci + ": " + CiUtil.format("%H.%n(%p):%r", method, false) + " (" + method.codeSize() + " bytes)"; @@ -234,7 +234,7 @@ } } - private boolean checkInvokeConditions(Invoke invoke) { + private boolean checkInvokeConditions(InvokeNode invoke) { if (!invoke.canInline()) { if (GraalOptions.TraceInlining) { TTY.println("not inlining %s because the invoke is manually set to be non-inlinable", methodName(invoke.target, invoke)); @@ -301,7 +301,7 @@ return true; } - private boolean checkStaticSizeConditions(RiMethod method, Invoke invoke) { + private boolean checkStaticSizeConditions(RiMethod method, InvokeNode invoke) { int maximumSize = GraalOptions.MaximumInlineSize; if (hints != null && hints.contains(invoke)) { maximumSize = GraalOptions.MaximumFreqInlineSize; @@ -315,7 +315,7 @@ return true; } - private boolean checkSizeConditions(RiMethod caller, int iterations, RiMethod method, Invoke invoke, RiTypeProfile profile, float adjustedRatio) { + private boolean checkSizeConditions(RiMethod caller, int iterations, RiMethod method, InvokeNode invoke, RiTypeProfile profile, float adjustedRatio) { int maximumSize = GraalOptions.MaximumTrivialSize; int maximumCompiledSize = GraalOptions.MaximumTrivialCompSize; double ratio = 0; @@ -424,12 +424,12 @@ return null; } - private void inlineMethod(Invoke invoke, RiMethod method) { + private void inlineMethod(InvokeNode invoke, RiMethod method) { RiMethod parent = invoke.stateAfter().method(); FrameState stateAfter = invoke.stateAfter(); FixedNode exceptionEdge = invoke.exceptionEdge(); - if (exceptionEdge instanceof Placeholder) { - exceptionEdge = ((Placeholder) exceptionEdge).next(); + if (exceptionEdge instanceof PlaceholderNode) { + exceptionEdge = ((PlaceholderNode) exceptionEdge).next(); } boolean withReceiver = !invoke.isStatic(); @@ -484,18 +484,18 @@ HashMap replacements = new HashMap(); ArrayList nodes = new ArrayList(); ArrayList frameStates = new ArrayList(); - Return returnNode = null; + ReturnNode returnNode = null; UnwindNode unwindNode = null; StartNode startNode = graph.start(); for (Node node : graph.getNodes()) { if (node instanceof StartNode) { assert startNode == node; - } else if (node instanceof Local) { - replacements.put(node, parameters[((Local) node).index()]); + } else if (node instanceof LocalNode) { + replacements.put(node, parameters[((LocalNode) node).index()]); } else { nodes.add(node); - if (node instanceof Return) { - returnNode = (Return) node; + if (node instanceof ReturnNode) { + returnNode = (ReturnNode) node; } else if (node instanceof UnwindNode) { unwindNode = (UnwindNode) node; } else if (node instanceof FrameState) { @@ -510,11 +510,11 @@ assert invoke.successors().first() != null : invoke; assert invoke.predecessor() != null; - FixedNodeWithNext pred; + FixedWithNextNode pred; if (withReceiver) { - pred = new FixedGuard(new IsNonNull(parameters[0], compilation.graph), compilation.graph); + pred = new FixedGuardNode(new IsNonNullNode(parameters[0], compilation.graph), compilation.graph); } else { - pred = new Placeholder(compilation.graph); + pred = new PlaceholderNode(compilation.graph); } invoke.replaceAtPredecessors(pred); replacements.put(startNode, pred); @@ -530,8 +530,8 @@ fixed.setProbability(fixed.probability() * invokeProbability); } } - if (node instanceof Invoke && ((Invoke) node).canInline()) { - newInvokes.add((Invoke) node); + if (node instanceof InvokeNode && ((InvokeNode) node).canInline()) { + newInvokes.add((InvokeNode) node); } else if (node instanceof FrameState) { FrameState frameState = (FrameState) node; if (frameState.bci == FrameState.BEFORE_BCI) { @@ -548,22 +548,22 @@ int monitorIndexDelta = stateAfter.locksSize(); if (monitorIndexDelta > 0) { for (Map.Entry entry : duplicates.entrySet()) { - if (entry.getValue() instanceof MonitorAddress) { - MonitorAddress address = (MonitorAddress) entry.getValue(); + if (entry.getValue() instanceof MonitorAddressNode) { + MonitorAddressNode address = (MonitorAddressNode) entry.getValue(); address.setMonitorIndex(address.monitorIndex() + monitorIndexDelta); } } } - if (pred instanceof Placeholder) { - FixedNode next = ((Placeholder) pred).next(); - ((Placeholder) pred).setNext(null); + if (pred instanceof PlaceholderNode) { + FixedNode next = ((PlaceholderNode) pred).next(); + ((PlaceholderNode) pred).setNext(null); pred.replaceAndDelete(next); } if (returnNode != null) { for (Node usage : invoke.usages().snapshot()) { - if (returnNode.result() instanceof Local) { + if (returnNode.result() instanceof LocalNode) { usage.replaceFirstInput(invoke, replacements.get(returnNode.result())); } else { usage.replaceFirstInput(invoke, duplicates.get(returnNode.result())); @@ -580,7 +580,7 @@ if (unwindNode != null) { assert unwindNode.predecessor() != null; assert exceptionEdge.successors().explicitCount() == 1; - ExceptionObject obj = (ExceptionObject) exceptionEdge; + ExceptionObjectNode obj = (ExceptionObjectNode) exceptionEdge; UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); for (Node usage : obj.usages().snapshot()) { @@ -594,7 +594,7 @@ } else { if (unwindNode != null) { UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); - unwindDuplicate.replaceAndDelete(new Deoptimize(DeoptAction.InvalidateRecompile, compilation.graph)); + unwindDuplicate.replaceAndDelete(new DeoptimizeNode(DeoptAction.InvalidateRecompile, compilation.graph)); } } diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoopPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -25,8 +25,9 @@ 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.compiler.nodes.calc.*; +import com.oracle.max.graal.compiler.nodes.loop.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.compiler.util.LoopUtil.Loop; @@ -55,14 +56,14 @@ continue; } boolean canInvert = false; - if (GraalOptions.LoopInversion && loop.loopBegin().next() instanceof If) { - If ifNode = (If) loop.loopBegin().next(); + if (GraalOptions.LoopInversion && loop.loopBegin().next() instanceof IfNode) { + IfNode ifNode = (IfNode) loop.loopBegin().next(); if (loop.exits().isMarked(ifNode.trueSuccessor()) || loop.exits().isMarked(ifNode.falseSuccessor())) { canInvert = true; } } if (canInvert) { - LoopUtil.inverseLoop(loop, (If) loop.loopBegin().next()); + LoopUtil.inverseLoop(loop, (IfNode) loop.loopBegin().next()); } else if (GraalOptions.LoopPeeling) { GraalCompilation compilation = GraalCompilation.compilation(); if (compilation.compiler.isObserved()) { @@ -84,21 +85,21 @@ } private void findInductionVariables(Loop loop) { - LoopBegin loopBegin = loop.loopBegin(); + LoopBeginNode loopBegin = loop.loopBegin(); NodeBitMap loopNodes = loop.nodes(); - List phis = new ArrayList(loopBegin.phis()); + List phis = new ArrayList(loopBegin.phis()); int backIndex = loopBegin.phiPredecessorIndex(loopBegin.loopEnd()); int initIndex = loopBegin.phiPredecessorIndex(loopBegin.forwardEdge()); - for (Phi phi : phis) { + for (PhiNode phi : phis) { ValueNode init = phi.valueAt(initIndex); ValueNode backEdge = phi.valueAt(backIndex); if (loopNodes.isNew(init) || loopNodes.isNew(backEdge)) { continue; } if (loopNodes.isMarked(backEdge)) { - Binary binary; - if (backEdge instanceof IntegerAdd || backEdge instanceof IntegerSub) { - binary = (Binary) backEdge; + BinaryNode binary; + if (backEdge instanceof IntegerAddNode || backEdge instanceof IntegerSubNode) { + binary = (BinaryNode) backEdge; } else { continue; } @@ -112,22 +113,22 @@ } if (loopNodes.isNotNewNotMarked(stride)) { Graph graph = loopBegin.graph(); - if (backEdge instanceof IntegerSub) { - stride = new Negate(stride, graph); + if (backEdge instanceof IntegerSubNode) { + stride = new NegateNode(stride, graph); } CiKind kind = phi.kind; - LoopCounter counter = loopBegin.loopCounter(kind); - BasicInductionVariable biv1 = null; - BasicInductionVariable biv2 = null; + LoopCounterNode counter = loopBegin.loopCounter(kind); + BasicInductionVariableNode biv1 = null; + BasicInductionVariableNode biv2 = null; if (phi.usages().size() > 1) { - biv1 = new BasicInductionVariable(kind, init, stride, counter, graph); + biv1 = new BasicInductionVariableNode(kind, init, stride, counter, graph); phi.replaceAndDelete(biv1); } else { phi.replaceFirstInput(binary, null); phi.delete(); } if (backEdge.usages().size() > 0) { - biv2 = new BasicInductionVariable(kind, IntegerArithmeticNode.add(init, stride), stride, counter, graph); + biv2 = new BasicInductionVariableNode(kind, IntegerArithmeticNode.add(init, stride), stride, counter, graph); backEdge.replaceAndDelete(biv2); } else { backEdge.delete(); @@ -142,14 +143,14 @@ } } } - private void findDerivedInductionVariable(BasicInductionVariable biv, CiKind kind, NodeBitMap loopNodes) { + private void findDerivedInductionVariable(BasicInductionVariableNode biv, CiKind kind, NodeBitMap loopNodes) { for (Node usage : biv.usages().snapshot()) { ValueNode scale = scale(usage, biv, loopNodes); ValueNode offset = null; Node node = null; if (scale == null) { - if (usage instanceof IntegerAdd) { - IntegerAdd add = (IntegerAdd) usage; + if (usage instanceof IntegerAddNode) { + IntegerAddNode add = (IntegerAddNode) usage; if (add.x() == biv || (scale = scale(add.x(), biv, loopNodes)) != null) { offset = add.y(); } else if (add.y() == biv || (scale = scale(add.y(), biv, loopNodes)) != null) { @@ -168,19 +169,19 @@ } if (scale != null || offset != null) { if (scale == null) { - scale = Constant.forInt(1, biv.graph()); + scale = ConstantNode.forInt(1, biv.graph()); } else if (offset == null) { - offset = Constant.forInt(0, biv.graph()); + offset = ConstantNode.forInt(0, biv.graph()); } - DerivedInductionVariable div = new DerivedInductionVariable(kind, offset, scale, biv, biv.graph()); + DerivedInductionVariableNode div = new DerivedInductionVariableNode(kind, offset, scale, biv, biv.graph()); node.replaceAndDelete(div); } } } - private ValueNode scale(Node n, BasicInductionVariable biv, NodeBitMap loopNodes) { - if (n instanceof IntegerMul) { - IntegerMul mul = (IntegerMul) n; + private ValueNode scale(Node n, BasicInductionVariableNode biv, NodeBitMap loopNodes) { + if (n instanceof IntegerMulNode) { + IntegerMulNode mul = (IntegerMulNode) n; ValueNode scale = null; if (mul.x() == biv) { scale = mul.y(); diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -24,7 +24,7 @@ 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.compiler.schedule.*; import com.oracle.max.graal.graph.*; @@ -93,7 +93,7 @@ @Override public Node createGuard(Node condition) { - Anchor anchor = (Anchor) getGuardAnchor(); + AnchorNode anchor = (AnchorNode) getGuardAnchor(); GuardNode newGuard = new GuardNode((BooleanNode) condition, anchor.graph()); newGuard.setAnchor(anchor); return newGuard; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/MemoryPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -27,10 +27,8 @@ 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.PhiType; import com.oracle.max.graal.compiler.nodes.base.*; -import com.oracle.max.graal.compiler.nodes.cfg.*; +import com.oracle.max.graal.compiler.nodes.base.PhiNode.PhiType; import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.graph.*; @@ -52,7 +50,7 @@ public MemoryMap(Block b, MemoryMap memoryMap) { this(b); - if (b.firstNode() instanceof LoopBegin) { + if (b.firstNode() instanceof LoopBeginNode) { loopCheckPoint = new WriteMemoryCheckpointNode(b.firstNode().graph()); mergeForWrite = loopCheckPoint; mergeForRead = loopCheckPoint; @@ -117,7 +115,7 @@ TTY.println("Only right map " + e.getKey()); } Node leftNode = mergeLeft; - if (leftNode instanceof Phi && ((Phi) leftNode).merge() == block.firstNode()) { + if (leftNode instanceof PhiNode && ((PhiNode) leftNode).merge() == block.firstNode()) { leftNode = leftNode.copyWithEdges(); } locationLeft.put(e.getKey(), leftNode); @@ -151,9 +149,9 @@ } return original; } - Merge m = (Merge) block.firstNode(); - if (original instanceof Phi && ((Phi) original).merge() == m) { - Phi phi = (Phi) original; + MergeNode m = (MergeNode) block.firstNode(); + if (original instanceof PhiNode && ((PhiNode) original).merge() == m) { + PhiNode phi = (PhiNode) original; phi.addInput((ValueNode) newValue); if (GraalOptions.TraceMemoryMaps) { TTY.println("Add new input to phi " + original.id()); @@ -161,7 +159,7 @@ assert phi.valueCount() <= phi.merge().endCount(); return original; } else { - Phi phi = new Phi(CiKind.Illegal, m, PhiType.Memory, m.graph()); + PhiNode phi = new PhiNode(CiKind.Illegal, m, PhiType.Memory, m.graph()); for (int i = 0; i < mergeOperationCount + 1; ++i) { phi.addInput((ValueNode) original); } @@ -169,7 +167,7 @@ if (GraalOptions.TraceMemoryMaps) { TTY.println("Creating new phi " + phi.id()); } - assert phi.valueCount() <= phi.merge().endCount() + ((phi.merge() instanceof LoopBegin) ? 1 : 0) : phi.merge() + "/" + phi.valueCount() + "/" + phi.merge().endCount() + "/" + mergeOperationCount; + assert phi.valueCount() <= phi.merge().endCount() + ((phi.merge() instanceof LoopBeginNode) ? 1 : 0) : phi.merge() + "/" + phi.valueCount() + "/" + phi.merge().endCount() + "/" + mergeOperationCount; return phi; } } @@ -285,7 +283,7 @@ } else { map = new MemoryMap(b, memoryMaps[b.getPredecessors().get(0).blockID()]); for (int i = 1; i < b.getPredecessors().size(); ++i) { - assert b.firstNode() instanceof Merge : b.firstNode(); + assert b.firstNode() instanceof MergeNode : b.firstNode(); Block block = b.getPredecessors().get(i); map.mergeWith(memoryMaps[block.blockID()], b); } @@ -316,9 +314,9 @@ } memoryMaps[b.blockID()] = map; - if (b.lastNode() instanceof LoopEnd) { - LoopEnd end = (LoopEnd) b.lastNode(); - LoopBegin begin = end.loopBegin(); + if (b.lastNode() instanceof LoopEndNode) { + LoopEndNode end = (LoopEndNode) b.lastNode(); + LoopBeginNode begin = end.loopBegin(); Block beginBlock = nodeMap.get(begin); MemoryMap memoryMap = memoryMaps[beginBlock.blockID()]; assert memoryMap != null : beginBlock.name(); diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -24,7 +24,6 @@ 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.*; diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Block.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Block.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Block.java Wed Aug 10 00:34:29 2011 +0200 @@ -24,7 +24,8 @@ 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.java.*; import com.oracle.max.graal.graph.*; @@ -37,7 +38,7 @@ private List instructions = new ArrayList(); private Block dominator; private Block javaBlock; - private Anchor anchor; + private AnchorNode anchor; private EndNode end; private int loopDepth = 0; private int loopIndex = -1; @@ -102,35 +103,35 @@ } } - public Anchor createAnchor() { + public AnchorNode createAnchor() { if (anchor == null) { - if (firstNode instanceof Anchor) { - this.anchor = (Anchor) firstNode; + if (firstNode instanceof AnchorNode) { + this.anchor = (AnchorNode) firstNode; } else if (firstNode == firstNode.graph().start()) { StartNode start = (StartNode) firstNode; - if (start.next() instanceof Anchor) { - this.anchor = (Anchor) start.next(); + if (start.next() instanceof AnchorNode) { + this.anchor = (AnchorNode) start.next(); } else { - Anchor a = new Anchor(firstNode.graph()); + AnchorNode a = new AnchorNode(firstNode.graph()); FixedNode oldStart = (FixedNode) firstNode.graph().start().next(); firstNode.graph().start().setNext(a); a.setNext(oldStart); this.anchor = a; } - } else if (firstNode instanceof Merge || firstNode instanceof ExceptionObject) { - FixedNodeWithNext fixedNode = (FixedNodeWithNext) firstNode; - if (fixedNode.next() instanceof Anchor) { - this.anchor = (Anchor) fixedNode.next(); + } else if (firstNode instanceof MergeNode || firstNode instanceof ExceptionObjectNode) { + FixedWithNextNode fixedNode = (FixedWithNextNode) firstNode; + if (fixedNode.next() instanceof AnchorNode) { + this.anchor = (AnchorNode) fixedNode.next(); } else { - Anchor a = new Anchor(firstNode.graph()); + AnchorNode a = new AnchorNode(firstNode.graph()); FixedNode next = fixedNode.next(); fixedNode.setNext(a); a.setNext(next); this.anchor = a; } } else { - assert !(firstNode instanceof Anchor); - Anchor a = new Anchor(firstNode.graph()); + assert !(firstNode instanceof AnchorNode); + AnchorNode a = new AnchorNode(firstNode.graph()); assert firstNode.predecessor() != null : firstNode; Node pred = firstNode.predecessor(); pred.replaceFirstSuccessor(firstNode, a); @@ -212,11 +213,11 @@ } public boolean isLoopHeader() { - return firstNode instanceof LoopBegin; + return firstNode instanceof LoopBeginNode; } public boolean isLoopEnd() { - return lastNode instanceof LoopEnd; + return lastNode instanceof LoopEndNode; } public Block dominator() { @@ -254,7 +255,7 @@ if (!visited.get(succ.blockID())) { boolean delay = false; for (Block pred : succ.getPredecessors()) { - if (!visited.get(pred.blockID()) && !(pred.lastNode instanceof LoopEnd)) { + if (!visited.get(pred.blockID()) && !(pred.lastNode instanceof LoopEndNode)) { delay = true; break; } diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/BlockClosure.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/BlockClosure.java Wed Aug 10 00:34:29 2011 +0200 @@ -0,0 +1,30 @@ +/* + * 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.schedule; + +/** + * The {@code BlockClosure} interface represents a closure for iterating over blocks. + */ +public interface BlockClosure { + void apply(Block block); +} diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/BlockList.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/BlockList.java Wed Aug 10 00:34:29 2011 +0200 @@ -0,0 +1,150 @@ +/* + * 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.schedule; + +import java.util.*; + +import com.oracle.max.graal.compiler.nodes.base.*; + +/** + * The {@code BlockList} class implements a specialized list data structure for representing + * the predecessor and successor lists of basic blocks. + */ +public class BlockList implements Iterable { + + private MergeNode[] array; + private int cursor; + + BlockList(int sizeHint) { + if (sizeHint > 0) { + array = new MergeNode[sizeHint]; + } else { + array = new MergeNode[2]; + } + } + + public void remove(int index) { + if (index < 0 || index >= cursor) { + throw new IndexOutOfBoundsException(); + } + for (int i = index; i < cursor; i++) { + array[i] = array[i + 1]; + } + cursor--; + } + + public void remove(MergeNode block) { + int j = 0; + for (int i = 0; i < cursor; i++) { + if (i != j) { + array[j] = array[i]; + } + if (array[i] != block) { + j++; + } + } + cursor = j; + } + + public void exchange(int index1, int index2) { + if (index1 < 0 || index1 >= cursor) { + throw new IndexOutOfBoundsException(); + } + if (index2 < 0 || index2 >= cursor) { + throw new IndexOutOfBoundsException(); + } + MergeNode t = array[index2]; + array[index2] = array[index1]; + array[index1] = t; + } + + public void insert(int index, MergeNode block) { + if (index < 0 || index >= cursor) { + throw new IndexOutOfBoundsException(); + } + growOne(); + for (int i = cursor; i > index; i--) { + array[i] = array[i - 1]; + } + array[cursor++] = block; + } + + public void append(MergeNode block) { + growOne(); + array[cursor++] = block; + } + + public MergeNode get(int index) { + if (index < 0 || index >= cursor) { + throw new IndexOutOfBoundsException(); + } + return array[index]; + } + + public void replace(MergeNode oldBlock, MergeNode newBlock) { + for (int i = 0; i < cursor; i++) { + if (array[i] == oldBlock) { + array[i] = newBlock; + } + } + } + + public boolean checkForSameBlock() { + if (cursor == 0) { + return true; + } + MergeNode b = array[0]; + for (int i = 1; i < cursor; i++) { + if (array[i] != b) { + return false; + } + } + return true; + } + + public Iterator iterator() { + return new Iter(); + } + + private void growOne() { + if (cursor == array.length) { + array = Arrays.copyOf(array, array.length * 3); + } + } + + private class Iter implements Iterator { + private int pos; + + public boolean hasNext() { + return pos < cursor; + } + + public MergeNode next() { + return array[pos++]; + } + + public void remove() { + BlockList.this.remove(pos); + } + } +} diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,9 +26,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.nodes.base.*; import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.loop.*; +import com.oracle.max.graal.compiler.nodes.virtual.*; import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.NodeClass.NodeClassIterator; @@ -97,14 +98,14 @@ assert nodeToBlock.get(n) == null; nodeToBlock.set(n, b); - if (n instanceof Merge) { + if (n instanceof MergeNode) { for (Node usage : n.usages()) { - if (usage instanceof Phi) { + if (usage instanceof PhiNode) { nodeToBlock.set(usage, b); } - if (usage instanceof LoopCounter) { + if (usage instanceof LoopCounterNode) { nodeToBlock.set(usage, b); } @@ -131,7 +132,7 @@ } public static boolean isBlockEnd(Node n) { - return trueSuccessorCount(n) > 1 || n instanceof Return || n instanceof UnwindNode || n instanceof Deoptimize; + return trueSuccessorCount(n) > 1 || n instanceof ReturnNode || n instanceof UnwindNode || n instanceof DeoptimizeNode; } private void print() { @@ -154,11 +155,11 @@ // Identify blocks. for (Node n : graph.getNodes()) { - if (n instanceof EndNode || n instanceof Return || n instanceof UnwindNode || n instanceof LoopEnd || n instanceof Deoptimize) { + if (n instanceof EndNode || n instanceof ReturnNode || n instanceof UnwindNode || n instanceof LoopEndNode || n instanceof DeoptimizeNode) { Block block = null; Node currentNode = n; while (nodeToBlock.get(currentNode) == null) { - if (block != null && (currentNode instanceof ControlSplit || trueSuccessorCount(currentNode) > 1)) { + if (block != null && (currentNode instanceof ControlSplitNode || trueSuccessorCount(currentNode) > 1)) { // We are at a split node => start a new block. block = null; } @@ -181,8 +182,8 @@ // Connect blocks. for (Block block : blocks) { Node n = block.firstNode(); - if (n instanceof Merge) { - Merge m = (Merge) n; + if (n instanceof MergeNode) { + MergeNode m = (MergeNode) n; for (Node pred : m.cfgPredecessors()) { Block predBlock = nodeToBlock.get(pred); predBlock.addSuccessor(block); @@ -214,8 +215,8 @@ // Add successors of loop end nodes. Makes the graph cyclic. for (Block block : blocks) { Node n = block.lastNode(); - if (n instanceof LoopEnd) { - LoopEnd loopEnd = (LoopEnd) n; + if (n instanceof LoopEndNode) { + LoopEndNode loopEnd = (LoopEndNode) n; assert loopEnd.loopBegin() != null; Block loopBeginBlock = nodeToBlock.get(loopEnd.loopBegin()); block.addSuccessor(loopBeginBlock); @@ -251,7 +252,7 @@ } if (block.isLoopHeader()) { - markBlocks(nodeToBlock.get(((LoopBegin) block.firstNode()).loopEnd()), endBlock, map, loopIndex, initialDepth); + markBlocks(nodeToBlock.get(((LoopBeginNode) block.firstNode()).loopEnd()), endBlock, map, loopIndex, initialDepth); } } @@ -513,9 +514,9 @@ } private void blocksForUsage(Node node, Node usage, BlockClosure closure) { - if (usage instanceof Phi) { - Phi phi = (Phi) usage; - Merge merge = phi.merge(); + if (usage instanceof PhiNode) { + PhiNode phi = (PhiNode) usage; + MergeNode merge = phi.merge(); Block mergeBlock = nodeToBlock.get(merge); assert mergeBlock != null : "no block for merge " + merge.id(); for (int i = 0; i < phi.valueCount(); ++i) { @@ -531,16 +532,16 @@ } } } else if (usage instanceof FrameState && ((FrameState) usage).block() != null) { - Merge merge = ((FrameState) usage).block(); + MergeNode merge = ((FrameState) usage).block(); Block block = null; for (Node pred : merge.cfgPredecessors()) { block = getCommonDominator(block, nodeToBlock.get(pred)); } closure.apply(block); - } else if (usage instanceof LinearInductionVariable) { - LinearInductionVariable liv = (LinearInductionVariable) usage; + } else if (usage instanceof LinearInductionVariableNode) { + LinearInductionVariableNode liv = (LinearInductionVariableNode) usage; if (liv.isLinearInductionVariableInput(node)) { - LoopBegin loopBegin = liv.loopBegin(); + LoopBeginNode loopBegin = liv.loopBegin(); Block mergeBlock = nodeToBlock.get(loopBegin); closure.apply(mergeBlock.dominator()); } @@ -551,12 +552,12 @@ } private void patch(Usage usage, Node original, Node patch) { - if (usage.node instanceof Phi) { - Phi phi = (Phi) usage.node; + if (usage.node instanceof PhiNode) { + PhiNode phi = (PhiNode) usage.node; Node pred; Block phiBlock = nodeToBlock.get(phi); if (phiBlock.isLoopHeader()) { - LoopBegin loopBegin = (LoopBegin) phiBlock.firstNode(); + LoopBeginNode loopBegin = (LoopBeginNode) phiBlock.firstNode(); if (usage.block == phiBlock.dominator()) { pred = loopBegin.forwardEdge(); } else { @@ -629,7 +630,7 @@ } private boolean noRematerialization(Node n) { - return n instanceof Local || n instanceof LocationNode || n instanceof Constant || n instanceof StateSplit || n instanceof FrameState || n instanceof VirtualObjectNode || + return n instanceof LocalNode || n instanceof LocationNode || n instanceof ConstantNode || n instanceof StateSplit || n instanceof FrameState || n instanceof VirtualObjectNode || n instanceof VirtualObjectFieldNode; } @@ -703,7 +704,7 @@ } } if (canNotMove) { - assert !(b.lastNode() instanceof ControlSplit); + assert !(b.lastNode() instanceof ControlSplitNode); //b.setLastNode(lastSorted); } else { sortedInstructions.remove(b.lastNode()); @@ -719,7 +720,7 @@ } private void addToSorting(Block b, Node i, List sortedInstructions, NodeBitMap map) { - if (i == null || map.isMarked(i) || nodeToBlock.get(i) != b || i instanceof Phi || i instanceof Local || i instanceof LoopCounter) { + if (i == null || map.isMarked(i) || nodeToBlock.get(i) != b || i instanceof PhiNode || i instanceof LocalNode || i instanceof LoopCounterNode) { return; } diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Wed Aug 10 00:34:29 2011 +0200 @@ -38,9 +38,9 @@ import com.oracle.max.graal.compiler.debug.*; 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.nodes.calc.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiAddress.Scale; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Wed Aug 10 00:34:29 2011 +0200 @@ -28,10 +28,11 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.gen.*; 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.calc.*; import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.java.*; import com.oracle.max.graal.compiler.util.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -69,7 +70,7 @@ // there is no immediate move of word values in asemblerI486.?pp return false; } - return v instanceof Constant; + return v instanceof ConstantNode; } @Override @@ -123,7 +124,7 @@ } @Override - public void visitNegate(Negate x) { + public void visitNegate(NegateNode x) { LIRItem value = new LIRItem(x.x(), this); value.setDestroysRegister(); value.loadItem(); @@ -137,7 +138,7 @@ return false; } - public void visitArithmeticOpFloat(Arithmetic x) { + public void visitArithmeticOpFloat(ArithmeticNode x) { LIRItem left = new LIRItem(x.x(), this); LIRItem right = new LIRItem(x.y(), this); assert !left.isStack() || !right.isStack() : "can't both be memory operands"; @@ -178,7 +179,7 @@ setResult(x, reg); } - public void visitArithmeticOpLong(Arithmetic x) { + public void visitArithmeticOpLong(ArithmeticNode x) { int opcode = x.opcode; if (opcode == Bytecodes.LDIV || opcode == Bytecodes.LREM) { // emit inline 64-bit code @@ -221,7 +222,7 @@ } } - public void visitArithmeticOpInt(Arithmetic x) { + public void visitArithmeticOpInt(ArithmeticNode x) { int opcode = x.opcode; if (opcode == Bytecodes.IDIV || opcode == Bytecodes.IREM) { // emit code for integer division or modulus @@ -299,7 +300,7 @@ } } - public void visitArithmeticOpWord(Arithmetic x) { + public void visitArithmeticOpWord(ArithmeticNode x) { int opcode = x.opcode; if (opcode == Bytecodes.WDIV || opcode == Bytecodes.WREM || opcode == Bytecodes.WDIVI || opcode == Bytecodes.WREMI) { // emit code for long division or modulus @@ -352,7 +353,7 @@ } @Override - public void visitArithmetic(Arithmetic x) { + public void visitArithmetic(ArithmeticNode x) { trySwap(x); if (x.kind.isWord() || x.opcode == Bytecodes.WREMI) { @@ -393,7 +394,7 @@ } @Override - public void visitLogic(Logic x) { + public void visitLogic(LogicNode x) { trySwap(x); LIRItem right = new LIRItem(x.y(), this); @@ -405,12 +406,12 @@ logicOp(x.opcode, reg, left, right.result()); } - private void trySwap(Binary x) { + private void trySwap(BinaryNode x) { // (tw) TODO: Check what this is for? } @Override - public void visitNormalizeCompare(NormalizeCompare x) { + public void visitNormalizeCompare(NormalizeCompareNode x) { LIRItem left = new LIRItem(x.x(), this); LIRItem right = new LIRItem(x.y(), this); if (!x.kind.isVoid() && x.x().kind.isLong()) { @@ -433,7 +434,7 @@ } @Override - public void visitConvert(Convert x) { + public void visitConvert(ConvertNode x) { CiValue input = load(x.value()); CiVariable result = newVariable(x.kind); // arguments of lirConvert @@ -458,7 +459,7 @@ } @Override - public void visitLoopBegin(LoopBegin x) { + public void visitLoopBegin(LoopBeginNode x) { } @Override @@ -467,7 +468,7 @@ } @Override - public void visitMathIntrinsic(MathIntrinsic node) { + public void visitMathIntrinsic(MathIntrinsicNode node) { assert node.kind == CiKind.Double; LIRItem opd = new LIRItem(node.x(), this); opd.setDestroysRegister(); diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/BlockWorkList.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/BlockWorkList.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/BlockWorkList.java Wed Aug 10 00:34:29 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.util; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; /** * This class implements a worklist for dealing with blocks. The worklist can @@ -38,7 +38,7 @@ * @author Ben L. Titzer */ public class BlockWorkList { - Merge[] workList; + MergeNode[] workList; int[] workListNumbers; int workListIndex; @@ -46,7 +46,7 @@ * Adds a block to this list in an unsorted fashion, like a stack. * @param block the block to add */ - public void add(Merge block) { + public void add(MergeNode block) { if (workList == null) { // worklist not allocated yet allocate(); @@ -64,7 +64,7 @@ * @param block the block to add * @param number the number used to sort the block */ - public void addSorted(Merge block, int number) { + public void addSorted(MergeNode block, int number) { if (workList == null) { // worklist not allocated yet allocate(); @@ -96,7 +96,7 @@ * the last block added is returned. * @return the next block in the list */ - public Merge removeFromWorkList() { + public MergeNode removeFromWorkList() { if (workListIndex != 0) { return workList[--workListIndex]; } @@ -112,13 +112,13 @@ } private void allocate() { - workList = new Merge[5]; + workList = new MergeNode[5]; workListNumbers = new int[5]; } private void grow() { int prevLength = workList.length; - Merge[] nworkList = new Merge[prevLength * 3]; + MergeNode[] nworkList = new MergeNode[prevLength * 3]; System.arraycopy(workList, 0, nworkList, 0, prevLength); workList = nworkList; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/GraphUtil.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,9 +26,9 @@ import java.util.Map.Entry; 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.nodes.base.PhiNode.PhiType; +import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.NodeClass.NodeClassIterator; @@ -39,18 +39,18 @@ public class GraphUtil { public static interface ColoringLambda { - T color(Iterable incomming, Merge merge); - T danglingColor(Iterable incomming, Merge merge); + T color(Iterable incomming, MergeNode merge); + T danglingColor(Iterable incomming, MergeNode merge); } /** * colors down, applying the lambda at merge points, starting at the pre-colored points. */ public static void colorCFGDown(NodeMap colors, ColoringLambda lambda) { - Set delayed = new HashSet(); + Set delayed = new HashSet(); Set currentPoints = new HashSet(); Set otherPoints = new HashSet(); - Set otherMerges = new HashSet(); + Set otherMerges = new HashSet(); for (Entry entry : colors.entries()) { currentPoints.add(entry.getKey()); } @@ -59,7 +59,7 @@ for (Node node : currentPoints) { otherMerges.addAll(colorCFGDownToMerge(node, colors.get(node), colors)); } - for (Merge merge : otherMerges) { + for (MergeNode merge : otherMerges) { incomming.clear(); for (EndNode end : merge.cfgPredecessors()) { incomming.add(colors.get(end)); @@ -80,7 +80,7 @@ otherPoints.clear(); otherMerges.clear(); } - for (Merge merge : delayed) { + for (MergeNode merge : delayed) { T color = lambda.danglingColor(incomming, merge); if (color != null) { colors.set(merge, color); @@ -88,29 +88,29 @@ } } - private static Collection colorCFGDownToMerge(Node from, T color, NodeMap colors) { + private static Collection colorCFGDownToMerge(Node from, T color, NodeMap colors) { NodeFlood work = from.graph().createNodeFlood(); - Collection merges = new LinkedList(); + Collection merges = new LinkedList(); work.add(from); for (Node node : work) { Node current = node; while (current != null) { - if (current instanceof Merge) { - merges.add((Merge) current); + if (current instanceof MergeNode) { + merges.add((MergeNode) current); break; } colors.set(current, color); - if (current instanceof FixedNodeWithNext && !(current instanceof AbstractVectorNode) && !(current instanceof Invoke && ((Invoke) current).exceptionEdge() != null)) { - current = ((FixedNodeWithNext) current).next(); + if (current instanceof FixedWithNextNode && !(current instanceof AbstractVectorNode) && !(current instanceof InvokeNode && ((InvokeNode) current).exceptionEdge() != null)) { + current = ((FixedWithNextNode) current).next(); } else if (current instanceof EndNode) { current = ((EndNode) current).merge(); } else { - if (current instanceof ControlSplit) { + if (current instanceof ControlSplitNode) { for (Node sux : current.cfgSuccessors()) { work.add(sux); } - } else if (current instanceof Invoke && ((Invoke) current).exceptionEdge() != null) { - Invoke invoke = (Invoke) current; + } else if (current instanceof InvokeNode && ((InvokeNode) current).exceptionEdge() != null) { + InvokeNode invoke = (InvokeNode) current; work.add(invoke.next()); work.add(invoke.exceptionEdge()); } else if (current instanceof AbstractVectorNode) { @@ -132,7 +132,7 @@ ValueNode fixPhiInput(ValueNode input, T color); boolean explore(Node n); List parentColors(T color); - Merge merge(T color); + MergeNode merge(T color); } // TODO (gd) rework that code around Phi handling : too complicated @@ -148,9 +148,9 @@ Set colors = new HashSet(); try { for (Node node : work) { - if (node instanceof Phi) { - Phi phi = (Phi) node; - Merge merge = phi.merge(); + if (node instanceof PhiNode) { + PhiNode phi = (PhiNode) node; + MergeNode merge = phi.merge(); for (int i = 0; i < phi.valueCount(); i++) { ValueNode v = phi.valueAt(i); if (v != null) { @@ -176,9 +176,9 @@ } if (originalColoringColor == null) { for (Node usage : node.dataUsages()) { - if (usage instanceof Phi) { - Phi phi = (Phi) usage; - Merge merge = phi.merge(); + if (usage instanceof PhiNode) { + PhiNode phi = (PhiNode) usage; + MergeNode merge = phi.merge(); for (int i = 0; i < phi.valueCount(); i++) { ValueNode v = phi.valueAt(i); if (v == node) { @@ -230,7 +230,7 @@ colorQueue.offer(color); continue; } - Phi phi = new Phi(((ValueNode) node).kind, lambda.merge(color), PhiType.Value, node.graph()); + PhiNode phi = new PhiNode(((ValueNode) node).kind, lambda.merge(color), PhiType.Value, node.graph()); for (T parentColor : parentColors) { Node input = newNodes.get(parentColor); phi.addInput((ValueNode) input); @@ -255,9 +255,9 @@ dataUsages.add(usage); } for (Node usage : dataUsages) { - if (usage instanceof Phi) { - Phi phi = (Phi) usage; - Merge merge = phi.merge(); + if (usage instanceof PhiNode) { + PhiNode phi = (PhiNode) usage; + MergeNode merge = phi.merge(); for (int i = 0; i < phi.valueCount(); i++) { ValueNode v = phi.valueAt(i); if (v == node) { @@ -280,13 +280,13 @@ if (node instanceof StateSplit) { FrameState stateAfter = ((StateSplit) node).stateAfter(); if (stateAfter != null && lambda.explore(stateAfter) && !work.isNew(stateAfter)) { - if (!(node instanceof Merge && coloring.get(((Merge) node).next()) == null)) { // not dangling colored merge + if (!(node instanceof MergeNode && coloring.get(((MergeNode) node).next()) == null)) { // not dangling colored merge work.add(stateAfter); } } } - if (node instanceof Merge) { + if (node instanceof MergeNode) { for (Node usage : node.usages()) { if (!work.isNew(usage)) { work.add(usage); @@ -294,8 +294,8 @@ } } - if (node instanceof LoopEnd) { - work.add(((LoopEnd) node).loopBegin()); + if (node instanceof LoopEndNode) { + work.add(((LoopEndNode) node).loopBegin()); } for (Node input : node.dataInputs()) { diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,9 +26,10 @@ import java.util.Map.Entry; 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.nodes.base.PhiNode.PhiType; +import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.loop.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.GraphUtil.ColorSplitingLambda; @@ -42,20 +43,20 @@ public class LoopUtil { public static class Loop { - private final LoopBegin loopBegin; + private final LoopBeginNode loopBegin; private NodeBitMap cfgNodes; private Loop parent; private NodeBitMap exits; private NodeBitMap inOrBefore; private NodeBitMap inOrAfter; private NodeBitMap nodes; - public Loop(LoopBegin loopBegin, NodeBitMap nodes, NodeBitMap exits) { + public Loop(LoopBeginNode loopBegin, NodeBitMap nodes, NodeBitMap exits) { this.loopBegin = loopBegin; this.cfgNodes = nodes; this.exits = exits; } - public LoopBegin loopBegin() { + public LoopBeginNode loopBegin() { return loopBegin; } @@ -119,12 +120,12 @@ public final FixedNode end; public final NodeMap exits; public final NodeBitMap unaffectedExits; - public final NodeMap phis; + public final NodeMap phis; public final NodeMap phiInits; public final NodeMap dataOut; public final NodeBitMap exitFrameStates; public final NodeBitMap peeledNodes; - public PeelingResult(FixedNode begin, FixedNode end, NodeMap exits, NodeMap phis, NodeMap phiInits, NodeMap dataOut, NodeBitMap unaffectedExits, NodeBitMap exitFrameStates, NodeBitMap peeledNodes) { + public PeelingResult(FixedNode begin, FixedNode end, NodeMap exits, NodeMap phis, NodeMap phiInits, NodeMap dataOut, NodeBitMap unaffectedExits, NodeBitMap exitFrameStates, NodeBitMap peeledNodes) { this.begin = begin; this.end = end; this.exits = exits; @@ -139,7 +140,7 @@ public static List computeLoops(Graph graph) { List loops = new LinkedList(); - for (LoopBegin loopBegin : graph.getNodes(LoopBegin.class)) { + for (LoopBeginNode loopBegin : graph.getNodes(LoopBeginNode.class)) { NodeBitMap cfgNodes = markUpCFG(loopBegin, loopBegin.loopEnd()); // computeLoopNodes(loopBegin); cfgNodes.mark(loopBegin); NodeBitMap exits = computeLoopExits(loopBegin, cfgNodes); @@ -157,7 +158,7 @@ return loops; } - public static NodeBitMap computeLoopExits(LoopBegin loopBegin, NodeBitMap cfgNodes) { + public static NodeBitMap computeLoopExits(LoopBeginNode loopBegin, NodeBitMap cfgNodes) { Graph graph = loopBegin.graph(); NodeBitMap exits = graph.createNodeBitMap(); for (Node n : cfgNodes) { @@ -174,7 +175,7 @@ private static boolean recurse = false; public static NodeBitMap computeLoopNodesFrom(Loop loop, FixedNode from) { - LoopBegin loopBegin = loop.loopBegin(); + LoopBeginNode loopBegin = loop.loopBegin(); NodeBitMap loopNodes = markUpCFG(loopBegin, from); loopNodes.mark(loopBegin); NodeBitMap inOrAfter = inOrAfter(loop, loopNodes, false); @@ -199,11 +200,11 @@ return loopNodes; } - public static NodeBitMap markUpCFG(LoopBegin loopBegin) { + public static NodeBitMap markUpCFG(LoopBeginNode loopBegin) { return markUpCFG(loopBegin, loopBegin.loopEnd()); } - public static NodeBitMap markUpCFG(LoopBegin loopBegin, FixedNode from) { + public static NodeBitMap markUpCFG(LoopBeginNode loopBegin, FixedNode from) { NodeFlood workCFG = loopBegin.graph().createNodeFlood(); workCFG.add(from); NodeBitMap loopNodes = loopBegin.graph().createNodeBitMap(); @@ -212,8 +213,8 @@ continue; } loopNodes.mark(n); - if (n instanceof LoopBegin) { - workCFG.add(((LoopBegin) n).loopEnd()); + if (n instanceof LoopBeginNode) { + workCFG.add(((LoopBeginNode) n).loopEnd()); } for (Node pred : n.cfgPredecessors()) { workCFG.add(pred); @@ -222,7 +223,7 @@ return loopNodes; } - public static void inverseLoop(Loop loop, If split) { + public static void inverseLoop(Loop loop, IfNode split) { assert loop.cfgNodes().isMarked(split); FixedNode noExit = split.trueSuccessor(); FixedNode exit = split.falseSuccessor(); @@ -238,8 +239,8 @@ rewireInversion(peeling, loop, split); // move peeled part to the end - LoopBegin loopBegin = loop.loopBegin(); - LoopEnd loopEnd = loopBegin.loopEnd(); + LoopBeginNode loopBegin = loop.loopBegin(); + LoopEndNode loopEnd = loopBegin.loopEnd(); FixedNode lastNode = (FixedNode) loopEnd.predecessor(); if (loopBegin.next() != lastNode) { lastNode.successors().replace(loopEnd, loopBegin.next()); @@ -249,7 +250,7 @@ //rewire phi usage in peeled part int backIndex = loopBegin.phiPredecessorIndex(loopBegin.loopEnd()); - for (Phi phi : loopBegin.phis()) { + for (PhiNode phi : loopBegin.phis()) { ValueNode backValue = phi.valueAt(backIndex); if (loop.nodes().isMarked(backValue) && peeling.peeledNodes.isNotNewNotMarked(backValue)) { for (Node usage : phi.usages().snapshot()) { @@ -275,7 +276,7 @@ } public static void peelLoop(Loop loop) { - LoopEnd loopEnd = loop.loopBegin().loopEnd(); + LoopEndNode loopEnd = loop.loopBegin().loopEnd(); PeelingResult peeling = preparePeeling(loop, loopEnd); GraalCompilation compilation = GraalCompilation.compilation(); @@ -306,7 +307,7 @@ } private static void rewirePeeling(PeelingResult peeling, Loop loop, FixedNode from, boolean inversion) { - LoopBegin loopBegin = loop.loopBegin(); + LoopBeginNode loopBegin = loop.loopBegin(); Graph graph = loopBegin.graph(); Node loopPred = loopBegin.predecessor(); loopPred.successors().replace(loopBegin.forwardEdge(), peeling.begin); @@ -330,9 +331,9 @@ } assert found; int phiInitIndex = loopBegin.phiPredecessorIndex(loopBegin.forwardEdge()); - for (Entry entry : peeling.phis.entries()) { - Phi phi = (Phi) entry.getKey(); - Placeholder p = entry.getValue(); + for (Entry entry : peeling.phis.entries()) { + PhiNode phi = (PhiNode) entry.getKey(); + PlaceholderNode p = entry.getValue(); ValueNode init = phi.valueAt(phiInitIndex); p.replaceAndDelete(init); for (Entry dataEntry : peeling.dataOut.entries()) { @@ -342,13 +343,13 @@ } } for (Entry entry : peeling.phiInits.entries()) { - Phi phi = (Phi) entry.getKey(); + PhiNode phi = (PhiNode) entry.getKey(); Node newInit = entry.getValue(); phi.setValueAt(phiInitIndex, (ValueNode) newInit); } if (from == loopBegin.loopEnd()) { - for (InductionVariable iv : loopBegin.inductionVariables()) { + for (InductionVariableNode iv : loopBegin.inductionVariables()) { iv.peelOneIteration(); } } @@ -363,7 +364,7 @@ StateSplit newExit = entry.getValue(); EndNode oEnd = new EndNode(graph); EndNode nEnd = new EndNode(graph); - Merge merge = new Merge(graph); + MergeNode merge = new MergeNode(graph); FrameState originalState = original.stateAfter(); merge.addEnd(nEnd); merge.addEnd(oEnd); @@ -379,7 +380,7 @@ for (Entry entry : peeling.exits.entries()) { StateSplit original = (StateSplit) entry.getKey(); EndNode oEnd = (EndNode) original.next(); - Merge merge = oEnd.merge(); + MergeNode merge = oEnd.merge(); EndNode nEnd = merge.endAt(1 - merge.phiPredecessorIndex(oEnd)); Node newExit = nEnd.predecessor(); for (Entry dataEntry : peeling.dataOut.entries()) { @@ -391,8 +392,8 @@ newExitValues.set(originalValue, phiMap); } ValueNode backValue = null; - if (inversion && originalValue instanceof Phi && ((Phi) originalValue).merge() == loopBegin) { - backValue = ((Phi) originalValue).valueAt(phiBackIndex); + if (inversion && originalValue instanceof PhiNode && ((PhiNode) originalValue).merge() == loopBegin) { + backValue = ((PhiNode) originalValue).valueAt(phiBackIndex); if (peeling.peeledNodes.isNotNewMarked(backValue)) { backValue = null; } @@ -411,24 +412,24 @@ NodeBitMap exitMergesPhis = graph.createNodeBitMap(); for (Entry entry : peeling.exits.entries()) { StateSplit newExit = entry.getValue(); - Merge merge = ((EndNode) newExit.next()).merge(); + MergeNode merge = ((EndNode) newExit.next()).merge(); exitMergesPhis.markAll(merge.phis()); } for (Entry entry : peeling.dataOut.entries()) { ValueNode originalValue = (ValueNode) entry.getKey(); - if (originalValue instanceof Phi && ((Phi) originalValue).merge() == loopBegin) { + if (originalValue instanceof PhiNode && ((PhiNode) originalValue).merge() == loopBegin) { continue; } ValueNode newValue = (ValueNode) entry.getValue(); - Phi phi = null; + PhiNode phi = null; for (Node usage : originalValue.usages().snapshot()) { if (exitMergesPhis.isMarked(usage) || ( loop.nodes().isNotNewMarked(usage) && peeling.peeledNodes.isNotNewNotMarked(usage) - && !(usage instanceof Phi && ((Phi) usage).merge() == loopBegin)) + && !(usage instanceof PhiNode && ((PhiNode) usage).merge() == loopBegin)) && !(usage instanceof FrameState && ((FrameState) usage).block() == loopBegin)) { if (phi == null) { - phi = new Phi(originalValue.kind, loopBegin, PhiType.Value, graph); + phi = new PhiNode(originalValue.kind, loopBegin, PhiType.Value, graph); phi.addInput(newValue); phi.addInput(originalValue); NodeMap exitMap = newExitValues.get(originalValue); @@ -468,7 +469,7 @@ // color GraphUtil.colorCFGDown(colors, new ColoringLambda() { @Override - public Node color(Iterable incomming, Merge merge) { + public Node color(Iterable incomming, MergeNode merge) { Node color = null; for (Node c : incomming) { if (c == null) { @@ -483,7 +484,7 @@ return color; } @Override - public Node danglingColor(Iterable incomming, Merge merge) { + public Node danglingColor(Iterable incomming, MergeNode merge) { Node color = null; for (Node c : incomming) { if (color == null) { @@ -523,7 +524,7 @@ if (value != null) { return value; } - Merge merge = (Merge) point; + MergeNode merge = (MergeNode) point; ArrayList values = new ArrayList(merge.phiPredecessorCount()); ValueNode v = null; boolean createPhi = false; @@ -537,7 +538,7 @@ values.add(valueAt); } if (createPhi) { - Phi phi = new Phi(kind, merge, PhiType.Value, merge.graph()); + PhiNode phi = new PhiNode(kind, merge, PhiType.Value, merge.graph()); valueMap.set(point, phi); for (EndNode end : merge.cfgPredecessors()) { phi.addInput(getValueAt(colors.get(end), valueMap, kind)); @@ -558,7 +559,7 @@ return false; } final FrameState frameState = (FrameState) n; - Merge block = frameState.block(); + MergeNode block = frameState.block(); if (block != null) { return colors.get(block.next()) == null; } @@ -609,10 +610,10 @@ } @Override public List parentColors(Node color) { - if (!(color instanceof Merge)) { + if (!(color instanceof MergeNode)) { return Collections.emptyList(); } - Merge merge = (Merge) color; + MergeNode merge = (MergeNode) color; List parentColors = new ArrayList(merge.phiPredecessorCount()); for (EndNode pred : merge.cfgPredecessors()) { parentColors.add(colors.get(pred)); @@ -620,14 +621,14 @@ return parentColors; } @Override - public Merge merge(Node color) { - return (Merge) color; + public MergeNode merge(Node color) { + return (MergeNode) color; } }); } private static PeelingResult preparePeeling(Loop loop, FixedNode from) { - LoopBegin loopBegin = loop.loopBegin(); + LoopBeginNode loopBegin = loop.loopBegin(); Graph graph = loopBegin.graph(); NodeBitMap marked = computeLoopNodesFrom(loop, from); if (from == loopBegin.loopEnd()) { @@ -635,7 +636,7 @@ } clearWithState(loopBegin, marked); Map replacements = new HashMap(); - NodeMap phis = graph.createNodeMap(); + NodeMap phis = graph.createNodeMap(); NodeMap exits = graph.createNodeMap(); NodeBitMap unaffectedExits = graph.createNodeBitMap(); NodeBitMap clonedExits = graph.createNodeBitMap(); @@ -659,7 +660,7 @@ for (Node n : marked) { if (!(n instanceof FrameState)) { for (Node usage : n.dataUsages()) { - if ((!marked.isMarked(usage) && !((usage instanceof Phi) && ((Phi) usage).merge() != loopBegin)) + if ((!marked.isMarked(usage) && !((usage instanceof PhiNode) && ((PhiNode) usage).merge() != loopBegin)) || (marked.isMarked(usage) && exitFrameStates.isMarked(usage))) { dataOut.mark(n); break; @@ -669,14 +670,14 @@ } for (Node n : marked) { - if (n instanceof Phi && ((Phi) n).merge() == loopBegin) { - Placeholder p = new Placeholder(graph); + if (n instanceof PhiNode && ((PhiNode) n).merge() == loopBegin) { + PlaceholderNode p = new PlaceholderNode(graph); replacements.put(n, p); phis.set(n, p); marked.clear(n); } for (Node input : n.dataInputs()) { - if (!marked.isMarked(input) && (!(input instanceof Phi) || ((Phi) input).merge() != loopBegin) && replacements.get(input) == null) { + if (!marked.isMarked(input) && (!(input instanceof PhiNode) || ((PhiNode) input).merge() != loopBegin) && replacements.get(input) == null) { replacements.put(input, input); } } @@ -701,13 +702,13 @@ NodeMap phiInits = graph.createNodeMap(); int backIndex = loopBegin.phiPredecessorIndex(loopBegin.loopEnd()); int fowardIndex = loopBegin.phiPredecessorIndex(loopBegin.forwardEdge()); - for (Phi phi : loopBegin.phis()) { + for (PhiNode phi : loopBegin.phis()) { ValueNode backValue = phi.valueAt(backIndex); if (marked.isMarked(backValue)) { phiInits.set(phi, duplicates.get(backValue)); } else if (from == loopBegin.loopEnd()) { - if (backValue instanceof Phi && ((Phi) backValue).merge() == loopBegin) { - Phi backPhi = (Phi) backValue; + if (backValue instanceof PhiNode && ((PhiNode) backValue).merge() == loopBegin) { + PhiNode backPhi = (PhiNode) backValue; phiInits.set(phi, backPhi.valueAt(fowardIndex)); } else { phiInits.set(phi, backValue); @@ -760,11 +761,11 @@ } } for (Node usage : n.usages()) { - if (usage instanceof Phi) { // filter out data graph cycles - Phi phi = (Phi) usage; - Merge merge = phi.merge(); - if (merge instanceof LoopBegin) { - LoopBegin phiLoop = (LoopBegin) merge; + if (usage instanceof PhiNode) { // filter out data graph cycles + PhiNode phi = (PhiNode) usage; + MergeNode merge = phi.merge(); + if (merge instanceof LoopBeginNode) { + LoopBeginNode phiLoop = (LoopBeginNode) merge; int backIndex = phiLoop.phiPredecessorIndex(phiLoop.loopEnd()); if (phi.valueAt(backIndex) == n) { continue; @@ -801,13 +802,13 @@ work.add(n.predecessor()); } } - if (n instanceof Phi) { // filter out data graph cycles - Phi phi = (Phi) n; + if (n instanceof PhiNode) { // filter out data graph cycles + PhiNode phi = (PhiNode) n; if (phi.type() == PhiType.Value) { int backIndex = -1; - Merge merge = phi.merge(); - if (merge instanceof LoopBegin && cfgNodes.isNotNewNotMarked(((LoopBegin) merge).loopEnd())) { - LoopBegin phiLoop = (LoopBegin) merge; + MergeNode merge = phi.merge(); + if (merge instanceof LoopBeginNode && cfgNodes.isNotNewNotMarked(((LoopBeginNode) merge).loopEnd())) { + LoopBeginNode phiLoop = (LoopBeginNode) merge; backIndex = phiLoop.phiPredecessorIndex(phiLoop.loopEnd()); } for (int i = 0; i < phi.valueCount(); i++) { @@ -828,7 +829,7 @@ work.add(sux); } } - if (n instanceof LoopBegin && n != loop.loopBegin()) { + if (n instanceof LoopBeginNode && n != loop.loopBegin()) { Loop p = loop.parent; boolean isParent = false; while (p != null) { @@ -839,7 +840,7 @@ p = p.parent; } if (!isParent) { - work.add(((LoopBegin) n).loopEnd()); + work.add(((LoopBeginNode) n).loopEnd()); } } } @@ -858,9 +859,9 @@ } } } - if (n instanceof Merge) { //add phis & counters + if (n instanceof MergeNode) { //add phis & counters for (Node usage : n.dataUsages()) { - if (!(usage instanceof LoopEnd)) { + if (!(usage instanceof LoopEndNode)) { work.add(usage); } } diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,7 +26,6 @@ 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.*; @@ -403,7 +402,7 @@ * @param compareConstants {@code true} if equivalent constants should be considered equivalent * @return {@code true} if the instructions are equivalent; {@code false} otherwise */ - public static boolean equivalent(FixedNodeWithNext x, FixedNodeWithNext y, boolean compareConstants) { + public static boolean equivalent(FixedWithNextNode x, FixedWithNextNode y, boolean compareConstants) { if (x == y) { return true; } diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateBuilder.java Wed Aug 10 00:34:29 2011 +0200 @@ -27,9 +27,8 @@ 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.base.*; +import com.oracle.max.graal.compiler.nodes.base.PhiNode.PhiType; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -71,7 +70,7 @@ int index = 0; if (!isStatic(method.accessFlags())) { // add the receiver and assume it is non null - Local local = new Local(method.holder().kind(), javaIndex, graph); + LocalNode local = new LocalNode(method.holder().kind(), javaIndex, graph); local.setDeclaredType(method.holder()); storeLocal(javaIndex, local); javaIndex = 1; @@ -83,7 +82,7 @@ for (int i = 0; i < max; i++) { RiType type = sig.argumentTypeAt(i, accessingClass); CiKind kind = type.kind().stackKind(); - Local local = new Local(kind, index, graph); + LocalNode local = new LocalNode(kind, index, graph); if (type.isResolved()) { local.setDeclaredType(type); } @@ -346,13 +345,13 @@ public ValueNode loadLocal(int i) { ValueNode x = locals[i]; if (x != null) { - if (x instanceof Phi) { - assert ((Phi) x).type() == PhiType.Value; + if (x instanceof PhiNode) { + assert ((PhiNode) x).type() == PhiType.Value; if (x.isDeleted()) { return null; } } - assert x.kind.isSingleWord() || locals[i + 1] == null || locals[i + 1] instanceof Phi; + assert x.kind.isSingleWord() || locals[i + 1] == null || locals[i + 1] instanceof PhiNode; } return x; } diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/deopt/FrameModifierImpl.java --- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/deopt/FrameModifierImpl.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/deopt/FrameModifierImpl.java Wed Aug 10 00:34:29 2011 +0200 @@ -26,7 +26,7 @@ import com.oracle.max.graal.extensions.*; import com.sun.cri.ci.*; -import com.sun.cri.ci.CiVirtualObject.*; +import com.sun.cri.ci.CiVirtualObject.CiVirtualObjectFactory; import com.sun.cri.ri.*; diff -r 6b841b6b2437 -r d683f8a40c05 graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/IntrinsifierImpl.java --- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/IntrinsifierImpl.java Tue Aug 09 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/IntrinsifierImpl.java Wed Aug 10 00:34:29 2011 +0200 @@ -25,7 +25,7 @@ import java.util.*; 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.extensions.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -38,7 +38,7 @@ public Graph intrinsicGraph(RiRuntime runtime, RiMethod caller, int bci, RiMethod method, List parameters) { if (method.holder().name().equals("Lcom/oracle/max/graal/examples/intrinsics/SafeAddExample;") && method.name().equals("safeAdd")) { CompilerGraph graph = new CompilerGraph(runtime); - Return returnNode = new Return(new SafeAddNode(new Local(CiKind.Long, 0, graph), new Local(CiKind.Long, 1, graph), graph), graph); + ReturnNode returnNode = new ReturnNode(new SafeAddNode(new LocalNode(CiKind.Long, 0, graph), new LocalNode(CiKind.Long, 1, graph), graph), graph); graph.start().setNext(returnNode); graph.setReturn(returnNode); return graph; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAddNode.java Wed Aug 10 00:34:29 2011 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.max.graal.examples.intrinsics; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.calc.*; 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.*; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/opt/OptimizerImpl.java Wed Aug 10 00:34:29 2011 +0200 @@ -23,8 +23,8 @@ package com.oracle.max.graal.examples.opt; 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.calc.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.examples.intrinsics.*; import com.oracle.max.graal.extensions.*; @@ -42,7 +42,7 @@ for (SafeAddNode safeAdd : graph.getNodes(SafeAddNode.class)) { if (!canOverflow(safeAdd)) { // if an overflow is impossible: replace with normal add - IntegerAdd add = new IntegerAdd(CiKind.Int, safeAdd.x(), safeAdd.y(), graph); + IntegerAddNode add = new IntegerAddNode(CiKind.Int, safeAdd.x(), safeAdd.y(), graph); safeAdd.replaceAndDelete(add); } } @@ -52,11 +52,11 @@ // if this SafeAddNode always adds 1 ... if (safeAdd.y().isConstant() && safeAdd.y().asConstant().asLong() == 1) { // ... to a phi ... - if (safeAdd.x() instanceof Phi) { - Phi phi = (Phi) safeAdd.x(); + if (safeAdd.x() instanceof PhiNode) { + PhiNode phi = (PhiNode) safeAdd.x(); // ... that belongs to a loop and merges into itself ... - if (phi.merge() instanceof LoopBegin && phi.valueAt(1) == safeAdd) { - LoopBegin loopBegin = (LoopBegin) phi.merge(); + if (phi.merge() instanceof LoopBeginNode && phi.valueAt(1) == safeAdd) { + LoopBeginNode loopBegin = (LoopBeginNode) phi.merge(); // ... then do the heavy analysis. return canOverflow(phi, loopBegin); } @@ -65,7 +65,7 @@ return true; } - private boolean canOverflow(Phi phi, LoopBegin loopBegin) { + private boolean canOverflow(PhiNode phi, LoopBeginNode loopBegin) { NodeBitMap nodes = LoopUtil.markUpCFG(loopBegin); NodeBitMap exits = LoopUtil.computeLoopExits(loopBegin, nodes); // look at all loop exits: @@ -73,11 +73,11 @@ TTY.println("exit: " + exit); Node pred = exit.predecessor(); // if this exit is an If node ... - if (pred instanceof If) { - If ifNode = (If) pred; + if (pred instanceof IfNode) { + IfNode ifNode = (IfNode) pred; // ... which compares ... - if (ifNode.compare() instanceof Compare) { - Compare compare = (Compare) ifNode.compare(); + if (ifNode.compare() instanceof CompareNode) { + CompareNode compare = (CompareNode) ifNode.compare(); Condition cond = compare.condition(); ValueNode x = compare.x(); ValueNode y = compare.y(); diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java Wed Aug 10 00:34:29 2011 +0200 @@ -28,10 +28,11 @@ import com.oracle.max.graal.compiler.*; 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.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.calc.*; +import com.oracle.max.graal.compiler.nodes.calc.ConditionalNode.ConditionalStructure; import com.oracle.max.graal.compiler.nodes.extended.*; +import com.oracle.max.graal.compiler.nodes.java.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.runtime.nodes.*; import com.sun.cri.bytecode.*; @@ -257,8 +258,8 @@ return; } - if (n instanceof LoadField) { - LoadField field = (LoadField) n; + if (n instanceof LoadFieldNode) { + LoadFieldNode field = (LoadFieldNode) n; if (field.isVolatile()) { return; } @@ -266,7 +267,7 @@ int displacement = ((HotSpotField) field.field()).offset(); assert field.kind != CiKind.Illegal; ReadNode memoryRead = new ReadNode(field.field().kind().stackKind(), field.object(), LocationNode.create(field.field(), field.field().kind(), displacement, graph), graph); - memoryRead.setGuard((GuardNode) tool.createGuard(new IsNonNull(field.object(), graph))); + memoryRead.setGuard((GuardNode) tool.createGuard(new IsNonNullNode(field.object(), graph))); FixedNode next = field.next(); field.setNext(null); memoryRead.setNext(next); @@ -279,7 +280,7 @@ Graph graph = field.graph(); int displacement = ((HotSpotField) field.field()).offset(); WriteNode memoryWrite = new WriteNode(CiKind.Illegal, field.object(), field.value(), LocationNode.create(field.field(), field.field().kind(), displacement, graph), graph); - memoryWrite.setGuard((GuardNode) tool.createGuard(new IsNonNull(field.object(), graph))); + memoryWrite.setGuard((GuardNode) tool.createGuard(new IsNonNullNode(field.object(), graph))); memoryWrite.setStateAfter(field.stateAfter()); FixedNode next = field.next(); field.setNext(null); @@ -291,8 +292,8 @@ memoryWrite.setNext(next); } field.replaceAndDelete(memoryWrite); - } else if (n instanceof LoadIndexed) { - LoadIndexed loadIndexed = (LoadIndexed) n; + } else if (n instanceof LoadIndexedNode) { + LoadIndexedNode loadIndexed = (LoadIndexedNode) n; Graph graph = loadIndexed.graph(); GuardNode boundsCheck = createBoundsCheck(loadIndexed, tool); @@ -308,7 +309,7 @@ } else if (n instanceof StoreIndexedNode) { StoreIndexedNode storeIndexed = (StoreIndexedNode) n; Graph graph = storeIndexed.graph(); - Anchor anchor = new Anchor(graph); + AnchorNode anchor = new AnchorNode(graph); GuardNode boundsCheck = createBoundsCheck(storeIndexed, tool); anchor.addGuard(boundsCheck); @@ -323,14 +324,14 @@ if (array.exactType() != null) { RiType elementType = array.exactType().componentType(); if (elementType.superType() != null) { - Constant type = new Constant(elementType.getEncoding(Representation.ObjectHub), graph); - value = new CheckCast(type, value, graph); + ConstantNode type = new ConstantNode(elementType.getEncoding(Representation.ObjectHub), graph); + value = new CheckCastNode(type, value, graph); } else { assert elementType.name().equals("Ljava/lang/Object;") : elementType.name(); } } else { ReadNode arrayElementKlass = readArrayElementKlass(graph, array); - value = new CheckCast(arrayElementKlass, value, graph); + value = new CheckCastNode(arrayElementKlass, value, graph); } } WriteNode memoryWrite = new WriteNode(elementKind.stackKind(), array, value, arrayLocation, graph); @@ -356,7 +357,7 @@ location.setIndex(load.offset()); location.setIndexScalingEnabled(false); ReadNode memoryRead = new ReadNode(load.kind.stackKind(), load.object(), location, graph); - memoryRead.setGuard((GuardNode) tool.createGuard(new IsNonNull(load.object(), graph))); + memoryRead.setGuard((GuardNode) tool.createGuard(new IsNonNullNode(load.object(), graph))); FixedNode next = load.next(); load.setNext(null); memoryRead.setNext(next); @@ -390,8 +391,8 @@ return LocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, config.getArrayOffset(elementKind), graph); } - private GuardNode createBoundsCheck(AccessIndexed n, CiLoweringTool tool) { - return (GuardNode) tool.createGuard(new Compare(n.index(), Condition.BT, n.length(), n.graph())); + private GuardNode createBoundsCheck(AccessIndexedNode n, CiLoweringTool tool) { + return (GuardNode) tool.createGuard(new CompareNode(n.index(), Condition.BT, n.length(), n.graph())); } @Override @@ -403,9 +404,9 @@ if (holderName.equals("Ljava/lang/Object;")) { if (fullName.equals("getClass()Ljava/lang/Class;")) { CompilerGraph graph = new CompilerGraph(this); - Local receiver = new Local(CiKind.Object, 0, graph); + LocalNode receiver = new LocalNode(CiKind.Object, 0, graph); ReadNode klassOop = readHub(graph, receiver); - Return ret = new Return(new ReadNode(CiKind.Object, klassOop, LocationNode.create(LocationNode.FINAL_LOCATION, CiKind.Object, config.classMirrorOffset, graph), graph), graph); + ReturnNode ret = new ReturnNode(new ReadNode(CiKind.Object, klassOop, LocationNode.create(LocationNode.FINAL_LOCATION, CiKind.Object, config.classMirrorOffset, graph), graph), graph); graph.start().setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); @@ -413,11 +414,11 @@ } else if (holderName.equals("Ljava/lang/System;")) { if (fullName.equals("arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V")) { CompilerGraph graph = new CompilerGraph(this); - Local src = new Local(CiKind.Object, 0, graph); - Local srcPos = new Local(CiKind.Int, 1, graph); - Local dest = new Local(CiKind.Object, 2, graph); - Local destPos = new Local(CiKind.Int, 3, graph); - ValueNode length = new Local(CiKind.Int, 4, graph); + LocalNode src = new LocalNode(CiKind.Object, 0, graph); + LocalNode srcPos = new LocalNode(CiKind.Int, 1, graph); + LocalNode dest = new LocalNode(CiKind.Object, 2, graph); + LocalNode destPos = new LocalNode(CiKind.Int, 3, graph); + ValueNode length = new LocalNode(CiKind.Int, 4, graph); src.setDeclaredType(((ValueNode) parameters.get(0)).declaredType()); dest.setDeclaredType(((ValueNode) parameters.get(2)).declaredType()); @@ -442,16 +443,16 @@ FrameState stateAfter = new FrameState(method, FrameState.AFTER_BCI, 0, 0, 0, false, graph); // Add preconditions. - FixedGuard guard = new FixedGuard(graph); - ArrayLength srcLength = new ArrayLength(src, graph); - ArrayLength destLength = new ArrayLength(dest, graph); - IntegerAdd upperLimitSrc = new IntegerAdd(CiKind.Int, srcPos, length, graph); - IntegerAdd upperLimitDest = new IntegerAdd(CiKind.Int, destPos, length, graph); - guard.addNode(new Compare(srcPos, Condition.BE, srcLength, graph)); - guard.addNode(new Compare(destPos, Condition.BE, destLength, graph)); - guard.addNode(new Compare(length, Condition.GE, Constant.forInt(0, graph), graph)); - guard.addNode(new Compare(upperLimitSrc, Condition.LE, srcLength, graph)); - guard.addNode(new Compare(upperLimitDest, Condition.LE, destLength, graph)); + FixedGuardNode guard = new FixedGuardNode(graph); + ArrayLengthNode srcLength = new ArrayLengthNode(src, graph); + ArrayLengthNode destLength = new ArrayLengthNode(dest, graph); + IntegerAddNode upperLimitSrc = new IntegerAddNode(CiKind.Int, srcPos, length, graph); + IntegerAddNode upperLimitDest = new IntegerAddNode(CiKind.Int, destPos, length, graph); + guard.addNode(new CompareNode(srcPos, Condition.BE, srcLength, graph)); + guard.addNode(new CompareNode(destPos, Condition.BE, destLength, graph)); + guard.addNode(new CompareNode(length, Condition.GE, ConstantNode.forInt(0, graph), graph)); + guard.addNode(new CompareNode(upperLimitSrc, Condition.LE, srcLength, graph)); + guard.addNode(new CompareNode(upperLimitDest, Condition.LE, destLength, graph)); graph.start().setNext(guard); LocationNode location = LocationNode.create(LocationNode.FINAL_LOCATION, componentType, config.getArrayOffset(componentType), graph); @@ -468,27 +469,27 @@ new WriteVectorNode(new IntegerAddVectorNode(reverseVector, destPos, graph), dest, location, reverseValues, graph); reverseVector.setStateAfter(stateAfter); - If ifNode = new If(new Compare(src, Condition.EQ, dest, graph), 0.5, graph); + IfNode ifNode = new IfNode(new CompareNode(src, Condition.EQ, dest, graph), 0.5, graph); guard.setNext(ifNode); - If secondIf = new If(new Compare(srcPos, Condition.LT, destPos, graph), 0.5, graph); + IfNode secondIf = new IfNode(new CompareNode(srcPos, Condition.LT, destPos, graph), 0.5, graph); ifNode.setTrueSuccessor(secondIf); secondIf.setTrueSuccessor(reverseVector); - Merge merge1 = new Merge(graph); + MergeNode merge1 = new MergeNode(graph); merge1.addEnd(new EndNode(graph)); merge1.addEnd(new EndNode(graph)); merge1.setStateAfter(stateBefore); - Invoke newInvoke = null; + InvokeNode newInvoke = null; if (componentType == CiKind.Object) { 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 elementClassIf = new IfNode(new CompareNode(srcClass, Condition.EQ, destClass, graph), 0.5, graph); ifNode.setFalseSuccessor(elementClassIf); - newInvoke = new Invoke(bci, Bytecodes.INVOKESTATIC, CiKind.Void, new ValueNode[]{src, srcPos, dest, destPos, length}, method, method.signature().returnType(method.holder()), graph); + newInvoke = new InvokeNode(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); @@ -500,7 +501,7 @@ secondIf.setFalseSuccessor(merge1.endAt(1)); merge1.setNext(normalVector); - Merge merge2 = new Merge(graph); + MergeNode merge2 = new MergeNode(graph); merge2.addEnd(new EndNode(graph)); merge2.addEnd(new EndNode(graph)); merge2.setStateAfter(stateAfter); @@ -513,7 +514,7 @@ newInvoke.setNext(merge2.endAt(2)); } - Return ret = new Return(null, graph); + ReturnNode ret = new ReturnNode(null, graph); merge2.setNext(ret); graph.setReturn(ret); return graph; @@ -521,25 +522,25 @@ } else if (holderName.equals("Ljava/lang/Float;")) { //XXX (gd) the non-raw versions of (F/D)2(I/L) should return a sanitized NaN in the NaN case. if (fullName.equals("floatToRawIntBits(F)I")) { CompilerGraph graph = new CompilerGraph(this); - Return ret = new Return(new FPConversionNode(CiKind.Int, new Local(CiKind.Float, 0, graph), graph), graph); + ReturnNode ret = new ReturnNode(new FPConversionNode(CiKind.Int, new LocalNode(CiKind.Float, 0, graph), graph), graph); graph.start().setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); } else if (fullName.equals("floatToIntBits(F)I")) { CompilerGraph graph = new CompilerGraph(this); - Local arg = new Local(CiKind.Float, 0, graph); - Compare isNan = new Compare(arg, Condition.NE, arg, graph); + LocalNode arg = new LocalNode(CiKind.Float, 0, graph); + CompareNode isNan = new CompareNode(arg, Condition.NE, arg, graph); isNan.setUnorderedIsTrue(true); FPConversionNode fpConv = new FPConversionNode(CiKind.Int, arg, graph); - ConditionalStructure conditionalStructure = Conditional.createConditionalStructure(isNan, Constant.forInt(FLOATNAN_RAW_INT_BITS, graph), fpConv, 0.1); - Return ret = new Return(conditionalStructure.phi, graph); + ConditionalStructure conditionalStructure = ConditionalNode.createConditionalStructure(isNan, ConstantNode.forInt(FLOATNAN_RAW_INT_BITS, graph), fpConv, 0.1); + ReturnNode ret = new ReturnNode(conditionalStructure.phi, graph); graph.start().setNext(conditionalStructure.ifNode); conditionalStructure.merge.setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); } else if (fullName.equals("intBitsToFloat(I)F")) { CompilerGraph graph = new CompilerGraph(this); - Return ret = new Return(new FPConversionNode(CiKind.Float, new Local(CiKind.Int, 0, graph), graph), graph); + ReturnNode ret = new ReturnNode(new FPConversionNode(CiKind.Float, new LocalNode(CiKind.Int, 0, graph), graph), graph); graph.start().setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); @@ -547,25 +548,25 @@ } else if (holderName.equals("Ljava/lang/Double;")) { if (fullName.equals("doubleToRawLongBits(D)J")) { CompilerGraph graph = new CompilerGraph(this); - Return ret = new Return(new FPConversionNode(CiKind.Long, new Local(CiKind.Double, 0, graph), graph), graph); + ReturnNode ret = new ReturnNode(new FPConversionNode(CiKind.Long, new LocalNode(CiKind.Double, 0, graph), graph), graph); graph.start().setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); } else if (fullName.equals("doubleToLongBits(D)J")) { CompilerGraph graph = new CompilerGraph(this); - Local arg = new Local(CiKind.Double, 0, graph); - Compare isNan = new Compare(arg, Condition.NE, arg, graph); + LocalNode arg = new LocalNode(CiKind.Double, 0, graph); + CompareNode isNan = new CompareNode(arg, Condition.NE, arg, graph); isNan.setUnorderedIsTrue(true); FPConversionNode fpConv = new FPConversionNode(CiKind.Long, arg, graph); - ConditionalStructure conditionalStructure = Conditional.createConditionalStructure(isNan, Constant.forLong(DOUBLENAN_RAW_LONG_BITS, graph), fpConv, 0.1); - Return ret = new Return(conditionalStructure.phi, graph); + ConditionalStructure conditionalStructure = ConditionalNode.createConditionalStructure(isNan, ConstantNode.forLong(DOUBLENAN_RAW_LONG_BITS, graph), fpConv, 0.1); + ReturnNode ret = new ReturnNode(conditionalStructure.phi, graph); graph.start().setNext(conditionalStructure.ifNode); conditionalStructure.merge.setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); } else if (fullName.equals("longBitsToDouble(J)D")) { CompilerGraph graph = new CompilerGraph(this); - Return ret = new Return(new FPConversionNode(CiKind.Double, new Local(CiKind.Long, 0, graph), graph), graph); + ReturnNode ret = new ReturnNode(new FPConversionNode(CiKind.Double, new LocalNode(CiKind.Long, 0, graph), graph), graph); graph.start().setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); @@ -573,7 +574,7 @@ } else if (holderName.equals("Ljava/lang/Thread;")) { if (fullName.equals("currentThread()Ljava/lang/Thread;")) { CompilerGraph graph = new CompilerGraph(this); - Return ret = new Return(new CurrentThread(config.threadObjectOffset, graph), graph); + ReturnNode ret = new ReturnNode(new CurrentThread(config.threadObjectOffset, graph), graph); graph.start().setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); @@ -581,40 +582,40 @@ } else if (holderName.equals("Lsun/misc/Unsafe;")) { if (fullName.equals("getObject(Ljava/lang/Object;J)Ljava/lang/Object;")) { CompilerGraph graph = new CompilerGraph(this); - Local object = new Local(CiKind.Object, 1, graph); - Local offset = new Local(CiKind.Long, 2, graph); + LocalNode object = new LocalNode(CiKind.Object, 1, graph); + LocalNode offset = new LocalNode(CiKind.Long, 2, graph); UnsafeLoad load = new UnsafeLoad(object, offset, CiKind.Object, graph); - Return ret = new Return(load, graph); + ReturnNode ret = new ReturnNode(load, graph); load.setNext(ret); graph.start().setNext(load); graph.setReturn(ret); intrinsicGraphs.put(method, graph); } else if (fullName.equals("putObject(Ljava/lang/Object;JLjava/lang/Object;)V")) { CompilerGraph graph = new CompilerGraph(this); - Local object = new Local(CiKind.Object, 1, graph); - Local offset = new Local(CiKind.Long, 2, graph); - Local value = new Local(CiKind.Object, 3, graph); + LocalNode object = new LocalNode(CiKind.Object, 1, graph); + LocalNode offset = new LocalNode(CiKind.Long, 2, graph); + LocalNode value = new LocalNode(CiKind.Object, 3, graph); UnsafeStore store = new UnsafeStore(object, offset, value, CiKind.Object, graph); FrameState frameState = new FrameState(method, FrameState.AFTER_BCI, 0, 0, 0, false, graph); store.setStateAfter(frameState); - Return ret = new Return(null, graph); + ReturnNode ret = new ReturnNode(null, graph); store.setNext(ret); graph.start().setNext(store); graph.setReturn(ret); intrinsicGraphs.put(method, graph); } } else if (holderName.equals("Ljava/lang/Math;")) { - MathIntrinsic.Operation op = null; + MathIntrinsicNode.Operation op = null; if (fullName.equals("abs(D)D")) { - op = MathIntrinsic.Operation.ABS; + op = MathIntrinsicNode.Operation.ABS; } else if (fullName.equals("sqrt(D)D")) { - op = MathIntrinsic.Operation.SQRT; + op = MathIntrinsicNode.Operation.SQRT; } if (op != null) { CompilerGraph graph = new CompilerGraph(this); - Local value = new Local(CiKind.Double, 0, graph); - MathIntrinsic min = new MathIntrinsic(value, op, graph); - Return ret = new Return(min, graph); + LocalNode value = new LocalNode(CiKind.Double, 0, graph); + MathIntrinsicNode min = new MathIntrinsicNode(value, op, graph); + ReturnNode ret = new ReturnNode(min, graph); graph.start().setNext(ret); graph.setReturn(ret); intrinsicGraphs.put(method, graph); diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/ArrayWriteBarrier.java Wed Aug 10 00:34:29 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.runtime.nodes; -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.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/CurrentThread.java Wed Aug 10 00:34:29 2011 +0200 @@ -23,7 +23,7 @@ package com.oracle.max.graal.runtime.nodes; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.compiler.nodes.calc.*; import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FPConversionNode.java Wed Aug 10 00:34:29 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.runtime.nodes; -import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.compiler.nodes.calc.*; import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; @@ -70,16 +70,16 @@ @Override public Node canonical(NotifyReProcess reProcess) { - if (value instanceof Constant) { + if (value instanceof ConstantNode) { CiKind fromKind = value.kind; if (kind == CiKind.Int && fromKind == CiKind.Float) { - return Constant.forInt(Float.floatToRawIntBits(((Constant) value).asConstant().asFloat()), graph()); + return ConstantNode.forInt(Float.floatToRawIntBits(((ConstantNode) value).asConstant().asFloat()), graph()); } else if (kind == CiKind.Long && fromKind == CiKind.Double) { - return Constant.forLong(Double.doubleToRawLongBits(((Constant) value).asConstant().asDouble()), graph()); + return ConstantNode.forLong(Double.doubleToRawLongBits(((ConstantNode) value).asConstant().asDouble()), graph()); } else if (kind == CiKind.Float && fromKind == CiKind.Int) { - return Constant.forFloat(Float.intBitsToFloat(((Constant) value).asConstant().asInt()), graph()); + return ConstantNode.forFloat(Float.intBitsToFloat(((ConstantNode) value).asConstant().asInt()), graph()); } else if (kind == CiKind.Double && fromKind == CiKind.Long) { - return Constant.forDouble(Double.longBitsToDouble(((Constant) value).asConstant().asLong()), graph()); + return ConstantNode.forDouble(Double.longBitsToDouble(((ConstantNode) value).asConstant().asLong()), graph()); } } return this; diff -r 6b841b6b2437 -r d683f8a40c05 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 23:56:10 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/WriteBarrier.java Wed Aug 10 00:34:29 2011 +0200 @@ -22,14 +22,14 @@ */ package com.oracle.max.graal.runtime.nodes; -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.oracle.max.graal.runtime.*; import com.sun.cri.ci.*; -public abstract class WriteBarrier extends FixedNodeWithNext { +public abstract class WriteBarrier extends FixedWithNextNode { public WriteBarrier(Graph graph) { super(CiKind.Illegal, graph);