# HG changeset patch # User Thomas Wuerthinger # Date 1312930073 -7200 # Node ID da773e1b6d9f8197871c6c0d6a275cb34220292b # Parent d683f8a40c05ef24a4cd0553949ec96874f8bee3 Third round of refactoring. diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java Wed Aug 10 00:47:53 2011 +0200 @@ -33,8 +33,8 @@ import com.oracle.max.graal.compiler.gen.LIRGenerator.DeoptimizationStub; import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.lir.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java Wed Aug 10 00:47:53 2011 +0200 @@ -27,8 +27,8 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.lir.*; -import com.oracle.max.graal.compiler.nodes.calc.*; import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java Wed Aug 10 00:47:53 2011 +0200 @@ -26,7 +26,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.lir.*; -import com.oracle.max.graal.compiler.nodes.calc.*; +import com.oracle.max.graal.nodes.calc.*; /** * This class optimizes moves, particularly those that result from eliminating SSA form. diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Wed Aug 10 00:47:53 2011 +0200 @@ -37,14 +37,14 @@ import com.oracle.max.graal.compiler.graph.*; 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.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.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.FrameState.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.virtual.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Wed Aug 10 00:47:53 2011 +0200 @@ -25,8 +25,8 @@ import java.util.*; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/BlockPrinter.java Wed Aug 10 00:47:53 2011 +0200 @@ -23,10 +23,10 @@ package 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.schedule.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; /** * Prints a listing for a {@linkplain MergeNode block}. diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Wed Aug 10 00:47:53 2011 +0200 @@ -31,10 +31,10 @@ import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.lir.*; import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFormatter; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiAddress.Scale; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java Wed Aug 10 00:47:53 2011 +0200 @@ -26,10 +26,10 @@ import java.util.regex.*; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graphviz.*; +import com.oracle.max.graal.nodes.base.*; /** * Observes compilation events and uses {@link GraphvizPrinter} to produce a control flow graph in the DOT language diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Wed Aug 10 00:47:53 2011 +0200 @@ -28,13 +28,13 @@ import java.util.Map.Entry; import com.oracle.max.graal.compiler.*; -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; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.loop.*; import com.sun.cri.bytecode.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java Wed Aug 10 00:47:53 2011 +0200 @@ -27,9 +27,9 @@ import java.util.regex.*; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ri.*; /** diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/InstructionPrinter.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,8 +24,8 @@ import static com.oracle.max.graal.compiler.debug.InstructionPrinter.InstructionLineColumn.*; -import com.oracle.max.graal.compiler.nodes.base.*; -import com.oracle.max.graal.compiler.nodes.spi.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; /** * A {@link ValueVisitor} for {@linkplain #printInstruction(ValueNode) printing} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/LogStream.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/LogStream.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/LogStream.java Wed Aug 10 00:47:53 2011 +0200 @@ -25,8 +25,8 @@ import java.io.*; import java.util.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.nodes.base.*; /** * A utility for printing compiler debug and informational output to an output stream. @@ -451,7 +451,7 @@ } /** - * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.compiler.nodes.base.ValueNode) value} to this stream. + * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.nodes.base.ValueNode) value} to this stream. * * @param value the instruction to print * @return this {@code LogStream} instance @@ -465,7 +465,7 @@ } /** - * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.compiler.nodes.base.ValueNode) value} to this stream + * Writes an instruction formatted as a {@linkplain com.oracle.max.graal.compiler.util.Util#valueString(com.oracle.max.graal.nodes.base.ValueNode) value} to this stream * followed by a {@linkplain #LINE_SEPARATOR line separator}. * * @param value the instruction to print diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Wed Aug 10 00:47:53 2011 +0200 @@ -38,16 +38,16 @@ import com.oracle.max.graal.compiler.globalstub.*; import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.lir.*; -import com.oracle.max.graal.compiler.nodes.base.*; -import com.oracle.max.graal.compiler.nodes.base.DeoptimizeNode.DeoptAction; -import com.oracle.max.graal.compiler.nodes.base.FrameState.ValueProcedure; -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.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.DeoptimizeNode.*; +import com.oracle.max.graal.nodes.base.FrameState.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.java.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.bytecode.*; import com.sun.cri.bytecode.Bytecodes.MemoryBarriers; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRItem.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRItem.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRItem.java Wed Aug 10 00:47:53 2011 +0200 @@ -23,8 +23,8 @@ package com.oracle.max.graal.compiler.gen; import com.oracle.max.graal.compiler.alloc.OperandPool.VariableFlag; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java Wed Aug 10 00:47:53 2011 +0200 @@ -26,7 +26,7 @@ import java.util.*; -import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiSimplifier.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.max.graal.compiler.gen; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; /** * The {@code PhiSimplifier} class is a helper class that can reduce phi instructions. diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/BlockMap.java Wed Aug 10 00:47:53 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.nodes.base.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/CompilerGraph.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.graph; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Wed Aug 10 00:47:53 2011 +0200 @@ -27,12 +27,12 @@ import com.oracle.max.graal.compiler.*; 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.*; import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.extensions.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; /** * This class implements the overall container for the HIR (high-level IR) graph diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/MergeableState.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.nodes.base.*; public interface MergeableState { T clone(); diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/PostOrderNodeIterator.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,9 +24,9 @@ import java.util.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; public abstract class PostOrderNodeIterator> { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRAssembler.java Wed Aug 10 00:47:53 2011 +0200 @@ -30,8 +30,8 @@ import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.gen.*; 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.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiTargetMethod.Mark; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java Wed Aug 10 00:47:53 2011 +0200 @@ -27,10 +27,10 @@ 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.nodes.base.*; -import com.oracle.max.graal.compiler.nodes.java.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.java.*; /** * The {@code LIRBlock} class definition. diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBranch.java Wed Aug 10 00:47:53 2011 +0200 @@ -23,7 +23,7 @@ package com.oracle.max.graal.compiler.lir; import com.oracle.max.asm.*; -import com.oracle.max.graal.compiler.nodes.calc.*; +import com.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java Wed Aug 10 00:47:53 2011 +0200 @@ -23,8 +23,8 @@ package com.oracle.max.graal.compiler.lir; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java Wed Aug 10 00:47:53 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.nodes.calc.*; +import com.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiTargetMethod.Mark; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIROp2.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.lir; -import com.oracle.max.graal.compiler.nodes.calc.*; +import com.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/AnchorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/AnchorNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/BooleanNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/BooleanNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/CastNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/CastNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ConstantNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ConstantNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ControlSplitNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ControlSplitNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/DeoptimizeNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/DeoptimizeNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/EndNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/EndNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedGuardNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedGuardNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedWithNextNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/FixedWithNextNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,674 +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.base; - -import static com.oracle.max.graal.compiler.value.ValueUtil.*; - -import java.util.*; - -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.*; -import com.sun.cri.ri.*; - -/** - * The {@code FrameState} class encapsulates the frame state (i.e. local variables and - * operand stack) at a particular point in the abstract interpretation. - */ -public final class FrameState extends ValueNode implements FrameStateAccess { - - protected final int localsSize; - - protected final int stackSize; - - protected final int locksSize; - - private boolean rethrowException; - - public static final int BEFORE_BCI = -2; - public static final int AFTER_BCI = -3; - - @Input private FrameState outerFrameState; - - @Input private final NodeInputList values; - - @Input private final NodeInputList virtualObjectMappings; - - public FrameState outerFrameState() { - return outerFrameState; - } - - public void setOuterFrameState(FrameState x) { - updateUsages(this.outerFrameState, x); - this.outerFrameState = x; - } - - @Override - public void setValueAt(int i, ValueNode x) { - values.set(i, x); - } - - /** - * The bytecode index to which this frame state applies. This will be {@code -1} - * iff this state is mutable. - */ - public final int bci; - - public final RiMethod method; - - /** - * Creates a {@code FrameState} for the given scope and maximum number of stack and local variables. - * - * @param bci the bytecode index of the frame state - * @param localsSize number of locals - * @param stackSize size of the stack - * @param lockSize number of locks - */ - public FrameState(RiMethod method, int bci, int localsSize, int stackSize, int locksSize, boolean rethrowException, Graph graph) { - super(CiKind.Illegal, graph); - this.method = method; - this.bci = bci; - this.localsSize = localsSize; - this.stackSize = stackSize; - this.locksSize = locksSize; - this.values = new NodeInputList(this, localsSize + stackSize + locksSize); - this.virtualObjectMappings = new NodeInputList(this); - this.rethrowException = rethrowException; - //GraalMetrics.FrameStatesCreated++; - //GraalMetrics.FrameStateValuesCreated += localsSize + stackSize + locksSize; - } - - public FrameState(RiMethod method, int bci, ValueNode[] locals, ValueNode[] stack, int stackSize, ArrayList locks, boolean rethrowException, Graph graph) { - this(method, bci, locals.length, stackSize, locks.size(), rethrowException, graph); - for (int i = 0; i < locals.length; i++) { - setValueAt(i, locals[i]); - } - for (int i = 0; i < stackSize; i++) { - setValueAt(localsSize + i, stack[i]); - } - for (int i = 0; i < locks.size(); i++) { - setValueAt(locals.length + stackSize + i, locks.get(i)); - } - } - - public boolean rethrowException() { - return rethrowException; - } - - public RiMethod method() { - return method; - } - - public void addVirtualObjectMapping(Node virtualObject) { - assert virtualObject instanceof VirtualObjectFieldNode || virtualObject instanceof PhiNode : virtualObject; - virtualObjectMappings.add(virtualObject); - } - - public int virtualObjectMappingCount() { - return virtualObjectMappings.size(); - } - - public Node virtualObjectMappingAt(int i) { - return virtualObjectMappings.get(i); - } - - public Iterable virtualObjectMappings() { - return virtualObjectMappings; - } - - /** - * Gets a copy of this frame state. - */ - public FrameState duplicate(int bci) { - return duplicate(bci, false); - } - - public FrameState duplicate(int bci, boolean duplicateOuter) { - FrameState other = new FrameState(method, bci, localsSize, stackSize, locksSize, rethrowException, graph()); - other.values.setAll(values); - other.virtualObjectMappings.setAll(virtualObjectMappings); - FrameState outerFrameState = outerFrameState(); - if (duplicateOuter && outerFrameState != null) { - outerFrameState = outerFrameState.duplicate(outerFrameState.bci, duplicateOuter); - } - other.setOuterFrameState(outerFrameState); - return other; - } - - @Override - public FrameState duplicateWithException(int bci, ValueNode exceptionObject) { - return duplicateModified(bci, true, CiKind.Void, exceptionObject); - } - - /** - * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the - * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long - * or double is followed by a null slot. - */ - public FrameState duplicateModified(int bci, boolean rethrowException, CiKind popKind, ValueNode... pushedValues) { - int popSlots = popKind.sizeInSlots(); - int pushSlots = pushedValues.length; - FrameState other = new FrameState(method, bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), rethrowException, graph()); - for (int i = 0; i < localsSize; i++) { - other.setValueAt(i, localAt(i)); - } - for (int i = 0; i < stackSize - popSlots; i++) { - other.setValueAt(localsSize + i, stackAt(i)); - } - int slot = localsSize + stackSize - popSlots; - for (int i = 0; i < pushSlots; i++) { - other.setValueAt(slot++, pushedValues[i]); - } - for (int i = 0; i < locksSize; i++) { - other.setValueAt(localsSize + other.stackSize + i, lockAt(i)); - } - other.virtualObjectMappings.setAll(virtualObjectMappings); - other.setOuterFrameState(outerFrameState()); - return other; - } - - public boolean isCompatibleWith(FrameStateAccess other) { - if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { - return false; - } - for (int i = 0; i < stackSize(); i++) { - ValueNode x = stackAt(i); - ValueNode y = other.stackAt(i); - if (x != y && typeMismatch(x, y)) { - return false; - } - } - for (int i = 0; i < locksSize(); i++) { - if (lockAt(i) != other.lockAt(i)) { - return false; - } - } - if (other.outerFrameState() != outerFrameState()) { - return false; - } - return true; - } - - public boolean equals(FrameStateAccess other) { - if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { - return false; - } - for (int i = 0; i < stackSize(); i++) { - ValueNode x = stackAt(i); - ValueNode y = other.stackAt(i); - if (x != y) { - return false; - } - } - for (int i = 0; i < locksSize(); i++) { - if (lockAt(i) != other.lockAt(i)) { - return false; - } - } - if (other.outerFrameState() != outerFrameState()) { - return false; - } - return true; - } - - /** - * Gets the size of the local variables. - */ - public int localsSize() { - return localsSize; - } - - /** - * Gets the current size (height) of the stack. - */ - public int stackSize() { - return stackSize; - } - - /** - * Gets number of locks held by this frame state. - */ - public int locksSize() { - return locksSize; - } - - /** - * Invalidates the local variable at the specified index. If the specified index refers to a doubleword local, then - * invalidates the high word as well. - * - * @param i the index of the local to invalidate - */ - public void invalidateLocal(int i) { - // note that for double word locals, the high slot should already be null - // unless the local is actually dead and the high slot is being reused; - // in either case, it is not necessary to null the high slot - setValueAt(i, null); - } - - /** - * Stores a given local variable at the specified index. If the value is a {@linkplain CiKind#isDoubleWord() double word}, - * then the next local variable index is also overwritten. - * - * @param i the index at which to store - * @param x the instruction which produces the value for the local - */ - public void storeLocal(int i, ValueNode x) { - assert i < localsSize : "local variable index out of range: " + i; - invalidateLocal(i); - setValueAt(i, x); - if (isDoubleWord(x)) { - // (tw) if this was a double word then kill i+1 - setValueAt(i + 1, null); - } - if (i > 0) { - // if there was a double word at i - 1, then kill it - ValueNode p = localAt(i - 1); - if (isDoubleWord(p)) { - setValueAt(i - 1, null); - } - } - } - - /** - * Gets the value in the local variables at the specified index. - * - * @param i the index into the locals - * @return the instruction that produced the value for the specified local - */ - public ValueNode localAt(int i) { - assert i < localsSize : "local variable index out of range: " + i; - return valueAt(i); - } - - /** - * Get the value on the stack at the specified stack index. - * - * @param i the index into the stack, with {@code 0} being the bottom of the stack - * @return the instruction at the specified position in the stack - */ - public ValueNode stackAt(int i) { - assert i >= 0 && i < (localsSize + stackSize); - return valueAt(localsSize + i); - } - - /** - * Retrieves the lock at the specified index in the lock stack. - * @param i the index into the lock stack - * @return the instruction which produced the object at the specified location in the lock stack - */ - public ValueNode lockAt(int i) { - assert i >= 0; - return valueAt(localsSize + stackSize + i); - } - - /** - * Inserts a phi statement into the stack at the specified stack index. - * @param block the block begin for which we are creating the phi - * @param i the index into the stack for which to create a phi - */ - public PhiNode setupPhiForStack(MergeNode block, int i) { - ValueNode p = stackAt(i); - if (p != null) { - if (p instanceof PhiNode) { - PhiNode phi = (PhiNode) p; - if (phi.merge() == block) { - return phi; - } - } - PhiNode phi = new PhiNode(p.kind, block, PhiType.Value, graph()); - setValueAt(localsSize + i, phi); - return phi; - } - return null; - } - - /** - * Inserts a phi statement for the local at the specified index. - * @param block the block begin for which we are creating the phi - * @param i the index of the local variable for which to create the phi - */ - public PhiNode setupPhiForLocal(MergeNode block, int i) { - ValueNode p = localAt(i); - if (p instanceof PhiNode) { - PhiNode phi = (PhiNode) p; - if (phi.merge() == block) { - return phi; - } - } - PhiNode phi = new PhiNode(p.kind, block, PhiType.Value, graph()); - storeLocal(i, phi); - return phi; - } - - /** - * Gets the value at a specified index in the set of operand stack and local values represented by this frame. - * This method should only be used to iterate over all the values in this frame, irrespective of whether - * they are on the stack or in local variables. - * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. - * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. - * - * @param i a value in the range {@code [0 .. valuesSize()]} - * @return the value at index {@code i} which may be {@code null} - */ - public ValueNode valueAt(int i) { - assert i < (localsSize + stackSize + locksSize); - return values.isEmpty() ? null : values.get(i); - } - - /** - * The number of operand stack slots and local variables in this frame. - * This method should typically only be used in conjunction with {@link #valueAt(int)}. - * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. - * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. - * - * @return the number of local variables in this frame - */ - public int valuesSize() { - return localsSize + stackSize; - } - - private void checkSize(FrameStateAccess other) { - if (other.stackSize() != stackSize()) { - throw new CiBailout("stack sizes do not match"); - } else if (other.localsSize() != localsSize) { - throw new CiBailout("local sizes do not match"); - } - } - - public void merge(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 PhiNode) && ((PhiNode) x).merge() == block)) { - if (typeMismatch(x, y)) { - if ((x instanceof PhiNode) && ((PhiNode) x).merge() == block) { - x.replaceAtUsages(null); - x.delete(); - } - setValueAt(i, null); - continue; - } - PhiNode phi = null; - if (i < localsSize) { - // this a local - phi = setupPhiForLocal(block, i); - } else { - // this is a stack slot - phi = setupPhiForStack(block, i - localsSize); - } - - if (phi.valueCount() == 0) { - int size = block.phiPredecessorCount(); - for (int j = 0; j < size; ++j) { - phi.addInput(x); - } - phi.addInput((x == y) ? phi : y); - } else { - phi.addInput((x == y) ? phi : y); - } - - assert phi.valueCount() == block.phiPredecessorCount() + (block instanceof LoopBeginNode ? 0 : 1) : "valueCount=" + phi.valueCount() + " predSize= " + block.phiPredecessorCount(); - } - } - } - } - - public MergeNode block() { - for (Node n : usages()) { - if (n instanceof MergeNode) { - return (MergeNode) n; - } - } - return null; - } - - public StateSplit stateSplit() { - for (Node n : usages()) { - if (n instanceof StateSplit) { - return (StateSplit) n; - } - } - return null; - } - - public Iterable innerFrameStates() { - final Iterator iterator = usages().iterator(); - return new Iterable() { - @Override - public Iterator iterator() { - return new Iterator() { - private Node next; - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - @Override - public FrameState next() { - forward(); - if (!hasNext()) { - throw new NoSuchElementException(); - } - FrameState res = (FrameState) next; - next = null; - return res; - } - @Override - public boolean hasNext() { - forward(); - return next != null; - } - private void forward() { - while (!(next instanceof FrameState) && iterator.hasNext()) { - next = iterator.next(); - } - } - }; - } - }; - } - - /** - * The interface implemented by a client of {@link FrameState#forEachPhi(MergeNode, PhiProcedure)} and - * {@link FrameState#forEachLivePhi(MergeNode, PhiProcedure)}. - */ - public static interface PhiProcedure { - boolean doPhi(PhiNode phi); - } - - /** - * 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 PhiNode) { - return true; - } - } - return false; - } - - /** - * The interface implemented by a client of {@link FrameState#forEachLiveStateValue(ValueProcedure)}. - */ - public static interface ValueProcedure { - void doValue(ValueNode value); - } - - /** - * Traverses all {@linkplain ValueNode#isLive() live values} of this frame state. - * - * @param proc the call back called to process each live value traversed - */ - public void forEachLiveStateValue(ValueProcedure proc) { - HashSet vobjs = null; - FrameState current = this; - do { - for (int i = 0; i < current.valuesSize(); i++) { - ValueNode value = current.valueAt(i); - if (value instanceof VirtualObjectNode) { - if (vobjs == null) { - vobjs = new HashSet(); - } - vobjs.add((VirtualObjectNode) value); - } else if (value != null) { - proc.doValue(value); - } - } - current = current.outerFrameState(); - } while (current != null); - - if (vobjs != null) { - // collect all VirtualObjectField instances: - HashMap objectStates = new HashMap(); - current = this; - do { - for (int i = 0; i < current.virtualObjectMappingCount(); i++) { - VirtualObjectFieldNode field = (VirtualObjectFieldNode) current.virtualObjectMappingAt(i); - // null states occur for objects with 0 fields - if (field != null && !objectStates.containsKey(field.object())) { - objectStates.put(field.object(), field); - } - } - current = current.outerFrameState(); - } while (current != null); - - do { - HashSet vobjsCopy = new HashSet(vobjs); - for (VirtualObjectNode vobj : vobjsCopy) { - if (vobj.fields().length > 0) { - boolean[] fieldState = new boolean[vobj.fields().length]; - FloatingNode currentField = objectStates.get(vobj); - assert currentField != null : this; - do { - if (currentField instanceof VirtualObjectFieldNode) { - int index = ((VirtualObjectFieldNode) currentField).index(); - ValueNode value = ((VirtualObjectFieldNode) currentField).input(); - if (!fieldState[index]) { - fieldState[index] = true; - if (value instanceof VirtualObjectNode) { - vobjs.add((VirtualObjectNode) value); - } else { - proc.doValue(value); - } - } - currentField = ((VirtualObjectFieldNode) currentField).lastState(); - } else { - assert currentField instanceof PhiNode : currentField; - currentField = (FloatingNode) ((PhiNode) currentField).valueAt(0); - } - } while (currentField != null); - } - vobjs.remove(vobj); - } - } while (!vobjs.isEmpty()); - assert vobjs.isEmpty() : "at FrameState " + this; - } - } - - @Override - public String toString() { - return super.toString(); - } - - public String toDetailedString() { - StringBuilder sb = new StringBuilder(); - String nl = String.format("%n"); - sb.append("[bci: ").append(bci).append("]"); - if (rethrowException()) { - sb.append(" rethrows Exception"); - } - sb.append(nl); - for (int i = 0; i < localsSize(); ++i) { - ValueNode value = localAt(i); - sb.append(String.format(" local[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); - } - for (int i = 0; i < stackSize(); ++i) { - ValueNode value = stackAt(i); - sb.append(String.format(" stack[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); - } - for (int i = 0; i < locksSize(); ++i) { - ValueNode value = lockAt(i); - sb.append(String.format(" lock[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); - } - return sb.toString(); - } - - @Override - public void accept(ValueVisitor v) { - v.visitFrameState(this); - } - - @Override - public String shortName() { - return "FrameState@" + bci; - } - - public void visitFrameState(FrameState i) { - // nothing to do for now - } - - @Override - public Map getDebugProperties() { - Map properties = super.getDebugProperties(); - properties.put("bci", bci); - properties.put("method", CiUtil.format("%H.%n(%p):%r", method, false)); - StringBuilder str = new StringBuilder(); - for (int i = 0; i < localsSize(); i++) { - str.append(i == 0 ? "" : ", ").append(localAt(i) == null ? "_" : localAt(i).id()); - } - properties.put("locals", str.toString()); - str = new StringBuilder(); - for (int i = 0; i < stackSize(); i++) { - str.append(i == 0 ? "" : ", ").append(stackAt(i) == null ? "_" : stackAt(i).id()); - } - properties.put("stack", str.toString()); - str = new StringBuilder(); - for (int i = 0; i < locksSize(); i++) { - str.append(i == 0 ? "" : ", ").append(lockAt(i) == null ? "_" : lockAt(i).id()); - } - properties.put("locks", str.toString()); - properties.put("rethrowException", rethrowException); - return properties; - } - - @Override - public void delete() { - FrameState outerFrameState = outerFrameState(); - super.delete(); - if (outerFrameState != null && outerFrameState.usages().isEmpty()) { - outerFrameState.delete(); - } - } - - @Override - public void setRethrowException(boolean b) { - rethrowException = b; - } -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/GuardNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/GuardNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/IfNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/IfNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/InvokeNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/InvokeNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LocalNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LocalNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LoopBeginNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LoopBeginNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LoopEndNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/LoopEndNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/MaterializeNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/MaterializeNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/MergeNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/MergeNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/PhiNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/PhiNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/PlaceholderNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/PlaceholderNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ReturnNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/ReturnNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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.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 d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +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.base; - -import java.util.*; - -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * The {@code StateSplit} class is the abstract base class of all instructions - * that store an immutable copy of the frame state. - */ -public abstract class StateSplit extends FixedWithNextNode { - - @Input private FrameState stateAfter; - - public FrameState stateAfter() { - return stateAfter; - } - - public void setStateAfter(FrameState x) { - updateUsages(stateAfter, x); - stateAfter = x; - } - - /** - * Creates a new state split with the specified value type. - * @param kind the type of the value that this instruction produces - * @param graph - */ - public StateSplit(CiKind kind, Graph graph) { - super(kind, graph); - } - - public boolean needsStateAfter() { - return true; - } - - @Override - public void delete() { - FrameState stateAfter = stateAfter(); - super.delete(); - if (stateAfter != null) { - if (stateAfter.usages().isEmpty()) { - stateAfter.delete(); - } - } - } - - @Override - public Iterable< ? extends Node> dataInputs() { - final Iterator< ? extends Node> dataInputs = super.dataInputs().iterator(); - return new Iterable() { - @Override - public Iterator iterator() { - return new FilteringIterator(dataInputs, FrameState.class); - } - }; - } - - public static final class FilteringIterator implements Iterator { - - private final Iterator< ? extends Node> input; - private Node next; - private Class< ? > clazz; - - public FilteringIterator(Iterator< ? extends Node> input, Class clazz) { - this.input = input; - this.clazz = clazz; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public Node next() { - forward(); - if (!hasNext()) { - throw new NoSuchElementException(); - } - Node res = next; - next = null; - return res; - } - - @Override - public boolean hasNext() { - forward(); - return next != null; - } - - private void forward() { - while (next == null && input.hasNext()) { - next = input.next(); - if (clazz.isInstance(next)) { - next = null; - } - } - } - } -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/UnwindNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/base/UnwindNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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.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 d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +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.base; - -import java.util.*; - -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.*; - -/** - * This class represents a value within the HIR graph, including local variables, phis, and - * all other instructions. - */ -public abstract class ValueNode extends Node { - - /** - * The kind of this value. This is {@link CiKind#Void} for instructions that produce no value. - * This kind is guaranteed to be a {@linkplain CiKind#stackKind() stack kind}. - */ - @Data public final CiKind kind; - - protected CiValue operand = CiValue.IllegalValue; - - /** - * Creates a new value with the specified kind. - * @param kind the type of this value - * @param inputCount - * @param successorCount - * @param graph - */ - public ValueNode(CiKind kind, Graph graph) { - super(graph); - assert kind != null && kind == kind.stackKind() : kind + " != " + kind.stackKind(); - this.kind = kind; - } - - /** - * Checks whether this value is a constant (i.e. it is of type {@link ConstantNode}. - * @return {@code true} if this value is a constant - */ - public final boolean isConstant() { - return this instanceof ConstantNode; - } - - /** - * Checks whether this value represents the null constant. - * @return {@code true} if this value represents the null constant - */ - public final boolean isNullConstant() { - return this instanceof ConstantNode && ((ConstantNode) this).value.isNull(); - } - - /** - * Convert this value to a constant if it is a constant, otherwise return null. - * @return the {@link CiConstant} represented by this value if it is a constant; {@code null} - * otherwise - */ - public final CiConstant asConstant() { - if (this instanceof ConstantNode) { - return ((ConstantNode) this).value; - } - return null; - } - - /** - * Gets the LIR operand associated with this instruction. - * @return the LIR operand for this instruction - */ - public final CiValue operand() { - return operand; - } - - /** - * Sets the LIR operand associated with this instruction. - * @param operand the operand to associate with this instruction - */ - public final void setOperand(CiValue operand) { - assert this.operand.isIllegal() : "operand cannot be set twice"; - assert operand != null && operand.isLegal() : "operand must be legal"; - assert operand.kind.stackKind() == this.kind; - assert !(this instanceof VirtualObjectNode); - this.operand = operand; - } - - /** - * Clears the LIR operand associated with this instruction. - */ - public final void clearOperand() { - this.operand = CiValue.IllegalValue; - } - - /** - * Computes the exact type of the result of this instruction, if possible. - * @return the exact type of the result of this instruction, if it is known; {@code null} otherwise - */ - public RiType exactType() { - return null; // default: unknown exact type - } - - /** - * Computes the declared type of the result of this instruction, if possible. - * @return the declared type of the result of this instruction, if it is known; {@code null} otherwise - */ - public RiType declaredType() { - return null; // default: unknown declared type - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("#"); - builder.append(id()); - builder.append(' '); - if (id() < 10) { - builder.append(' '); - } - builder.append(getClass().getSimpleName()); - builder.append(" [").append(flagsToString()).append("]"); - return builder.toString(); - } - - public String flagsToString() { - StringBuilder sb = new StringBuilder(); - return sb.toString(); - } - - /** - * This method supports the visitor pattern by accepting a visitor and calling the - * appropriate {@code visit()} method. - * - * @param v the visitor to accept - */ - public void accept(ValueVisitor v) { - throw new IllegalStateException("No visit method for this node (" + this.getClass().getSimpleName() + ")"); - } - - public static final LoweringOp DELEGATE_TO_RUNTIME = new LoweringOp() { - @Override - public void lower(Node n, CiLoweringTool tool) { - tool.getRuntime().lower(n, tool); - } - }; - - public static final LIRGeneratorOp DELEGATE_TO_VALUE_VISITOR = new LIRGeneratorOp() { - @Override - public void generate(Node n, LIRGeneratorTool generator) { - ((ValueNode) n).accept(generator); - } - }; - - @SuppressWarnings("unchecked") - @Override - public T lookup(Class clazz) { - if (clazz == LIRGeneratorOp.class) { - return (T) DELEGATE_TO_VALUE_VISITOR; - } - return super.lookup(clazz); - } - - @Override - public Map getDebugProperties() { - Map properties = super.getDebugProperties(); - properties.put("kind", kind.toString()); - properties.put("operand", operand == null ? "null" : operand.toString()); - return properties; - } -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/AndNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/AndNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ArithmeticNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ArithmeticNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/BinaryNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/BinaryNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/CompareNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/CompareNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/Condition.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/Condition.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ConditionalNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ConditionalNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ConvertNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ConvertNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatAddNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatAddNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatArithmeticNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatArithmeticNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatDivNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatDivNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatMulNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatMulNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatRemNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatRemNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatSubNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatSubNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatingNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/FloatingNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerAddNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerAddNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerAddVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerAddVectorNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerArithmeticNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerArithmeticNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerDivNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerDivNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerMulNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerMulNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerRemNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerRemNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerSubNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IntegerSubNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IsNonNullNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/IsNonNullNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/LeftShiftNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/LeftShiftNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/LogicNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/LogicNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NegateBooleanNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NegateBooleanNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NegateNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NegateNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NormalizeCompareNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/NormalizeCompareNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/OrNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/OrNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/RightShiftNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/RightShiftNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ShiftNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/ShiftNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/UnsignedRightShiftNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/UnsignedRightShiftNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/XorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/calc/XorNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AbstractMemoryCheckpointNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AbstractMemoryCheckpointNode.java Wed Aug 10 00:34:29 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 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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AbstractVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AbstractVectorNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AccessNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AccessNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AccessVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/AccessVectorNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/CreateVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/CreateVectorNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/LocationNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/LocationNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/LookupSwitchNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/LookupSwitchNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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 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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ReadNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ReadNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ReadVectorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/ReadVectorNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/SwitchNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/SwitchNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/TableSwitchNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/TableSwitchNode.java Wed Aug 10 00:34:29 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 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 d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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.nodes.base.*; -import com.oracle.max.graal.compiler.nodes.spi.*; -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - -/** - * The ValueAnchor instruction keeps non-CFG nodes above a certain point in the graph. - */ -public final class ValueAnchorNode extends FixedWithNextNode { - @Input private ValueNode object; - - public ValueNode object() { - return object; - } - - public void setObject(ValueNode x) { - updateUsages(object, x); - object = x; - } - - public ValueAnchorNode(ValueNode object, Graph graph) { - super(CiKind.Illegal, graph); - setObject(object); - } - - @Override - public void accept(ValueVisitor v) { - v.visitValueAnchor(this); - } -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteMemoryCheckpointNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/extended/WriteMemoryCheckpointNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.compiler.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 d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 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.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 WriteNode extends AccessNode { - @Input private ValueNode value; - - public ValueNode value() { - return value; - } - - public void setValue(ValueNode x) { - updateUsages(value, x); - value = x; - } - - public WriteNode(CiKind kind, ValueNode object, ValueNode value, LocationNode location, Graph graph) { - super(kind, object, location, graph); - setValue(value); - } - - @Override - public void accept(ValueVisitor v) { - v.visitMemoryWrite(this); - } -} diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 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.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 WriteVectorNode extends AccessVectorNode { - @Input private AbstractVectorNode values; - - public AbstractVectorNode values() { - return values; - } - - public void setValues(AbstractVectorNode x) { - updateUsages(values, x); - values = x; - } - - public WriteVectorNode(AbstractVectorNode vector, ValueNode object, LocationNode location, AbstractVectorNode values, Graph graph) { - super(CiKind.Illegal, vector, object, location, graph); - setValues(values); - } - - @Override - public T lookup(Class clazz) { - if (clazz == LIRGeneratorOp.class) { - return null; - } - return super.lookup(clazz); - } - - @Override - public void addToLoop(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()); - assert index != null; - assert value != null; - newLocation.setIndex(index); - WriteNode writeNode = new WriteNode(location().getValueKind().stackKind(), object(), value, newLocation, graph()); - loop.loopEnd().replaceAtPredecessors(writeNode); - writeNode.setNext(loop.loopEnd()); - } -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessArrayNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessArrayNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessFieldNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessFieldNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessIndexedNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessIndexedNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessMonitorNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/AccessMonitorNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/ArrayLengthNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/ArrayLengthNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/CheckCastNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/CheckCastNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/ExceptionObjectNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/InstanceOfNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/IsTypeNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/IsTypeNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/LoadFieldNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/LoadFieldNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/LoadIndexedNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/LoadIndexedNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MathIntrinsicNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MathIntrinsicNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorAddressNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorAddressNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorEnterNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorEnterNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorExitNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/MonitorExitNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewArrayNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewArrayNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewInstanceNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewInstanceNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewMultiArrayNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewMultiArrayNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewObjectArrayNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewObjectArrayNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewTypeArrayNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/NewTypeArrayNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/RegisterFinalizerNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/RegisterFinalizerNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/StoreFieldNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/StoreFieldNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/StoreIndexedNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/StoreIndexedNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/TypeCheckNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/java/TypeCheckNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/BasicInductionVariableNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/BasicInductionVariableNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/DerivedInductionVariableNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/DerivedInductionVariableNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/InductionVariableNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/InductionVariableNode.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/LinearInductionVariableNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/LinearInductionVariableNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/LoopCounterNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/loop/LoopCounterNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/Canonicalizable.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/Canonicalizable.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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.spi; - -import com.oracle.max.graal.graph.*; - - -public interface Canonicalizable { - Node canonical(NotifyReProcess reProcess); -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeField.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/EscapeField.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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.spi; - -import com.sun.cri.ci.*; - -public class EscapeField { - - private String name; - private Object representation; - private CiKind kind; - - public EscapeField(String name, Object representation, CiKind kind) { - this.name = name; - this.representation = representation; - this.kind = kind; - } - - public String name() { - return name; - } - - public Object representation() { - return representation; - } - - public CiKind kind() { - return kind; - } - - @Override - public String toString() { - return name(); - } -} diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +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.spi; - -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.java.*; -import com.oracle.max.graal.graph.*; - - -public abstract class EscapeOp implements Op { - - public abstract boolean canAnalyze(Node node); - - public boolean escape(Node node, Node usage) { - if (usage instanceof IsNonNullNode) { - IsNonNullNode x = (IsNonNullNode) usage; - assert x.object() == node; - return false; - } 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 AccessMonitorNode) { - AccessMonitorNode x = (AccessMonitorNode) usage; - assert x.object() == node; - return false; - } else { - return true; - } - } - - public abstract EscapeField[] fields(Node node); - - public void beforeUpdate(Node node, Node usage) { - if (usage instanceof IsNonNullNode) { - IsNonNullNode x = (IsNonNullNode) usage; - // TODO (ls) not sure about this... - 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(ConstantNode.forBoolean(true, node.graph())); - } else if (usage instanceof AccessMonitorNode) { - AccessMonitorNode x = (AccessMonitorNode) usage; - x.replaceAndDelete(x.next()); - } - } - - public abstract int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState); - -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ExceptionExit.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/ExceptionExit.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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.spi; - -import com.oracle.max.graal.compiler.nodes.base.*; - - -public interface ExceptionExit { - FixedNode exceptionEdge(); -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorOp.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LIRGeneratorOp.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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.spi; - -import com.oracle.max.graal.graph.*; - -public interface LIRGeneratorOp extends Op { - void generate(Node n, LIRGeneratorTool generator); -} diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +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.spi; - -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 { - public abstract CiValue load(ValueNode value); - public abstract CiVariable createResultVariable(ValueNode conv); - public abstract CiValue forceToSpill(CiValue value, CiKind kind, boolean b); - public abstract void emitMove(CiValue tmp, CiValue reg); - public abstract void integerAdd(ValueNode result, ValueNode x, ValueNode y); - public abstract void deoptimizeOn(Condition of); - public abstract CiVariable newVariable(CiKind kind); - public abstract CiTarget target(); - public abstract void emitLea(CiAddress address, CiVariable dest); - public abstract CiValue makeOperand(ValueNode object); - public abstract void emitUnsignedShiftRight(CiValue value, CiValue count, CiValue dst, CiValue tmp); - public abstract void emitAdd(CiValue a, CiValue b, CiValue dest); -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LoweringOp.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/LoweringOp.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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.spi; - -import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; - - -public interface LoweringOp extends Op { - void lower(Node n, CiLoweringTool tool); -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/NotifyReProcess.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/spi/NotifyReProcess.java Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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.spi; - -import com.oracle.max.graal.graph.*; - - -public interface NotifyReProcess { - void reProccess(Node n); -} diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +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.spi; - -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.*; - -/** - * The {@link ValueVisitor} implements one half of the visitor - * pattern for {@linkplain ValueNode IR values}, allowing clients to implement functionality - * depending on the type of an value without doing type tests. - */ -public abstract class ValueVisitor { - // Checkstyle: stop - public abstract void visitArithmetic(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(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(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(DeoptimizeNode deoptimize); - public abstract void visitUnwind(UnwindNode unwind); - 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(MathIntrinsicNode node); -} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/virtual/VirtualObjectFieldNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/virtual/VirtualObjectFieldNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/virtual/VirtualObjectNode.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/nodes/virtual/VirtualObjectNode.java Wed Aug 10 00:34:29 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.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 d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java Wed Aug 10 00:47:53 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.nodes.base.FixedWithNextNode#exceptionHandlers} field, the {@link com.oracle.max.graal.compiler.nodes.base.FixedWithNextNode#bci} field, and any fields to store the Java + * {@link com.oracle.max.graal.nodes.base.FixedWithNextNode#exceptionHandlers} field, the {@link com.oracle.max.graal.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.
  • diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,9 +24,9 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.spi.*; public class CanonicalizerPhase extends Phase { private static final int MAX_ITERATION_PER_NODE = 10; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ComputeProbabilityPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -27,9 +27,9 @@ 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.observer.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; public class ComputeProbabilityPhase extends Phase { private static final double EPSILON = 1d / Integer.MAX_VALUE; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -25,10 +25,10 @@ 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.nodes.base.*; -import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.extended.*; public class DeadCodeEliminationPhase extends Phase { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -28,14 +28,14 @@ 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.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.compiler.nodes.virtual.*; import com.oracle.max.graal.compiler.observer.*; import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +import com.oracle.max.graal.nodes.virtual.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -35,17 +35,17 @@ 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.nodes.base.*; -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; import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.DeoptimizeNode.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.java.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -28,12 +28,12 @@ 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.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.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.DeoptimizeNode.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.java.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoopPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -25,14 +25,14 @@ import java.util.*; import com.oracle.max.graal.compiler.*; -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; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.loop.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,11 +24,11 @@ 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.schedule.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/MemoryPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -27,12 +27,12 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -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.schedule.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.extended.*; import com.sun.cri.ci.*; public class MemoryPhase extends Phase { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,8 +24,8 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.nodes.extended.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.extended.*; public class ReadEliminationPhase extends Phase { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Block.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,9 +24,9 @@ import java.util.*; -import com.oracle.max.graal.compiler.nodes.base.*; -import com.oracle.max.graal.compiler.nodes.java.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.java.*; public class Block { diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/BlockList.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/BlockList.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/BlockList.java Wed Aug 10 00:47:53 2011 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.nodes.base.*; /** * The {@code BlockList} class implements a specialized list data structure for representing diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java Wed Aug 10 00:47:53 2011 +0200 @@ -26,15 +26,15 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -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; import com.oracle.max.graal.graph.NodeClass.Position; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.loop.*; +import com.oracle.max.graal.nodes.virtual.*; public class IdentifyBlocksPhase extends Phase { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Wed Aug 10 00:47:53 2011 +0200 @@ -40,8 +40,8 @@ import com.oracle.max.graal.compiler.globalstub.*; 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.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiAddress.Scale; import com.sun.cri.ci.CiTargetMethod.JumpTable; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Wed Aug 10 00:47:53 2011 +0200 @@ -29,11 +29,11 @@ import com.oracle.max.graal.compiler.gen.*; import com.oracle.max.graal.compiler.globalstub.*; 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.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.java.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/BlockWorkList.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.util; -import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.nodes.base.*; /** * This class implements a worklist for dealing with blocks. The worklist can diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/GraphUtil.java Wed Aug 10 00:47:53 2011 +0200 @@ -26,15 +26,15 @@ import java.util.Map.Entry; import com.oracle.max.graal.compiler.*; -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; import com.oracle.max.graal.graph.NodeClass.Position; import com.oracle.max.graal.graph.collections.*; import com.oracle.max.graal.graph.collections.NodeWorkList.InfiniteWorkException; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.extended.*; public class GraphUtil { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java Wed Aug 10 00:47:53 2011 +0200 @@ -26,10 +26,6 @@ import java.util.Map.Entry; import com.oracle.max.graal.compiler.*; -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; @@ -38,6 +34,10 @@ import com.oracle.max.graal.graph.NodeClass.NodeClassIterator; import com.oracle.max.graal.graph.NodeClass.Position; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.loop.*; import com.sun.cri.ci.*; public class LoopUtil { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Wed Aug 10 00:47:53 2011 +0200 @@ -26,8 +26,8 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateAccess.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateAccess.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateAccess.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.value; -import com.oracle.max.graal.compiler.nodes.base.*; +import com.oracle.max.graal.nodes.base.*; public interface FrameStateAccess { diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameStateBuilder.java Wed Aug 10 00:47:53 2011 +0200 @@ -27,9 +27,9 @@ 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.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/ValueUtil.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/ValueUtil.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/ValueUtil.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.max.graal.compiler.value; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/AnchorNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/BooleanNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.calc.*; +import com.sun.cri.ci.*; + + +public abstract class BooleanNode extends FloatingNode { + + public BooleanNode(CiKind kind, Graph graph) { + super(kind, graph); + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/CastNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/ConstantNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import static com.oracle.max.graal.compiler.GraalCompilation.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/ControlSplitNode.java Wed Aug 10 00:47:53 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/DeoptimizeNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/EndNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/FixedGuardNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.DeoptimizeNode.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/FixedNode.java Wed Aug 10 00:47:53 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/FixedWithNextNode.java Wed Aug 10 00:47:53 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/base/FrameState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/base/FrameState.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,674 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.nodes.base; + +import static com.oracle.max.graal.compiler.value.ValueUtil.*; + +import java.util.*; + +import com.oracle.max.graal.compiler.value.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +import com.oracle.max.graal.nodes.virtual.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + +/** + * The {@code FrameState} class encapsulates the frame state (i.e. local variables and + * operand stack) at a particular point in the abstract interpretation. + */ +public final class FrameState extends ValueNode implements FrameStateAccess { + + protected final int localsSize; + + protected final int stackSize; + + protected final int locksSize; + + private boolean rethrowException; + + public static final int BEFORE_BCI = -2; + public static final int AFTER_BCI = -3; + + @Input private FrameState outerFrameState; + + @Input private final NodeInputList values; + + @Input private final NodeInputList virtualObjectMappings; + + public FrameState outerFrameState() { + return outerFrameState; + } + + public void setOuterFrameState(FrameState x) { + updateUsages(this.outerFrameState, x); + this.outerFrameState = x; + } + + @Override + public void setValueAt(int i, ValueNode x) { + values.set(i, x); + } + + /** + * The bytecode index to which this frame state applies. This will be {@code -1} + * iff this state is mutable. + */ + public final int bci; + + public final RiMethod method; + + /** + * Creates a {@code FrameState} for the given scope and maximum number of stack and local variables. + * + * @param bci the bytecode index of the frame state + * @param localsSize number of locals + * @param stackSize size of the stack + * @param lockSize number of locks + */ + public FrameState(RiMethod method, int bci, int localsSize, int stackSize, int locksSize, boolean rethrowException, Graph graph) { + super(CiKind.Illegal, graph); + this.method = method; + this.bci = bci; + this.localsSize = localsSize; + this.stackSize = stackSize; + this.locksSize = locksSize; + this.values = new NodeInputList(this, localsSize + stackSize + locksSize); + this.virtualObjectMappings = new NodeInputList(this); + this.rethrowException = rethrowException; + //GraalMetrics.FrameStatesCreated++; + //GraalMetrics.FrameStateValuesCreated += localsSize + stackSize + locksSize; + } + + public FrameState(RiMethod method, int bci, ValueNode[] locals, ValueNode[] stack, int stackSize, ArrayList locks, boolean rethrowException, Graph graph) { + this(method, bci, locals.length, stackSize, locks.size(), rethrowException, graph); + for (int i = 0; i < locals.length; i++) { + setValueAt(i, locals[i]); + } + for (int i = 0; i < stackSize; i++) { + setValueAt(localsSize + i, stack[i]); + } + for (int i = 0; i < locks.size(); i++) { + setValueAt(locals.length + stackSize + i, locks.get(i)); + } + } + + public boolean rethrowException() { + return rethrowException; + } + + public RiMethod method() { + return method; + } + + public void addVirtualObjectMapping(Node virtualObject) { + assert virtualObject instanceof VirtualObjectFieldNode || virtualObject instanceof PhiNode : virtualObject; + virtualObjectMappings.add(virtualObject); + } + + public int virtualObjectMappingCount() { + return virtualObjectMappings.size(); + } + + public Node virtualObjectMappingAt(int i) { + return virtualObjectMappings.get(i); + } + + public Iterable virtualObjectMappings() { + return virtualObjectMappings; + } + + /** + * Gets a copy of this frame state. + */ + public FrameState duplicate(int bci) { + return duplicate(bci, false); + } + + public FrameState duplicate(int bci, boolean duplicateOuter) { + FrameState other = new FrameState(method, bci, localsSize, stackSize, locksSize, rethrowException, graph()); + other.values.setAll(values); + other.virtualObjectMappings.setAll(virtualObjectMappings); + FrameState outerFrameState = outerFrameState(); + if (duplicateOuter && outerFrameState != null) { + outerFrameState = outerFrameState.duplicate(outerFrameState.bci, duplicateOuter); + } + other.setOuterFrameState(outerFrameState); + return other; + } + + @Override + public FrameState duplicateWithException(int bci, ValueNode exceptionObject) { + return duplicateModified(bci, true, CiKind.Void, exceptionObject); + } + + /** + * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the + * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long + * or double is followed by a null slot. + */ + public FrameState duplicateModified(int bci, boolean rethrowException, CiKind popKind, ValueNode... pushedValues) { + int popSlots = popKind.sizeInSlots(); + int pushSlots = pushedValues.length; + FrameState other = new FrameState(method, bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), rethrowException, graph()); + for (int i = 0; i < localsSize; i++) { + other.setValueAt(i, localAt(i)); + } + for (int i = 0; i < stackSize - popSlots; i++) { + other.setValueAt(localsSize + i, stackAt(i)); + } + int slot = localsSize + stackSize - popSlots; + for (int i = 0; i < pushSlots; i++) { + other.setValueAt(slot++, pushedValues[i]); + } + for (int i = 0; i < locksSize; i++) { + other.setValueAt(localsSize + other.stackSize + i, lockAt(i)); + } + other.virtualObjectMappings.setAll(virtualObjectMappings); + other.setOuterFrameState(outerFrameState()); + return other; + } + + public boolean isCompatibleWith(FrameStateAccess other) { + if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { + return false; + } + for (int i = 0; i < stackSize(); i++) { + ValueNode x = stackAt(i); + ValueNode y = other.stackAt(i); + if (x != y && typeMismatch(x, y)) { + return false; + } + } + for (int i = 0; i < locksSize(); i++) { + if (lockAt(i) != other.lockAt(i)) { + return false; + } + } + if (other.outerFrameState() != outerFrameState()) { + return false; + } + return true; + } + + public boolean equals(FrameStateAccess other) { + if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { + return false; + } + for (int i = 0; i < stackSize(); i++) { + ValueNode x = stackAt(i); + ValueNode y = other.stackAt(i); + if (x != y) { + return false; + } + } + for (int i = 0; i < locksSize(); i++) { + if (lockAt(i) != other.lockAt(i)) { + return false; + } + } + if (other.outerFrameState() != outerFrameState()) { + return false; + } + return true; + } + + /** + * Gets the size of the local variables. + */ + public int localsSize() { + return localsSize; + } + + /** + * Gets the current size (height) of the stack. + */ + public int stackSize() { + return stackSize; + } + + /** + * Gets number of locks held by this frame state. + */ + public int locksSize() { + return locksSize; + } + + /** + * Invalidates the local variable at the specified index. If the specified index refers to a doubleword local, then + * invalidates the high word as well. + * + * @param i the index of the local to invalidate + */ + public void invalidateLocal(int i) { + // note that for double word locals, the high slot should already be null + // unless the local is actually dead and the high slot is being reused; + // in either case, it is not necessary to null the high slot + setValueAt(i, null); + } + + /** + * Stores a given local variable at the specified index. If the value is a {@linkplain CiKind#isDoubleWord() double word}, + * then the next local variable index is also overwritten. + * + * @param i the index at which to store + * @param x the instruction which produces the value for the local + */ + public void storeLocal(int i, ValueNode x) { + assert i < localsSize : "local variable index out of range: " + i; + invalidateLocal(i); + setValueAt(i, x); + if (isDoubleWord(x)) { + // (tw) if this was a double word then kill i+1 + setValueAt(i + 1, null); + } + if (i > 0) { + // if there was a double word at i - 1, then kill it + ValueNode p = localAt(i - 1); + if (isDoubleWord(p)) { + setValueAt(i - 1, null); + } + } + } + + /** + * Gets the value in the local variables at the specified index. + * + * @param i the index into the locals + * @return the instruction that produced the value for the specified local + */ + public ValueNode localAt(int i) { + assert i < localsSize : "local variable index out of range: " + i; + return valueAt(i); + } + + /** + * Get the value on the stack at the specified stack index. + * + * @param i the index into the stack, with {@code 0} being the bottom of the stack + * @return the instruction at the specified position in the stack + */ + public ValueNode stackAt(int i) { + assert i >= 0 && i < (localsSize + stackSize); + return valueAt(localsSize + i); + } + + /** + * Retrieves the lock at the specified index in the lock stack. + * @param i the index into the lock stack + * @return the instruction which produced the object at the specified location in the lock stack + */ + public ValueNode lockAt(int i) { + assert i >= 0; + return valueAt(localsSize + stackSize + i); + } + + /** + * Inserts a phi statement into the stack at the specified stack index. + * @param block the block begin for which we are creating the phi + * @param i the index into the stack for which to create a phi + */ + public PhiNode setupPhiForStack(MergeNode block, int i) { + ValueNode p = stackAt(i); + if (p != null) { + if (p instanceof PhiNode) { + PhiNode phi = (PhiNode) p; + if (phi.merge() == block) { + return phi; + } + } + PhiNode phi = new PhiNode(p.kind, block, PhiType.Value, graph()); + setValueAt(localsSize + i, phi); + return phi; + } + return null; + } + + /** + * Inserts a phi statement for the local at the specified index. + * @param block the block begin for which we are creating the phi + * @param i the index of the local variable for which to create the phi + */ + public PhiNode setupPhiForLocal(MergeNode block, int i) { + ValueNode p = localAt(i); + if (p instanceof PhiNode) { + PhiNode phi = (PhiNode) p; + if (phi.merge() == block) { + return phi; + } + } + PhiNode phi = new PhiNode(p.kind, block, PhiType.Value, graph()); + storeLocal(i, phi); + return phi; + } + + /** + * Gets the value at a specified index in the set of operand stack and local values represented by this frame. + * This method should only be used to iterate over all the values in this frame, irrespective of whether + * they are on the stack or in local variables. + * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. + * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. + * + * @param i a value in the range {@code [0 .. valuesSize()]} + * @return the value at index {@code i} which may be {@code null} + */ + public ValueNode valueAt(int i) { + assert i < (localsSize + stackSize + locksSize); + return values.isEmpty() ? null : values.get(i); + } + + /** + * The number of operand stack slots and local variables in this frame. + * This method should typically only be used in conjunction with {@link #valueAt(int)}. + * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used. + * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used. + * + * @return the number of local variables in this frame + */ + public int valuesSize() { + return localsSize + stackSize; + } + + private void checkSize(FrameStateAccess other) { + if (other.stackSize() != stackSize()) { + throw new CiBailout("stack sizes do not match"); + } else if (other.localsSize() != localsSize) { + throw new CiBailout("local sizes do not match"); + } + } + + public void merge(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 PhiNode) && ((PhiNode) x).merge() == block)) { + if (typeMismatch(x, y)) { + if ((x instanceof PhiNode) && ((PhiNode) x).merge() == block) { + x.replaceAtUsages(null); + x.delete(); + } + setValueAt(i, null); + continue; + } + PhiNode phi = null; + if (i < localsSize) { + // this a local + phi = setupPhiForLocal(block, i); + } else { + // this is a stack slot + phi = setupPhiForStack(block, i - localsSize); + } + + if (phi.valueCount() == 0) { + int size = block.phiPredecessorCount(); + for (int j = 0; j < size; ++j) { + phi.addInput(x); + } + phi.addInput((x == y) ? phi : y); + } else { + phi.addInput((x == y) ? phi : y); + } + + assert phi.valueCount() == block.phiPredecessorCount() + (block instanceof LoopBeginNode ? 0 : 1) : "valueCount=" + phi.valueCount() + " predSize= " + block.phiPredecessorCount(); + } + } + } + } + + public MergeNode block() { + for (Node n : usages()) { + if (n instanceof MergeNode) { + return (MergeNode) n; + } + } + return null; + } + + public StateSplit stateSplit() { + for (Node n : usages()) { + if (n instanceof StateSplit) { + return (StateSplit) n; + } + } + return null; + } + + public Iterable innerFrameStates() { + final Iterator iterator = usages().iterator(); + return new Iterable() { + @Override + public Iterator iterator() { + return new Iterator() { + private Node next; + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + @Override + public FrameState next() { + forward(); + if (!hasNext()) { + throw new NoSuchElementException(); + } + FrameState res = (FrameState) next; + next = null; + return res; + } + @Override + public boolean hasNext() { + forward(); + return next != null; + } + private void forward() { + while (!(next instanceof FrameState) && iterator.hasNext()) { + next = iterator.next(); + } + } + }; + } + }; + } + + /** + * The interface implemented by a client of {@link FrameState#forEachPhi(MergeNode, PhiProcedure)} and + * {@link FrameState#forEachLivePhi(MergeNode, PhiProcedure)}. + */ + public static interface PhiProcedure { + boolean doPhi(PhiNode phi); + } + + /** + * 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 PhiNode) { + return true; + } + } + return false; + } + + /** + * The interface implemented by a client of {@link FrameState#forEachLiveStateValue(ValueProcedure)}. + */ + public static interface ValueProcedure { + void doValue(ValueNode value); + } + + /** + * Traverses all {@linkplain ValueNode#isLive() live values} of this frame state. + * + * @param proc the call back called to process each live value traversed + */ + public void forEachLiveStateValue(ValueProcedure proc) { + HashSet vobjs = null; + FrameState current = this; + do { + for (int i = 0; i < current.valuesSize(); i++) { + ValueNode value = current.valueAt(i); + if (value instanceof VirtualObjectNode) { + if (vobjs == null) { + vobjs = new HashSet(); + } + vobjs.add((VirtualObjectNode) value); + } else if (value != null) { + proc.doValue(value); + } + } + current = current.outerFrameState(); + } while (current != null); + + if (vobjs != null) { + // collect all VirtualObjectField instances: + HashMap objectStates = new HashMap(); + current = this; + do { + for (int i = 0; i < current.virtualObjectMappingCount(); i++) { + VirtualObjectFieldNode field = (VirtualObjectFieldNode) current.virtualObjectMappingAt(i); + // null states occur for objects with 0 fields + if (field != null && !objectStates.containsKey(field.object())) { + objectStates.put(field.object(), field); + } + } + current = current.outerFrameState(); + } while (current != null); + + do { + HashSet vobjsCopy = new HashSet(vobjs); + for (VirtualObjectNode vobj : vobjsCopy) { + if (vobj.fields().length > 0) { + boolean[] fieldState = new boolean[vobj.fields().length]; + FloatingNode currentField = objectStates.get(vobj); + assert currentField != null : this; + do { + if (currentField instanceof VirtualObjectFieldNode) { + int index = ((VirtualObjectFieldNode) currentField).index(); + ValueNode value = ((VirtualObjectFieldNode) currentField).input(); + if (!fieldState[index]) { + fieldState[index] = true; + if (value instanceof VirtualObjectNode) { + vobjs.add((VirtualObjectNode) value); + } else { + proc.doValue(value); + } + } + currentField = ((VirtualObjectFieldNode) currentField).lastState(); + } else { + assert currentField instanceof PhiNode : currentField; + currentField = (FloatingNode) ((PhiNode) currentField).valueAt(0); + } + } while (currentField != null); + } + vobjs.remove(vobj); + } + } while (!vobjs.isEmpty()); + assert vobjs.isEmpty() : "at FrameState " + this; + } + } + + @Override + public String toString() { + return super.toString(); + } + + public String toDetailedString() { + StringBuilder sb = new StringBuilder(); + String nl = String.format("%n"); + sb.append("[bci: ").append(bci).append("]"); + if (rethrowException()) { + sb.append(" rethrows Exception"); + } + sb.append(nl); + for (int i = 0; i < localsSize(); ++i) { + ValueNode value = localAt(i); + sb.append(String.format(" local[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); + } + for (int i = 0; i < stackSize(); ++i) { + ValueNode value = stackAt(i); + sb.append(String.format(" stack[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); + } + for (int i = 0; i < locksSize(); ++i) { + ValueNode value = lockAt(i); + sb.append(String.format(" lock[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); + } + return sb.toString(); + } + + @Override + public void accept(ValueVisitor v) { + v.visitFrameState(this); + } + + @Override + public String shortName() { + return "FrameState@" + bci; + } + + public void visitFrameState(FrameState i) { + // nothing to do for now + } + + @Override + public Map getDebugProperties() { + Map properties = super.getDebugProperties(); + properties.put("bci", bci); + properties.put("method", CiUtil.format("%H.%n(%p):%r", method, false)); + StringBuilder str = new StringBuilder(); + for (int i = 0; i < localsSize(); i++) { + str.append(i == 0 ? "" : ", ").append(localAt(i) == null ? "_" : localAt(i).id()); + } + properties.put("locals", str.toString()); + str = new StringBuilder(); + for (int i = 0; i < stackSize(); i++) { + str.append(i == 0 ? "" : ", ").append(stackAt(i) == null ? "_" : stackAt(i).id()); + } + properties.put("stack", str.toString()); + str = new StringBuilder(); + for (int i = 0; i < locksSize(); i++) { + str.append(i == 0 ? "" : ", ").append(lockAt(i) == null ? "_" : lockAt(i).id()); + } + properties.put("locks", str.toString()); + properties.put("rethrowException", rethrowException); + return properties; + } + + @Override + public void delete() { + FrameState outerFrameState = outerFrameState(); + super.delete(); + if (outerFrameState != null && outerFrameState.usages().isEmpty()) { + outerFrameState.delete(); + } + } + + @Override + public void setRethrowException(boolean b) { + rethrowException = b; + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/GuardNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.compiler.*; +import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/IfNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/InvokeNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/LocalNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/LoopBeginNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.loop.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/LoopEndNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/MaterializeNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.calc.*; + +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/MergeNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/PhiNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.compiler.*; +import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.StateSplit.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/PlaceholderNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/ReturnNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/base/StateSplit.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/base/StateSplit.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,124 @@ +/* + * 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + +/** + * The {@code StateSplit} class is the abstract base class of all instructions + * that store an immutable copy of the frame state. + */ +public abstract class StateSplit extends FixedWithNextNode { + + @Input private FrameState stateAfter; + + public FrameState stateAfter() { + return stateAfter; + } + + public void setStateAfter(FrameState x) { + updateUsages(stateAfter, x); + stateAfter = x; + } + + /** + * Creates a new state split with the specified value type. + * @param kind the type of the value that this instruction produces + * @param graph + */ + public StateSplit(CiKind kind, Graph graph) { + super(kind, graph); + } + + public boolean needsStateAfter() { + return true; + } + + @Override + public void delete() { + FrameState stateAfter = stateAfter(); + super.delete(); + if (stateAfter != null) { + if (stateAfter.usages().isEmpty()) { + stateAfter.delete(); + } + } + } + + @Override + public Iterable< ? extends Node> dataInputs() { + final Iterator< ? extends Node> dataInputs = super.dataInputs().iterator(); + return new Iterable() { + @Override + public Iterator iterator() { + return new FilteringIterator(dataInputs, FrameState.class); + } + }; + } + + public static final class FilteringIterator implements Iterator { + + private final Iterator< ? extends Node> input; + private Node next; + private Class< ? > clazz; + + public FilteringIterator(Iterator< ? extends Node> input, Class clazz) { + this.input = input; + this.clazz = clazz; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + @Override + public Node next() { + forward(); + if (!hasNext()) { + throw new NoSuchElementException(); + } + Node res = next; + next = null; + return res; + } + + @Override + public boolean hasNext() { + forward(); + return next != null; + } + + private void forward() { + while (next == null && input.hasNext()) { + next = input.next(); + if (clazz.isInstance(next)) { + next = null; + } + } + } + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/base/UnwindNode.java Wed Aug 10 00:47:53 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.nodes.base; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/base/ValueNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/base/ValueNode.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,190 @@ +/* + * 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.nodes.base; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +import com.oracle.max.graal.nodes.virtual.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + +/** + * This class represents a value within the HIR graph, including local variables, phis, and + * all other instructions. + */ +public abstract class ValueNode extends Node { + + /** + * The kind of this value. This is {@link CiKind#Void} for instructions that produce no value. + * This kind is guaranteed to be a {@linkplain CiKind#stackKind() stack kind}. + */ + @Data public final CiKind kind; + + protected CiValue operand = CiValue.IllegalValue; + + /** + * Creates a new value with the specified kind. + * @param kind the type of this value + * @param inputCount + * @param successorCount + * @param graph + */ + public ValueNode(CiKind kind, Graph graph) { + super(graph); + assert kind != null && kind == kind.stackKind() : kind + " != " + kind.stackKind(); + this.kind = kind; + } + + /** + * Checks whether this value is a constant (i.e. it is of type {@link ConstantNode}. + * @return {@code true} if this value is a constant + */ + public final boolean isConstant() { + return this instanceof ConstantNode; + } + + /** + * Checks whether this value represents the null constant. + * @return {@code true} if this value represents the null constant + */ + public final boolean isNullConstant() { + return this instanceof ConstantNode && ((ConstantNode) this).value.isNull(); + } + + /** + * Convert this value to a constant if it is a constant, otherwise return null. + * @return the {@link CiConstant} represented by this value if it is a constant; {@code null} + * otherwise + */ + public final CiConstant asConstant() { + if (this instanceof ConstantNode) { + return ((ConstantNode) this).value; + } + return null; + } + + /** + * Gets the LIR operand associated with this instruction. + * @return the LIR operand for this instruction + */ + public final CiValue operand() { + return operand; + } + + /** + * Sets the LIR operand associated with this instruction. + * @param operand the operand to associate with this instruction + */ + public final void setOperand(CiValue operand) { + assert this.operand.isIllegal() : "operand cannot be set twice"; + assert operand != null && operand.isLegal() : "operand must be legal"; + assert operand.kind.stackKind() == this.kind; + assert !(this instanceof VirtualObjectNode); + this.operand = operand; + } + + /** + * Clears the LIR operand associated with this instruction. + */ + public final void clearOperand() { + this.operand = CiValue.IllegalValue; + } + + /** + * Computes the exact type of the result of this instruction, if possible. + * @return the exact type of the result of this instruction, if it is known; {@code null} otherwise + */ + public RiType exactType() { + return null; // default: unknown exact type + } + + /** + * Computes the declared type of the result of this instruction, if possible. + * @return the declared type of the result of this instruction, if it is known; {@code null} otherwise + */ + public RiType declaredType() { + return null; // default: unknown declared type + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("#"); + builder.append(id()); + builder.append(' '); + if (id() < 10) { + builder.append(' '); + } + builder.append(getClass().getSimpleName()); + builder.append(" [").append(flagsToString()).append("]"); + return builder.toString(); + } + + public String flagsToString() { + StringBuilder sb = new StringBuilder(); + return sb.toString(); + } + + /** + * This method supports the visitor pattern by accepting a visitor and calling the + * appropriate {@code visit()} method. + * + * @param v the visitor to accept + */ + public void accept(ValueVisitor v) { + throw new IllegalStateException("No visit method for this node (" + this.getClass().getSimpleName() + ")"); + } + + public static final LoweringOp DELEGATE_TO_RUNTIME = new LoweringOp() { + @Override + public void lower(Node n, CiLoweringTool tool) { + tool.getRuntime().lower(n, tool); + } + }; + + public static final LIRGeneratorOp DELEGATE_TO_VALUE_VISITOR = new LIRGeneratorOp() { + @Override + public void generate(Node n, LIRGeneratorTool generator) { + ((ValueNode) n).accept(generator); + } + }; + + @SuppressWarnings("unchecked") + @Override + public T lookup(Class clazz) { + if (clazz == LIRGeneratorOp.class) { + return (T) DELEGATE_TO_VALUE_VISITOR; + } + return super.lookup(clazz); + } + + @Override + public Map getDebugProperties() { + Map properties = super.getDebugProperties(); + properties.put("kind", kind.toString()); + properties.put("operand", operand == null ? "null" : operand.toString()); + return properties; + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/AndNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/ArithmeticNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/BinaryNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/CompareNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import java.util.*; + +import com.oracle.max.graal.compiler.graph.*; +import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/Condition.java Wed Aug 10 00:47:53 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.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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/ConditionalNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/ConvertNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/FloatAddNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/FloatArithmeticNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/FloatDivNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/FloatMulNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/FloatRemNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/FloatSubNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/FloatingNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IntegerAddNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IntegerAddVectorNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IntegerArithmeticNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IntegerDivNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IntegerMulNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IntegerRemNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IntegerSubNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/IsNonNullNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.java.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/LeftShiftNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/LogicNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/NegateBooleanNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/NegateNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/NormalizeCompareNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/OrNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/RightShiftNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/ShiftNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/UnsignedRightShiftNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/calc/XorNode.java Wed Aug 10 00:47:53 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.nodes.calc; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/AbstractMemoryCheckpointNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/AbstractVectorNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/AccessNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/AccessVectorNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/CreateVectorNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/LocationNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/LookupSwitchNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; + +/** + * 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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/ReadNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/ReadVectorNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/SwitchNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/TableSwitchNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; + +/** + * 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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/extended/ValueAnchorNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/extended/ValueAnchorNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +import com.sun.cri.ci.*; + +/** + * The ValueAnchor instruction keeps non-CFG nodes above a certain point in the graph. + */ +public final class ValueAnchorNode extends FixedWithNextNode { + @Input private ValueNode object; + + public ValueNode object() { + return object; + } + + public void setObject(ValueNode x) { + updateUsages(object, x); + object = x; + } + + public ValueAnchorNode(ValueNode object, Graph graph) { + super(CiKind.Illegal, graph); + setObject(object); + } + + @Override + public void accept(ValueVisitor v) { + v.visitValueAnchor(this); + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/extended/WriteMemoryCheckpointNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/extended/WriteNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/extended/WriteNode.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,52 @@ +/* + * 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.nodes.extended; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +import com.sun.cri.ci.*; + + +public final class WriteNode extends AccessNode { + @Input private ValueNode value; + + public ValueNode value() { + return value; + } + + public void setValue(ValueNode x) { + updateUsages(value, x); + value = x; + } + + public WriteNode(CiKind kind, ValueNode object, ValueNode value, LocationNode location, Graph graph) { + super(kind, object, location, graph); + setValue(value); + } + + @Override + public void accept(ValueVisitor v) { + v.visitMemoryWrite(this); + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/extended/WriteVectorNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/extended/WriteVectorNode.java Wed Aug 10 00:47:53 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.nodes.extended; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +import com.sun.cri.ci.*; + + +public final class WriteVectorNode extends AccessVectorNode { + @Input private AbstractVectorNode values; + + public AbstractVectorNode values() { + return values; + } + + public void setValues(AbstractVectorNode x) { + updateUsages(values, x); + values = x; + } + + public WriteVectorNode(AbstractVectorNode vector, ValueNode object, LocationNode location, AbstractVectorNode values, Graph graph) { + super(CiKind.Illegal, vector, object, location, graph); + setValues(values); + } + + @Override + public T lookup(Class clazz) { + if (clazz == LIRGeneratorOp.class) { + return null; + } + return super.lookup(clazz); + } + + @Override + public void addToLoop(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()); + assert index != null; + assert value != null; + newLocation.setIndex(index); + WriteNode writeNode = new WriteNode(location().getValueKind().stackKind(), object(), value, newLocation, graph()); + loop.loopEnd().replaceAtPredecessors(writeNode); + writeNode.setNext(loop.loopEnd()); + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/AccessArrayNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/AccessFieldNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import java.lang.reflect.*; +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/AccessIndexedNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/AccessMonitorNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.extended.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/ArrayLengthNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.compiler.graph.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/CheckCastNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/ExceptionObjectNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/InstanceOfNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/IsTypeNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/LoadFieldNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/LoadIndexedNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/MathIntrinsicNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; + +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/MonitorAddressNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/MonitorEnterNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; + +/** + * 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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/MonitorExitNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; + +/** + * 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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/NewArrayNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import java.util.*; + +import com.oracle.max.graal.compiler.*; +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +import com.oracle.max.graal.nodes.virtual.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/NewInstanceNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +import com.oracle.max.graal.nodes.virtual.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/NewMultiArrayNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/NewObjectArrayNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/NewTypeArrayNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/RegisterFinalizerNode.java Wed Aug 10 00:47:53 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.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.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/StoreFieldNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/StoreIndexedNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/java/TypeCheckNode.java Wed Aug 10 00:47:53 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.nodes.java; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/loop/BasicInductionVariableNode.java Wed Aug 10 00:47:53 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.nodes.loop; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.base.PhiNode.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/loop/DerivedInductionVariableNode.java Wed Aug 10 00:47:53 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.nodes.loop; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/loop/InductionVariableNode.java Wed Aug 10 00:47:53 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.nodes.loop; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/loop/LinearInductionVariableNode.java Wed Aug 10 00:47:53 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.nodes.loop; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/loop/LoopCounterNode.java Wed Aug 10 00:47:53 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.nodes.loop; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/Canonicalizable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/Canonicalizable.java Wed Aug 10 00:47:53 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.nodes.spi; + +import com.oracle.max.graal.graph.*; + + +public interface Canonicalizable { + Node canonical(NotifyReProcess reProcess); +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/EscapeField.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/EscapeField.java Wed Aug 10 00:47:53 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.nodes.spi; + +import com.sun.cri.ci.*; + +public class EscapeField { + + private String name; + private Object representation; + private CiKind kind; + + public EscapeField(String name, Object representation, CiKind kind) { + this.name = name; + this.representation = representation; + this.kind = kind; + } + + public String name() { + return name; + } + + public Object representation() { + return representation; + } + + public CiKind kind() { + return kind; + } + + @Override + public String toString() { + return name(); + } +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/EscapeOp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/EscapeOp.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,79 @@ +/* + * 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.nodes.spi; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.java.*; + + +public abstract class EscapeOp implements Op { + + public abstract boolean canAnalyze(Node node); + + public boolean escape(Node node, Node usage) { + if (usage instanceof IsNonNullNode) { + IsNonNullNode x = (IsNonNullNode) usage; + assert x.object() == node; + return false; + } 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 AccessMonitorNode) { + AccessMonitorNode x = (AccessMonitorNode) usage; + assert x.object() == node; + return false; + } else { + return true; + } + } + + public abstract EscapeField[] fields(Node node); + + public void beforeUpdate(Node node, Node usage) { + if (usage instanceof IsNonNullNode) { + IsNonNullNode x = (IsNonNullNode) usage; + // TODO (ls) not sure about this... + 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(ConstantNode.forBoolean(true, node.graph())); + } else if (usage instanceof AccessMonitorNode) { + AccessMonitorNode x = (AccessMonitorNode) usage; + x.replaceAndDelete(x.next()); + } + } + + public abstract int updateState(Node node, Node current, Map fieldIndex, ValueNode[] fieldState); + +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/spi/ExceptionExit.java Wed Aug 10 00:47:53 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.nodes.spi; + +import com.oracle.max.graal.nodes.base.*; + + +public interface ExceptionExit { + FixedNode exceptionEdge(); +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/LIRGeneratorOp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/LIRGeneratorOp.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.nodes.spi; + +import com.oracle.max.graal.graph.*; + +public interface LIRGeneratorOp extends Op { + void generate(Node n, LIRGeneratorTool generator); +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/LIRGeneratorTool.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/LIRGeneratorTool.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.nodes.spi; + +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.sun.cri.ci.*; + +public abstract class LIRGeneratorTool extends ValueVisitor { + public abstract CiValue load(ValueNode value); + public abstract CiVariable createResultVariable(ValueNode conv); + public abstract CiValue forceToSpill(CiValue value, CiKind kind, boolean b); + public abstract void emitMove(CiValue tmp, CiValue reg); + public abstract void integerAdd(ValueNode result, ValueNode x, ValueNode y); + public abstract void deoptimizeOn(Condition of); + public abstract CiVariable newVariable(CiKind kind); + public abstract CiTarget target(); + public abstract void emitLea(CiAddress address, CiVariable dest); + public abstract CiValue makeOperand(ValueNode object); + public abstract void emitUnsignedShiftRight(CiValue value, CiValue count, CiValue dst, CiValue tmp); + public abstract void emitAdd(CiValue a, CiValue b, CiValue dest); +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/LoweringOp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/LoweringOp.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.nodes.spi; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +public interface LoweringOp extends Op { + void lower(Node n, CiLoweringTool tool); +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/NotifyReProcess.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/NotifyReProcess.java Wed Aug 10 00:47:53 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.nodes.spi; + +import com.oracle.max.graal.graph.*; + + +public interface NotifyReProcess { + void reProccess(Node n); +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/ValueVisitor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/nodes/spi/ValueVisitor.java Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.graal.nodes.spi; + +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.java.*; + +/** + * The {@link ValueVisitor} implements one half of the visitor + * pattern for {@linkplain ValueNode IR values}, allowing clients to implement functionality + * depending on the type of an value without doing type tests. + */ +public abstract class ValueVisitor { + // Checkstyle: stop + public abstract void visitArithmetic(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(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(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(DeoptimizeNode deoptimize); + public abstract void visitUnwind(UnwindNode unwind); + 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(MathIntrinsicNode node); +} diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/virtual/VirtualObjectFieldNode.java Wed Aug 10 00:47:53 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.nodes.virtual; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/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/nodes/virtual/VirtualObjectNode.java Wed Aug 10 00:47:53 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.nodes.virtual; + +import java.util.*; + +import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; +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 d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/IntrinsifierImpl.java Wed Aug 10 00:47:53 2011 +0200 @@ -25,9 +25,9 @@ import java.util.*; import com.oracle.max.graal.compiler.graph.*; -import com.oracle.max.graal.compiler.nodes.base.*; import com.oracle.max.graal.extensions.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.base.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAddNode.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,10 +22,10 @@ */ package com.oracle.max.graal.examples.intrinsics; -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.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/opt/OptimizerImpl.java Wed Aug 10 00:47:53 2011 +0200 @@ -23,13 +23,13 @@ package com.oracle.max.graal.examples.opt; import com.oracle.max.graal.compiler.debug.*; -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.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.graph.collections.*; +import com.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/.checkstyle --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/.checkstyle Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/.checkstyle_checks.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/.checkstyle_checks.xml Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/.classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/.classpath Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,8 @@ + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/.project Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,29 @@ + + + com.oracle.max.graal.extensions + + + + + + org.eclipse.jdt.core.javabuilder + + + + + net.sourceforge.metrics.builder + + + + + net.sf.eclipsecs.core.CheckstyleBuilder + + + + + + org.eclipse.jdt.core.javanature + net.sourceforge.metrics.nature + net.sf.eclipsecs.core.CheckstyleNature + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/.settings/JavaSourceCodeFormatting.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/.settings/JavaSourceCodeFormatting.xml Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/.settings/org.eclipse.jdt.core.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/.settings/org.eclipse.jdt.core.prefs Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,355 @@ +#Tue Jul 13 10:33:43 PDT 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=true +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=200 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/.settings/org.eclipse.jdt.ui.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/.settings/org.eclipse.jdt.ui.prefs Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,64 @@ +#Thu Feb 18 11:36:17 PST 2010 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_MaxineJavaCodeStyle +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=0 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=0 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.extensions/LICENSE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.extensions/LICENSE Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,347 @@ +The GNU General Public License (GPL) + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to +most of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software is +covered by the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you +can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for +a fee, you must give the recipients all the rights that you have. You must +make sure that they, too, receive or can get the source code. And you must +show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) +offer you this license which gives you legal permission to copy, distribute +and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program proprietary. +To prevent this, we have made it clear that any patent must be licensed for +everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program +or work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included +without limitation in the term "modification".) Each licensee is addressed as +"you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is +not restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as +you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this License +and to the absence of any warranty; and give any other recipients of the +Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may +at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus +forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all of +these conditions: + + a) You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or + in part contains or is derived from the Program or any part thereof, to be + licensed as a whole at no charge to all third parties under the terms of + this License. + + c) If the modified program normally reads commands interactively when run, + you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms +of this License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based on +the Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of Sections 1 and +2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above + on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only + for noncommercial distribution and only if you received the program in + object code or executable form with such an offer, in accord with + Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all +the source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code +distributed need not include anything that is normally distributed (in either +source or binary form) with the major components (compiler, kernel, and so on) +of the operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source +code from the same place counts as distribution of the source code, even though +third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Program +or its derivative works. These actions are prohibited by law if you do not +accept this License. Therefore, by modifying or distributing the Program (or +any work based on the Program), you indicate your acceptance of this License to +do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), +the recipient automatically receives a license from the original licensor to +copy, distribute or modify the Program subject to these terms and conditions. +You may not impose any further restrictions on the recipients' exercise of the +rights granted herein. You are not responsible for enforcing compliance by +third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), conditions +are imposed on you (whether by court order, agreement or otherwise) that +contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot distribute so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not distribute the Program at all. +For example, if a patent license would not permit royalty-free redistribution +of the Program by all those who receive copies directly or indirectly through +you, then the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and +the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original +copyright holder who places the Program under this License may add an explicit +geographical distribution limitation excluding those countries, so that +distribution is permitted only in or among countries not thus excluded. In +such case, this License incorporates the limitation as if written in the body +of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any later +version", you have the option of following the terms and conditions either of +that version or of any later version published by the Free Software Foundation. +If the Program does not specify a version number of this License, you may +choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status of +all derivatives of our free software and of promoting the sharing and reuse of +software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE +PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA +BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER +OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion +of warranty; and each file should have at least the "copyright" line and a +pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + + Copyright (C) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program 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 for + more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., 59 + Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it +starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes + with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free + software, and you are welcome to redistribute it under certain conditions; + type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may be +called something other than 'show w' and 'show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here +is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + 'Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General Public +License instead of this License. + + +"CLASSPATH" EXCEPTION TO THE GPL + +Certain source files distributed by Sun Microsystems, Inc. are subject to +the following clarification and special exception to the GPL, but only where +Sun has expressly included in the particular source file's header the words +"Sun designates this particular file as subject to the "Classpath" exception +as provided by Sun in the LICENSE file that accompanied this code." + + Linking this library statically or dynamically with other modules is making + a combined work based on this library. Thus, the terms and conditions of + the GNU General Public License cover the whole combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules, + and to copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent module, + the terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. If + you modify this library, you may extend this exception to your version of + the library, but you are not obligated to do so. If you do not wish to do + so, delete this exception statement from your version. diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/.checkstyle --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/.checkstyle Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/.checkstyle_checks.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/.checkstyle_checks.xml Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/.classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/.classpath Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,8 @@ + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/.project Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,29 @@ + + + com.oracle.max.graal.nodes + + + + + + org.eclipse.jdt.core.javabuilder + + + + + net.sourceforge.metrics.builder + + + + + net.sf.eclipsecs.core.CheckstyleBuilder + + + + + + org.eclipse.jdt.core.javanature + net.sourceforge.metrics.nature + net.sf.eclipsecs.core.CheckstyleNature + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/.settings/JavaSourceCodeFormatting.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/.settings/JavaSourceCodeFormatting.xml Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/.settings/org.eclipse.jdt.core.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/.settings/org.eclipse.jdt.core.prefs Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,355 @@ +#Tue Jul 13 10:33:43 PDT 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=true +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=200 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/.settings/org.eclipse.jdt.ui.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/.settings/org.eclipse.jdt.ui.prefs Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,64 @@ +#Thu Feb 18 11:36:17 PST 2010 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_MaxineJavaCodeStyle +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=0 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=0 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.nodes/LICENSE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.nodes/LICENSE Wed Aug 10 00:47:53 2011 +0200 @@ -0,0 +1,347 @@ +The GNU General Public License (GPL) + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to +most of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software is +covered by the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you +can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for +a fee, you must give the recipients all the rights that you have. You must +make sure that they, too, receive or can get the source code. And you must +show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) +offer you this license which gives you legal permission to copy, distribute +and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program proprietary. +To prevent this, we have made it clear that any patent must be licensed for +everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program +or work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included +without limitation in the term "modification".) Each licensee is addressed as +"you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is +not restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as +you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this License +and to the absence of any warranty; and give any other recipients of the +Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may +at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus +forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all of +these conditions: + + a) You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or + in part contains or is derived from the Program or any part thereof, to be + licensed as a whole at no charge to all third parties under the terms of + this License. + + c) If the modified program normally reads commands interactively when run, + you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms +of this License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based on +the Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of Sections 1 and +2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above + on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only + for noncommercial distribution and only if you received the program in + object code or executable form with such an offer, in accord with + Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all +the source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code +distributed need not include anything that is normally distributed (in either +source or binary form) with the major components (compiler, kernel, and so on) +of the operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source +code from the same place counts as distribution of the source code, even though +third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Program +or its derivative works. These actions are prohibited by law if you do not +accept this License. Therefore, by modifying or distributing the Program (or +any work based on the Program), you indicate your acceptance of this License to +do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), +the recipient automatically receives a license from the original licensor to +copy, distribute or modify the Program subject to these terms and conditions. +You may not impose any further restrictions on the recipients' exercise of the +rights granted herein. You are not responsible for enforcing compliance by +third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), conditions +are imposed on you (whether by court order, agreement or otherwise) that +contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot distribute so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not distribute the Program at all. +For example, if a patent license would not permit royalty-free redistribution +of the Program by all those who receive copies directly or indirectly through +you, then the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and +the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original +copyright holder who places the Program under this License may add an explicit +geographical distribution limitation excluding those countries, so that +distribution is permitted only in or among countries not thus excluded. In +such case, this License incorporates the limitation as if written in the body +of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any later +version", you have the option of following the terms and conditions either of +that version or of any later version published by the Free Software Foundation. +If the Program does not specify a version number of this License, you may +choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status of +all derivatives of our free software and of promoting the sharing and reuse of +software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE +PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA +BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER +OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion +of warranty; and each file should have at least the "copyright" line and a +pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + + Copyright (C) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program 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 for + more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., 59 + Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it +starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes + with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free + software, and you are welcome to redistribute it under certain conditions; + type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may be +called something other than 'show w' and 'show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here +is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + 'Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General Public +License instead of this License. + + +"CLASSPATH" EXCEPTION TO THE GPL + +Certain source files distributed by Sun Microsystems, Inc. are subject to +the following clarification and special exception to the GPL, but only where +Sun has expressly included in the particular source file's header the words +"Sun designates this particular file as subject to the "Classpath" exception +as provided by Sun in the LICENSE file that accompanied this code." + + Linking this library statically or dynamically with other modules is making + a combined work based on this library. Thus, the terms and conditions of + the GNU General Public License cover the whole combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules, + and to copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent module, + the terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. If + you modify this library, you may extend this exception to your version of + the library, but you are not obligated to do so. If you do not wish to do + so, delete this exception statement from your version. diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java Wed Aug 10 00:47:53 2011 +0200 @@ -28,12 +28,12 @@ import com.oracle.max.graal.compiler.*; 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.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.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.calc.ConditionalNode.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.java.*; import com.oracle.max.graal.runtime.nodes.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/ArrayWriteBarrier.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,10 +22,10 @@ */ package com.oracle.max.graal.runtime.nodes; -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.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.extended.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/CurrentThread.java Wed Aug 10 00:47:53 2011 +0200 @@ -23,9 +23,9 @@ package com.oracle.max.graal.runtime.nodes; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.graal.compiler.nodes.calc.*; -import com.oracle.max.graal.compiler.nodes.spi.*; import com.oracle.max.graal.graph.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FPConversionNode.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,10 +22,10 @@ */ package com.oracle.max.graal.runtime.nodes; -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.oracle.max.graal.nodes.base.*; +import com.oracle.max.graal.nodes.calc.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FieldWriteBarrier.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FieldWriteBarrier.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/FieldWriteBarrier.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.max.graal.runtime.nodes; -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.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.ci.*; diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeLoad.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeLoad.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeLoad.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.max.graal.runtime.nodes; -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.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeStore.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeStore.java Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/UnsafeStore.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.max.graal.runtime.nodes; -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.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; import com.sun.cri.ci.*; /** diff -r d683f8a40c05 -r da773e1b6d9f 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 Wed Aug 10 00:34:29 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/nodes/WriteBarrier.java Wed Aug 10 00:47:53 2011 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.max.graal.runtime.nodes; -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.nodes.base.*; +import com.oracle.max.graal.nodes.spi.*; import com.oracle.max.graal.runtime.*; import com.sun.cri.ci.*;