# HG changeset patch # User Gilles Duboscq # Date 1308589595 -7200 # Node ID 546dc7e1b18469e731e3ac241cfc94058d53acca # Parent cebfa0b55183e933666ea3a8ded0b3e33a5a3e3e# Parent 963174f9cd8e115a567699c7f48cfe985583f50d Merge diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.compiler/.classpath --- a/graal/com.oracle.max.graal.compiler/.classpath Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/.classpath Mon Jun 20 19:06:35 2011 +0200 @@ -4,7 +4,7 @@ + - diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Mon Jun 20 19:06:35 2011 +0200 @@ -595,8 +595,8 @@ // iterate all blocks for (int i = 0; i < numBlocks; i++) { LIRBlock block = blockAt(i); - final CiBitMap liveGen = new CiBitMap(liveSize); - final CiBitMap liveKill = new CiBitMap(liveSize); + final BitMap liveGen = new BitMap(liveSize); + final BitMap liveKill = new BitMap(liveSize); List instructions = block.lir().instructionsList(); int numInst = instructions.size(); @@ -697,8 +697,8 @@ block.liveGen = liveGen; block.liveKill = liveKill; - block.liveIn = new CiBitMap(liveSize); - block.liveOut = new CiBitMap(liveSize); + block.liveIn = new BitMap(liveSize); + block.liveOut = new BitMap(liveSize); if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("liveGen B%d %s", block.blockID(), block.liveGen); @@ -709,7 +709,7 @@ intervalInLoop = localIntervalInLoop; } - private void verifyTemp(CiBitMap liveKill, CiValue operand) { + private void verifyTemp(BitMap liveKill, CiValue operand) { // fixed intervals are never live at block boundaries, so // they need not be processed in live sets // process them only in debug mode so that this can be checked @@ -720,7 +720,7 @@ } } - private void verifyInput(LIRBlock block, CiBitMap liveKill, CiValue operand) { + private void verifyInput(LIRBlock block, BitMap liveKill, CiValue operand) { // fixed intervals are never live at block boundaries, so // they need not be processed in live sets. // this is checked by these assertions to be sure about it. @@ -742,7 +742,7 @@ boolean changeOccurred; boolean changeOccurredInBlock; int iterationCount = 0; - CiBitMap liveOut = new CiBitMap(liveSetSize()); // scratch set for calculations + BitMap liveOut = new BitMap(liveSetSize()); // scratch set for calculations // Perform a backward dataflow analysis to compute liveOut and liveIn for each block. // The loop is executed until a fixpoint is reached (no changes in an iteration) @@ -770,7 +770,7 @@ if (!block.liveOut.isSame(liveOut)) { // A change occurred. Swap the old and new live out sets to avoid copying. - CiBitMap temp = block.liveOut; + BitMap temp = block.liveOut; block.liveOut = liveOut; liveOut = temp; @@ -782,7 +782,7 @@ if (iterationCount == 0 || changeOccurredInBlock) { // liveIn(block) is the union of liveGen(block) with (liveOut(block) & !liveKill(block)) // note: liveIn has to be computed only in first iteration or if liveOut has changed! - CiBitMap liveIn = block.liveIn; + BitMap liveIn = block.liveIn; liveIn.setFrom(block.liveOut); liveIn.setDifference(block.liveKill); liveIn.setUnion(block.liveGen); @@ -805,7 +805,7 @@ // check that the liveIn set of the first block is empty LIRBlock startBlock = ir.startBlock; - CiBitMap liveInArgs = new CiBitMap(startBlock.liveIn.size()); + BitMap liveInArgs = new BitMap(startBlock.liveIn.size()); if (!startBlock.liveIn.isSame(liveInArgs)) { if (GraalOptions.DetailedAsserts) { reportFailure(numBlocks); @@ -1183,7 +1183,7 @@ assert blockTo == instructions.get(instructions.size() - 1).id; // Update intervals for operands live at the end of this block; - CiBitMap live = block.liveOut; + BitMap live = block.liveOut; for (int operandNum = live.nextSetBit(0); operandNum >= 0; operandNum = live.nextSetBit(operandNum + 1)) { assert live.get(operandNum) : "should not stop here otherwise"; CiValue operand = operands.operandFor(operandNum); @@ -1534,7 +1534,7 @@ assert moveResolver.checkEmpty(); int numOperands = operands.size(); - CiBitMap liveAtEdge = toBlock.liveIn; + BitMap liveAtEdge = toBlock.liveIn; // visit all variables for which the liveAtEdge bit is set for (int operandNum = liveAtEdge.nextSetBit(0); operandNum >= 0; operandNum = liveAtEdge.nextSetBit(operandNum + 1)) { @@ -1597,8 +1597,8 @@ void resolveDataFlow() { int numBlocks = blockCount(); MoveResolver moveResolver = new MoveResolver(this); - CiBitMap blockCompleted = new CiBitMap(numBlocks); - CiBitMap alreadyResolved = new CiBitMap(numBlocks); + BitMap blockCompleted = new BitMap(numBlocks); + BitMap alreadyResolved = new BitMap(numBlocks); int i; for (i = 0; i < numBlocks; i++) { @@ -1768,7 +1768,7 @@ return new IntervalWalker(this, oopIntervals, nonOopIntervals); } - void computeOopMap(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info, boolean isCallSite, CiBitMap frameRefMap, CiBitMap regRefMap) { + void computeOopMap(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info, boolean isCallSite, BitMap frameRefMap, BitMap regRefMap) { if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("creating oop map at opId %d", op.id); } @@ -1817,7 +1817,7 @@ return attributes(operand.asRegister()).isCallerSave; } - void computeOopMap(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info, CiBitMap frameRefMap, CiBitMap regRefMap) { + void computeOopMap(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info, BitMap frameRefMap, BitMap regRefMap) { computeOopMap(iw, op, info, op.hasCall, frameRefMap, regRefMap); if (op instanceof LIRCall) { List pointerSlots = ((LIRCall) op).pointerSlots; @@ -1884,7 +1884,7 @@ } } - CiFrame computeFrameForState(FrameState state, int opId, CiBitMap frameRefMap) { + CiFrame computeFrameForState(FrameState state, int opId, BitMap frameRefMap) { CiValue[] values = new CiValue[state.valuesSize() + state.locksSize()]; int valueIndex = 0; @@ -1935,18 +1935,18 @@ if (info.debugInfo == null) { int frameSize = compilation.frameMap().frameSize(); int frameWords = frameSize / compilation.target.spillSlotSize; - CiBitMap frameRefMap = new CiBitMap(frameWords); - CiBitMap regRefMap = !op.hasCall ? new CiBitMap(compilation.target.arch.registerReferenceMapBitCount) : null; + BitMap frameRefMap = new BitMap(frameWords); + BitMap regRefMap = !op.hasCall ? new BitMap(compilation.target.arch.registerReferenceMapBitCount) : null; CiFrame frame = compilation.placeholderState != null ? null : computeFrame(info.state, op.id, frameRefMap); computeOopMap(iw, op, info, frameRefMap, regRefMap); info.debugInfo = new CiDebugInfo(frame, regRefMap, frameRefMap); } else if (GraalOptions.DetailedAsserts) { - assert info.debugInfo.frame().equals(computeFrame(info.state, op.id, new CiBitMap(info.debugInfo.frameRefMap.size()))); + assert info.debugInfo.frame().equals(computeFrame(info.state, op.id, new BitMap(info.debugInfo.frameRefMap.size()))); } } } - CiFrame computeFrame(FrameState state, int opId, CiBitMap frameRefMap) { + CiFrame computeFrame(FrameState state, int opId, BitMap frameRefMap) { if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("creating debug information at opId %d", opId); } @@ -2294,7 +2294,7 @@ for (int i = 0; i < numBlocks; i++) { LIRBlock block = blockAt(i); - CiBitMap liveAtEdge = block.liveIn; + BitMap liveAtEdge = block.liveIn; // visit all operands where the liveAtEdge bit is set for (int operandNum = liveAtEdge.nextSetBit(0); operandNum >= 0; operandNum = liveAtEdge.nextSetBit(operandNum + 1)) { diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Mon Jun 20 19:06:35 2011 +0200 @@ -26,6 +26,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; /** @@ -72,17 +73,17 @@ /** * Records which variable operands have the {@link VariableFlag#MustBeByteRegister} flag set. */ - private CiBitMap mustBeByteRegister; + private BitMap mustBeByteRegister; /** * Records which variable operands have the {@link VariableFlag#MustStartInMemory} flag set. */ - private CiBitMap mustStartInMemory; + private BitMap mustStartInMemory; /** * Records which variable operands have the {@link VariableFlag#MustStayInMemory} flag set. */ - private CiBitMap mustStayInMemory; + private BitMap mustStayInMemory; /** * Flags that can be set for {@linkplain CiValue#isVariable() variable} operands. @@ -108,19 +109,19 @@ public static final VariableFlag[] VALUES = values(); } - private static CiBitMap set(CiBitMap map, CiVariable variable) { + private static BitMap set(BitMap map, CiVariable variable) { if (map == null) { - int length = CiBitMap.roundUpLength(variable.index + 1); - map = new CiBitMap(length); + int length = BitMap.roundUpLength(variable.index + 1); + map = new BitMap(length); } else if (map.size() <= variable.index) { - int length = CiBitMap.roundUpLength(variable.index + 1); + int length = BitMap.roundUpLength(variable.index + 1); map.grow(length); } map.set(variable.index); return map; } - private static boolean get(CiBitMap map, CiVariable variable) { + private static boolean get(BitMap map, CiVariable variable) { if (map == null || map.size() <= variable.index) { return false; } diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Mon Jun 20 19:06:35 2011 +0200 @@ -329,7 +329,7 @@ } if (info.hasStackRefMap()) { sb.append("frame-ref-map:"); - CiBitMap bm = info.frameRefMap; + BitMap bm = info.frameRefMap; for (int i = bm.nextSetBit(0); i >= 0; i = bm.nextSetBit(i + 1)) { sb.append(' ').append(CiStackSlot.get(CiKind.Object, i)); } diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Mon Jun 20 19:06:35 2011 +0200 @@ -87,7 +87,7 @@ */ public void beginGroup(String name, String shortName, int bci) { stream.println(""); - stream.printf("

%s

%n", escape(name)); + stream.printf("

%s

Graal

%n", escape(name)); stream.printf(" %n", escape(name), escape(shortName), bci); } diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Mon Jun 20 19:06:35 2011 +0200 @@ -104,7 +104,7 @@ new LoopPhase().apply(graph); - new LoweringPhase().apply(graph); + new LoweringPhase(compilation.runtime).apply(graph); IdentifyBlocksPhase schedule = new IdentifyBlocksPhase(true); schedule.apply(graph); diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java Mon Jun 20 19:06:35 2011 +0200 @@ -29,6 +29,7 @@ import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.lir.*; import com.oracle.max.graal.compiler.util.*; +import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; public final class ComputeLinearScanOrder { @@ -40,9 +41,9 @@ List linearScanOrder; // the resulting list of blocks in correct order - final CiBitMap visitedBlocks; // used for recursive processing of blocks - final CiBitMap activeBlocks; // used for recursive processing of blocks - final CiBitMap dominatorBlocks; // temporary BitMap used for computation of dominator + final BitMap visitedBlocks; // used for recursive processing of blocks + final BitMap activeBlocks; // used for recursive processing of blocks + final BitMap dominatorBlocks; // temporary BitMap used for computation of dominator final int[] forwardBranches; // number of incoming forward branches for each block final List loopEndBlocks; // list of all loop end blocks collected during countEdges BitMap2D loopMap; // two-dimensional bit set: a bit is set if a block is contained in a loop @@ -111,9 +112,9 @@ public ComputeLinearScanOrder(int maxBlockId, LIRBlock startBlock) { this.maxBlockId = maxBlockId; - visitedBlocks = new CiBitMap(maxBlockId); - activeBlocks = new CiBitMap(maxBlockId); - dominatorBlocks = new CiBitMap(maxBlockId); + visitedBlocks = new BitMap(maxBlockId); + activeBlocks = new BitMap(maxBlockId); + dominatorBlocks = new BitMap(maxBlockId); forwardBranches = new int[maxBlockId]; loopEndBlocks = new ArrayList(8); workList = new ArrayList(8); diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadField.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadField.java Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/LoadField.java Mon Jun 20 19:06:35 2011 +0200 @@ -25,8 +25,8 @@ import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.phases.CanonicalizerPhase.CanonicalizerOp; +import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.compiler.phases.LoweringPhase.LoweringOp; -import com.oracle.max.graal.compiler.phases.LoweringPhase.LoweringTool; import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -36,7 +36,6 @@ */ public final class LoadField extends AccessField { private static final LoadFieldCanonicalizerOp CANONICALIZER = new LoadFieldCanonicalizerOp(); - private static final LoadFieldLoweringOp LOWERING = new LoadFieldLoweringOp(); private static final int INPUT_COUNT = 0; private static final int SUCCESSOR_COUNT = 0; @@ -120,31 +119,11 @@ if (clazz == CanonicalizerOp.class) { return (T) CANONICALIZER; } else if (clazz == LoweringOp.class) { - return (T) LOWERING; + return (T) LoweringPhase.DELEGATE_TO_RUNTIME; } return super.lookup(clazz); } - private static class LoadFieldLoweringOp implements LoweringOp { - - @Override - public Node lower(Node n, LoweringTool tool) { - LoadField field = (LoadField) n; - if (field.isVolatile()) { - return null; - } - Graph graph = field.graph(); - int displacement = field.field().offset(); - assert field.kind != CiKind.Illegal; - MemoryRead memoryRead = new MemoryRead(field.field().kind(), displacement, graph); - memoryRead.setGuard(new IsNonNull(field.object(), graph)); - memoryRead.setNext(field.next()); - memoryRead.setLocation(field.object()); - return memoryRead; - } - - } - private static class LoadFieldCanonicalizerOp implements CanonicalizerOp { @Override public Node canonical(Node node) { diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java Mon Jun 20 19:06:35 2011 +0200 @@ -30,7 +30,6 @@ import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; /** * The {@code LIRBlock} class definition. @@ -51,7 +50,7 @@ * in this block. * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. */ - public CiBitMap liveIn; + public BitMap liveIn; /** * Bit map specifying which {@linkplain OperandPool operands} are live upon exit from this block. @@ -59,20 +58,20 @@ * upon entry to this block. * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. */ - public CiBitMap liveOut; + public BitMap liveOut; /** * Bit map specifying which {@linkplain OperandPool operands} are used (before being defined) in this block. * That is, these are the values that are live upon entry to the block. * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. */ - public CiBitMap liveGen; + public BitMap liveGen; /** * Bit map specifying which {@linkplain OperandPool operands} are defined/overwritten in this block. * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. */ - public CiBitMap liveKill; + public BitMap liveKill; private int firstLirInstructionID; private int lastLirInstructionID; diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java Mon Jun 20 19:06:35 2011 +0200 @@ -25,6 +25,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.value.*; +import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; /** @@ -62,7 +63,7 @@ return new LIRDebugInfo(this); } - public void setOop(CiValue location, GraalCompilation compilation, CiBitMap frameRefMap, CiBitMap regRefMap) { + public void setOop(CiValue location, GraalCompilation compilation, BitMap frameRefMap, BitMap regRefMap) { CiTarget target = compilation.target; if (location.isAddress()) { CiAddress stackLocation = (CiAddress) location; @@ -97,7 +98,7 @@ return debugInfo != null; } - public static void setBit(CiBitMap refMap, int bit) { + public static void setBit(BitMap refMap, int bit) { assert !refMap.get(bit) : "Ref map entry " + bit + " is already set."; refMap.set(bit); } diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java Mon Jun 20 19:06:35 2011 +0200 @@ -28,6 +28,7 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.lir.LIROperand.*; +import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; /** @@ -500,7 +501,7 @@ protected static String refMapToString(CiDebugInfo debugInfo, OperandFormatter operandFmt) { StringBuilder buf = new StringBuilder(); if (debugInfo.hasStackRefMap()) { - CiBitMap bm = debugInfo.frameRefMap; + BitMap bm = debugInfo.frameRefMap; for (int slot = bm.nextSetBit(0); slot >= 0; slot = bm.nextSetBit(slot + 1)) { if (buf.length() != 0) { buf.append(", "); @@ -509,7 +510,7 @@ } } if (debugInfo.hasRegisterRefMap()) { - CiBitMap bm = debugInfo.registerRefMap; + BitMap bm = debugInfo.registerRefMap; for (int reg = bm.nextSetBit(0); reg >= 0; reg = bm.nextSetBit(reg + 1)) { if (buf.length() != 0) { buf.append(", "); diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java Mon Jun 20 19:06:35 2011 +0200 @@ -26,8 +26,24 @@ import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; public class LoweringPhase extends Phase { + + public static final LoweringOp DELEGATE_TO_RUNTIME = new LoweringOp() { + @Override + public Node lower(Node n, CiLoweringTool tool) { + return tool.getRuntime().lower(n, tool); + } + }; + + private final RiRuntime runtime; + + public LoweringPhase(RiRuntime runtime) { + this.runtime = runtime; + } + @Override protected void run(final Graph graph) { final IdentifyBlocksPhase s = new IdentifyBlocksPhase(false); @@ -36,9 +52,9 @@ for (Block b : s.getBlocks()) { //final Node firstNode = b.firstNode(); - final LoweringTool loweringTool = new LoweringTool() { + final CiLoweringTool loweringTool = new CiLoweringTool() { @Override - public Node createStructuredBlockAnchor() { + public Node getGuardAnchor() { throw Util.unimplemented(); // if (!(firstNode instanceof Anchor) && !(firstNode instanceof Merge)) { // Anchor a = new Anchor(graph); @@ -51,6 +67,11 @@ // } // return firstNode; } + + @Override + public RiRuntime getRuntime() { + return runtime; + } }; for (final Node n : b.getInstructions()) { @@ -67,11 +88,7 @@ } } - public interface LoweringTool { - Node createStructuredBlockAnchor(); - } - public interface LoweringOp extends Op { - Node lower(Node n, LoweringTool tool); + Node lower(Node n, CiLoweringTool tool); } } diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java Mon Jun 20 19:06:35 2011 +0200 @@ -29,7 +29,6 @@ import com.oracle.max.graal.compiler.phases.*; import com.oracle.max.graal.compiler.value.*; import com.oracle.max.graal.graph.*; -import com.sun.cri.ci.*; public class IdentifyBlocksPhase extends Phase { @@ -183,7 +182,7 @@ for (int i = 1; i < b.getPredecessors().size(); ++i) { dominatorBlock = getCommonDominator(dominatorBlock, b.getPredecessors().get(i)); } - CiBitMap blockMap = new CiBitMap(blocks.size()); + BitMap blockMap = new BitMap(blocks.size()); markPredecessors(b, dominatorBlock, blockMap); Block result = dominatorBlock; @@ -203,7 +202,7 @@ return b.javaBlock(); } - private void markPredecessors(Block b, Block stopBlock, CiBitMap blockMap) { + private void markPredecessors(Block b, Block stopBlock, BitMap blockMap) { if (blockMap.get(b.blockID())) { return; } @@ -368,7 +367,7 @@ private void computeDominators() { Block dominatorRoot = nodeToBlock.get(graph.start()); assert dominatorRoot.getPredecessors().size() == 0; - CiBitMap visited = new CiBitMap(blocks.size()); + BitMap visited = new BitMap(blocks.size()); visited.set(dominatorRoot.blockID()); LinkedList workList = new LinkedList(); workList.add(dominatorRoot); @@ -415,7 +414,7 @@ } public Block commonDominator(Block a, Block b) { - CiBitMap bitMap = new CiBitMap(blocks.size()); + BitMap bitMap = new BitMap(blocks.size()); Block cur = a; while (cur != null) { bitMap.set(cur.blockID()); diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/BitMap2D.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/BitMap2D.java Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/BitMap2D.java Mon Jun 20 19:06:35 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.util; -import com.sun.cri.ci.*; +import com.oracle.max.graal.graph.*; /** * This class implements a two-dimensional bitmap. @@ -32,7 +32,7 @@ */ public final class BitMap2D { - private CiBitMap map; + private BitMap map; private final int bitsPerSlot; private int bitIndex(int slotIndex, int bitWithinSlotIndex) { @@ -45,7 +45,7 @@ } public BitMap2D(int sizeInSlots, int bitsPerSlot) { - map = new CiBitMap(sizeInSlots * bitsPerSlot); + map = new BitMap(sizeInSlots * bitsPerSlot); this.bitsPerSlot = bitsPerSlot; } @@ -84,7 +84,7 @@ while (size <= slotIndex) { size *= 2; } - CiBitMap newBitMap = new CiBitMap(size * bitsPerSlot); + BitMap newBitMap = new BitMap(size * bitsPerSlot); newBitMap.setUnion(map); map = newBitMap; } diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/.checkstyle --- a/graal/com.oracle.max.graal.graph/.checkstyle Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/.classpath --- a/graal/com.oracle.max.graal.graph/.classpath Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/.project --- a/graal/com.oracle.max.graal.graph/.project Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ - - - com.oracle.max.graal.graph - - - - - - org.eclipse.jdt.core.javabuilder - - - - - net.sf.eclipsecs.core.CheckstyleBuilder - - - - - - org.eclipse.jdt.core.javanature - net.sf.eclipsecs.core.CheckstyleNature - - diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/.settings/org.eclipse.jdt.core.prefs --- a/graal/com.oracle.max.graal.graph/.settings/org.eclipse.jdt.core.prefs Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,270 +0,0 @@ -#Wed Apr 27 22:10:44 CEST 2011 -eclipse.preferences.version=1 -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.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -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_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_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=true -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=insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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.format_guardian_clause_on_one_line=false -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_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_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/.settings/org.eclipse.jdt.ui.prefs --- a/graal/com.oracle.max.graal.graph/.settings/org.eclipse.jdt.ui.prefs Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -#Wed Apr 27 22:10:44 CEST 2011 -eclipse.preferences.version=1 -formatter_profile=_C1XJavaCodeStyle -formatter_settings_version=11 diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/EdgeType.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/EdgeType.java Mon Jun 20 18:41:26 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.graph; - - -public enum EdgeType { - INPUTS, - USAGES, - PREDECESSORS, - SUCCESSORS; -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +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.graph; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public class Graph { - - public static final List verificationListeners = new ArrayList(4); - - private final ArrayList nodes; - private final StartNode start; - int nextId; - int deletedNodeCount; - - static int nextGraphId = 0; - int id = nextGraphId++; - - @Override - public String toString() { - return "Graph " + id; - } - - public Graph() { - nodes = new ArrayList(); - start = new StartNode(this); - } - - public int getDeletedNodeCount() { - return deletedNodeCount; - } - - public int getNodeCount() { - return nodes.size() - getDeletedNodeCount(); - } - - public List getNodes() { - return Collections.unmodifiableList(nodes); - } - - public class TypedNodeIterator implements Iterator { - private final Class type; - private int index; - - public TypedNodeIterator(Class type) { - this.type = type; - this.index = -1; - forward(); - } - - private void forward() { - if (index < nodes.size()) { - do { - index++; - } while (index < nodes.size() && !type.isInstance(nodes.get(index))); - if (index >= nodes.size()) { - index = Integer.MAX_VALUE; - } - } - } - - @Override - public boolean hasNext() { - return index < nodes.size(); - } - - @Override - @SuppressWarnings("unchecked") - public T next() { - try { - return (T) nodes.get(index); - } finally { - forward(); - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - } - - public Iterable getNodes(final Class type) { - return new Iterable() { - @Override - public Iterator iterator() { - return new TypedNodeIterator(type); - } - }; - } - - int register(Node node) { - int id = nextId++; - nodes.add(id, node); - return id; - } - - void unregister(Node node) { - nodes.set(node.id(), Node.Null); - deletedNodeCount++; - } - - public StartNode start() { - return start; - } - - public NodeBitMap createNodeBitMap() { - return new NodeBitMap(this); - } - - public NodeMap createNodeMap() { - return new NodeMap(this); - } - - public NodeFlood createNodeFlood() { - return new NodeFlood(this); - } - - public NodeWorkList createNodeWorkList() { - return new NodeWorkList(this); - } - - public NodeWorkList createNodeWorkList(boolean fill, int iterationLimitPerNode) { - return new NodeWorkList(this, fill, iterationLimitPerNode); - } - - public boolean verify() { - for (Node n : getNodes()) { - assert n == Node.Null || n.verify(); - } - return true; - } - - public Map addDuplicate(Collection nodes, Map replacements) { - Map newNodes = new HashMap(); - // create node duplicates - for (Node node : nodes) { - if (node != null && !replacements.containsKey(node)) { - assert node.graph != this; - assert !node.isDeleted() : "trying to duplicate deleted node"; - Node newNode = node.copy(this); - assert newNode.getClass() == node.getClass(); - newNodes.put(node, newNode); - } - } - // re-wire inputs - for (Entry entry : newNodes.entrySet()) { - Node oldNode = entry.getKey(); - Node node = entry.getValue(); - for (int i = 0; i < oldNode.inputs().size(); i++) { - Node input = oldNode.inputs().get(i); - Node target = replacements.get(input); - if (target == null) { - target = newNodes.get(input); - } - node.inputs().setOrExpand(i, target); - } - } - for (Entry entry : replacements.entrySet()) { - Node oldNode = entry.getKey(); - Node node = entry.getValue(); - for (int i = 0; i < oldNode.inputs().size(); i++) { - Node input = oldNode.inputs().get(i); - if (newNodes.containsKey(input)) { - node.inputs().setOrExpand(i, newNodes.get(input)); - } - } - } - - // re-wire successors - for (Entry entry : newNodes.entrySet()) { - Node oldNode = entry.getKey(); - Node node = entry.getValue(); - for (int i = 0; i < oldNode.successors().size(); i++) { - Node succ = oldNode.successors().get(i); - Node target = replacements.get(succ); - if (target == null) { - target = newNodes.get(succ); - } - node.successors().setOrExpand(i, target); - } - } - for (Entry entry : replacements.entrySet()) { - Node oldNode = entry.getKey(); - Node node = entry.getValue(); - for (int i = 0; i < oldNode.successors().size(); i++) { - Node succ = oldNode.successors().get(i); - if (newNodes.containsKey(succ)) { - node.successors().setOrExpand(i, newNodes.get(succ)); - } - } - } - return newNodes; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +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.graph; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public abstract class Node { - - public static final Node Null = null; - public static final int DeletedID = -1; - - final Graph graph; - private int id; - final NodeArray inputs; - final NodeArray successors; - final ArrayList usages; - final ArrayList predecessors; - - public Node(int inputCount, int successorCount, Graph graph) { - assert graph != null : "cannot create a node for a null graph"; - this.graph = graph; - this.id = graph.register(this); - this.inputs = new NodeArray(this, inputCount); - this.successors = new NodeArray(this, successorCount); - this.predecessors = new ArrayList(1); - this.usages = new ArrayList(4); - } - - public List predecessors() { - return Collections.unmodifiableList(predecessors); - } - - public List usages() { - return Collections.unmodifiableList(usages); - } - - public NodeArray inputs() { - return inputs; - } - - public NodeArray successors() { - return successors; - } - - public int id() { - return id; - } - - public Graph graph() { - return graph; - } - - public T lookup(Class clazz) { - return null; - } - - public String shortName() { - return getClass().getSimpleName(); - } - - public Node replace(Node other) { - assert !isDeleted() && (other == null || !other.isDeleted()) : "id: " + id() + ", other: " + other; - assert other == null || other.graph == graph; - for (Node usage : usages) { - usage.inputs.replaceFirstOccurrence(this, other); - } - int z = 0; - for (Node predecessor : predecessors) { - for (int i = 0; i < predecessor.successors.size(); i++) { - if (predecessor.successors.get(i) == this) { - predecessor.successors.silentSet(i, other); - } - } - ++z; - } - if (other != null) { - other.usages.addAll(usages); - other.predecessors.addAll(predecessors); - } - usages.clear(); - predecessors.clear(); - delete(); - assert other == null || other.verify(); - return other; - } - - public boolean isDeleted() { - return id == DeletedID; - } - - public void forceDelete() { - for (Node n : usages) { - n.inputs.silentRemove(this); - } - for (Node n : predecessors) { - n.successors.silentRemove(this); - } - usages.clear(); - predecessors.clear(); - } - - public void unsafeDelete() { - graph.unregister(this); - id = DeletedID; - assert isDeleted(); - } - - public void delete() { - assert !isDeleted(); - assert checkDeletion() : "Could not delete " + this + " (usages: " + this.usages() + ", predecessors: " + this.predecessors() + ")"; - - for (int i = 0; i < inputs.size(); ++i) { - inputs.set(i, Null); - } - for (int i = 0; i < successors.size(); ++i) { - successors.set(i, Null); - } - assert predecessors().size() == 0 && usages().size() == 0; - unsafeDelete(); - } - - private boolean checkDeletion() { - if (usages.size() != 0 || predecessors.size() != 0) { - System.out.println(this.shortName() + ", id: " + id + ", usages: " + usages.size() + ", predecessors: " + predecessors().size()); - System.out.println("usages:"); - for (Node n : usages()) { - System.out.print(n.id() + " (" + n.shortName() + ") "); - } - System.out.println("\npreds:"); - for (Node n : predecessors()) { - System.out.print(n.id() + " (" + n.shortName() + ") "); - } - System.out.println(); - return false; - } - return true; - } - - public final Node copy() { - return copy(graph); - } - - /** - * - * @param into - * @return - */ - public abstract Node copy(Graph into); - - /** - * - * @return - */ - protected int inputCount() { - return 0; - } - - /** - * - * @return - */ - protected int successorCount() { - return 0; - } - - /** - * Provides a {@link Map} of properties of this node for use in debugging (e.g., to view in the ideal graph - * visualizer). Subclasses overriding this method should add to the map returned by their superclass. - */ - public Map getDebugProperties() { - Map map = new HashMap(); - map.put("inputCount", inputCount()); - map.put("usageCount", usages.size()); - map.put("successorCount", successorCount()); - map.put("predecessorCount", predecessors.size()); - return map; - } - - @Override - public String toString() { - return this.getClass().getSimpleName() + "-" + this.id(); - } - - public boolean verify() { - return true; - } - - public final void assertTrue(boolean cond) { - assert cond || assertionFailure(""); - } - - public final void assertTrue(boolean cond, String message) { - assert cond || assertionFailure(message); - } - - public final boolean assertionFailure(String message) { - for (VerificationListener l : Graph.verificationListeners) { - l.verificationFailed(this, message); - } - return true; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +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.graph; - -import java.util.AbstractList; -import java.util.Arrays; -import java.util.Iterator; - -public class NodeArray extends AbstractList { - - private final Node node; - private Node[] nodes; - private final int fixedLength; - private int variableLength; - - public NodeArray(Node node, int length) { - this.node = node; - this.nodes = new Node[length]; - this.fixedLength = length; - } - - @Override - public Iterator iterator() { - return Arrays.asList(this.nodes).iterator(); - } - - private Node self() { - return this.node; - } - - Node silentSet(int index, Node node) { - Node result = nodes[index]; - nodes[index] = node; - return result; - } - - public AbstractList variablePart() { - return new AbstractList() { - - @Override - public Node get(int index) { - checkIndex(index); - return NodeArray.this.get(fixedLength + index); - } - - @Override - public int size() { - return variableLength; - } - - public Node set(int index, Node element) { - checkIndex(index); - return NodeArray.this.set(fixedLength + index, element); - } - - public void add(int index, Node element) { - variableLength++; - checkIndex(index); - NodeArray.this.ensureSize(); - for (int i = size() - 1; i > index; i--) { - NodeArray.this.nodes[fixedLength + i] = NodeArray.this.nodes[fixedLength + i - 1]; - } - set(index, element); - } - - private void checkIndex(int index) { - if (index < 0 || index >= size()) { - throw new IndexOutOfBoundsException(); - } - } - - @Override - public Node remove(int index) { - checkIndex(index); - Node n = get(index); - set(index, Node.Null); - for (int i = index; i < size() - 1; i++) { - NodeArray.this.nodes[fixedLength + i] = NodeArray.this.nodes[fixedLength + i + 1]; - } - NodeArray.this.nodes[fixedLength + size() - 1] = Node.Null; - variableLength--; - assert variableLength >= 0; - return n; - } - }; - } - - private void ensureSize() { - if (size() > nodes.length) { - nodes = Arrays.copyOf(nodes, (nodes.length + 1) * 2); - } - } - - public void setOrExpand(int index, Node node) { - if (index < 0) { - throw new IndexOutOfBoundsException(); - } - - while (index >= size()) { - variablePart().add(Node.Null); - } - - set(index, node); - } - - @Override - public Node set(int index, Node node) { - assert !self().isDeleted() : "trying to set input/successor of deleted node: " + self().shortName(); - assert node == Node.Null || node.graph == self().graph : "node is from different graph: (this=" + self() + ") and (node=" + node + ")"; - assert node == Node.Null || node.id() != Node.DeletedID : "inserted node must not be deleted"; - assert node != self() || node.getClass().toString().contains("Phi") : "No direct circles allowed in the graph! " + node; - - Node old = get(index); - if (old != node) { - silentSet(index, node); - if (self().inputs == this) { - if (old != null) { - old.usages.remove(self()); - } - if (node != null) { - node.usages.add(self()); - } - } else { - assert self().successors == this; - if (old != null) { - old.predecessors.remove(self()); - } - if (node != null) { - node.predecessors.add(self()); - } - } - } - - return old; - } - - public void setAll(NodeArray other) { - assert size() == other.size(); - for (int i = 0; i < other.size(); i++) { - set(i, other.get(i)); - } - } - - private void checkIndex(int index) { - if (index < 0 || index >= size()) { - throw new IndexOutOfBoundsException(); - } - } - - @Override - public Node get(int index) { - checkIndex(index); - assert !self().isDeleted(); - return nodes[index]; - } - - @Override - public Node[] toArray() { - return Arrays.copyOf(nodes, size()); - } - - boolean replaceFirstOccurrence(Node toReplace, Node replacement) { - for (int i = 0; i < size(); i++) { - if (nodes[i] == toReplace) { - nodes[i] = replacement; - return true; - } - } - return false; - } - - public int remove(Node n) { - return replace(n, null); - } - - public int replace(Node toReplace, Node replacement) { - int result = 0; - for (int i = 0; i < size(); i++) { - if (nodes[i] == toReplace) { - set(i, replacement); - result++; - } - } - return result; - } - - int silentRemove(Node n) { - return silentReplace(n, null); - } - - int silentReplace(Node toReplace, Node replacement) { - int result = 0; - for (int i = 0; i < size(); i++) { - if (nodes[i] == toReplace) { - silentSet(i, replacement); - result++; - } - } - return result; - } - - @Override - public int size() { - return fixedLength + variableLength; - } - - public void clearAll() { - for (int i = 0; i < size(); i++) { - set(i, Node.Null); - } - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeBitMap.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeBitMap.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +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.graph; - -import com.sun.cri.ci.CiBitMap; - - -public final class NodeBitMap { - - private final CiBitMap bitMap; - private final Graph graph; - - NodeBitMap(Graph graph) { - this.graph = graph; - bitMap = new CiBitMap(graph.nextId); - } - - public Graph graph() { - return graph; - } - - public boolean setIntersect(NodeBitMap other) { - return bitMap.setIntersect(other.bitMap); - } - - public void setUnion(NodeBitMap other) { - bitMap.setUnion(other.bitMap); - } - - public boolean isMarked(Node node) { - check(node); - return bitMap.get(node.id()); - } - - public boolean isNew(Node node) { - return node.id() >= bitMap.size(); - } - - public void mark(Node node) { - check(node); - bitMap.set(node.id()); - } - - public void clear(Node node) { - check(node); - bitMap.clear(node.id()); - } - - public void clearAll() { - bitMap.clearAll(); - } - - public void grow(Node node) { - bitMap.grow(node.id() + 1); - } - - private void check(Node node) { - assert node.graph == graph : "this node is not part of the graph"; - assert !isNew(node) : "this node (" + node.id() + ") was added to the graph after creating the node bitmap (" + bitMap.length() + ")"; - assert !node.isDeleted() : "node " + node + " is deleted!"; - } - - @Override - public String toString() { - return bitMap.toBinaryString(-1); - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeFlood.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeFlood.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +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.graph; - -import java.util.ArrayDeque; -import java.util.Iterator; -import java.util.Queue; - - -public class NodeFlood implements Iterable { - private final NodeBitMap visited; - private final Queue worklist; - - NodeFlood(Graph graph) { - visited = graph.createNodeBitMap(); - worklist = new ArrayDeque(); - } - - public void add(Node node) { - if (node != null && !visited.isMarked(node)) { - visited.mark(node); - worklist.add(node); - } - } - - public boolean isMarked(Node node) { - return visited.isMarked(node); - } - - private static class QueueConsumingIterator implements Iterator { - private final Queue queue; - - public QueueConsumingIterator(Queue queue) { - this.queue = queue; - } - - @Override - public boolean hasNext() { - return !queue.isEmpty(); - } - - @Override - public Node next() { - return queue.remove(); - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - } - - @Override - public Iterator iterator() { - return new QueueConsumingIterator(worklist); - } - - private static class UnmarkedNodeIterator implements Iterator { - private final NodeBitMap visited; - private Iterator nodes; - private Node nextNode; - - public UnmarkedNodeIterator(NodeBitMap visited, Iterator nodes) { - this.visited = visited; - this.nodes = nodes; - forward(); - } - - private void forward() { - do { - if (!nodes.hasNext()) { - nextNode = null; - return; - } - nextNode = nodes.next(); - } while (visited.isMarked(nextNode)); - } - - @Override - public boolean hasNext() { - return nextNode != null; - } - - @Override - public Node next() { - try { - return nextNode; - } finally { - forward(); - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - } - - public Iterable unmarkedNodes() { - return new Iterable() { - @Override - public Iterator iterator() { - return new UnmarkedNodeIterator(visited, visited.graph().getNodes().iterator()); - } - }; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeIterator.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeIterator.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +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.graph; - -import java.util.LinkedList; -import java.util.List; - - -public class NodeIterator { - public static NodeBitMap iterate(EdgeType e, Node start, NodeBitMap constraint, NodeVisitor visitor) { - LinkedList nodes = new LinkedList(); - NodeBitMap nodeBitMap = start.graph.createNodeBitMap(); - - add(nodes, nodeBitMap, start, constraint, null); - while (nodes.size() > 0) { - Node n = nodes.remove(); - if (visitor != null) { - boolean followEdges = visitor.visit(n); - if (!followEdges) { - continue; - } - } - switch(e) { - case INPUTS: - for (Node inputs : n.inputs()) { - add(nodes, nodeBitMap, inputs, constraint, n.usages()); - } - break; - case USAGES: - for (Node usage : n.usages()) { - add(nodes, nodeBitMap, usage, constraint, n.inputs()); - } - break; - case PREDECESSORS: - for (Node preds : n.predecessors()) { - add(nodes, nodeBitMap, preds, constraint, n.successors()); - } - break; - case SUCCESSORS: - for (Node succ : n.successors()) { - add(nodes, nodeBitMap, succ, constraint, n.predecessors()); - } - break; - default: - assert false : "unknown edge type"; - } - } - - return nodeBitMap; - } - - private static void add(List nodes, NodeBitMap nodeBitMap, Node node, NodeBitMap constraint, List others) { - if (node != null && !nodeBitMap.isMarked(node) && (constraint == null || constraint.isMarked(node))) { - nodes.add(node); - nodeBitMap.mark(node); - } - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeMap.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeMap.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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.graph; - - - -public final class NodeMap { - - private final Object[] values; - private final Graph graph; - - NodeMap(Graph graph) { - this.graph = graph; - values = new Object[graph.nextId]; - } - - @SuppressWarnings("unchecked") - public T get(Node node) { - check(node); - return (T) values[node.id()]; - } - - public void set(Node node, T value) { - check(node); - values[node.id()] = value; - } - - public int size() { - return values.length; - } - - private void check(Node node) { - assert node.graph == graph : "this node is not part of the graph"; - assert node.id() < values.length : "this node was added to the graph after creating the node map"; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeVisitor.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeVisitor.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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.graph; - - -public interface NodeVisitor { - boolean visit(Node n); -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeWorkList.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeWorkList.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +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.graph; - -import java.util.ArrayDeque; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Queue; - - -public class NodeWorkList implements Iterable { - private final NodeBitMap visited; - private final NodeBitMap inQueue; - private final Queue worklist; - private int iterationLimit = Integer.MAX_VALUE; - - NodeWorkList(Graph graph) { - this(graph, false, -1); - } - - NodeWorkList(Graph graph, boolean fill, int iterationLimitPerNode) { - visited = graph.createNodeBitMap(); - inQueue = graph.createNodeBitMap(); - if (fill) { - ArrayDeque deque = new ArrayDeque(graph.getNodeCount()); - for (Node node : graph.getNodes()) { - if (node != null) { - deque.add(node); - } - } - worklist = deque; - } else { - worklist = new ArrayDeque(); - } - if (iterationLimitPerNode > 0) { - iterationLimit = iterationLimitPerNode * graph.getNodeCount(); - } - } - - public void add(Node node) { - if (node != null && !visited.isMarked(node)) { - doAdd(node); - } - } - - private void doAdd(Node node) { - if (node != null && !inQueue.isMarked(node)) { - visited.mark(node); - inQueue.mark(node); - worklist.add(node); - } - } - - public void replaced(Node newNode, Node oldNode, EdgeType... edges) { - this.replaced(newNode, oldNode, false, edges); - } - - public void replaced(Node newNode, Node oldNode, boolean add, EdgeType... edges) { - visited.grow(newNode); - inQueue.grow(newNode); - worklist.remove(oldNode); - assert !worklist.contains(oldNode); - if (add) { - this.add(newNode); - } - for (EdgeType type : edges) { - switch (type) { - case INPUTS: - for (Node n : newNode.inputs()) { - doAdd(n); - } - break; - case PREDECESSORS: - for (Node n : newNode.predecessors()) { - doAdd(n); - } - break; - case USAGES: - for (Node n : newNode.usages()) { - doAdd(n); - } - break; - case SUCCESSORS: - for (Node n : newNode.successors()) { - doAdd(n); - } - break; - } - } - } - - public boolean isMarked(Node node) { - return visited.isMarked(node); - } - - private class QueueConsumingIterator implements Iterator { - private final Queue queue; - - public QueueConsumingIterator(Queue queue) { - this.queue = queue; - } - - @Override - public boolean hasNext() { - return iterationLimit > 0 && !queue.isEmpty(); - } - - @Override - public Node next() { - if (iterationLimit-- <= 0) { - throw new NoSuchElementException(); - } - Node node = queue.remove(); - inQueue.clear(node); - return node; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - } - - @Override - public Iterator iterator() { - return new QueueConsumingIterator(worklist); - } - - private static class UnmarkedNodeIterator implements Iterator { - private final NodeBitMap visited; - private Iterator nodes; - private Node nextNode; - - public UnmarkedNodeIterator(NodeBitMap visited, Iterator nodes) { - this.visited = visited; - this.nodes = nodes; - forward(); - } - - private void forward() { - do { - if (!nodes.hasNext()) { - nextNode = null; - return; - } - nextNode = nodes.next(); - } while (visited.isMarked(nextNode)); - } - - @Override - public boolean hasNext() { - return nextNode != null; - } - - @Override - public Node next() { - try { - return nextNode; - } finally { - forward(); - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - } - - public Iterable unmarkedNodes() { - return new Iterable() { - @Override - public Iterator iterator() { - return new UnmarkedNodeIterator(visited, visited.graph().getNodes().iterator()); - } - }; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Op.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Op.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.graph; - - -public interface Op { - -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/StartNode.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/StartNode.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +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.graph; - -public class StartNode extends Node { - - private static final int INPUT_COUNT = 0; - - private static final int SUCCESSOR_COUNT = 1; - private static final int SUCCESSOR_START = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - public Node start() { - return successors().get(super.successorCount() + SUCCESSOR_START); - } - - public Node setStart(Node next) { - return successors().set(super.successorCount() + SUCCESSOR_START, next); - } - - StartNode(Graph graph) { - super(INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public Node replace(Node other) { - throw new UnsupportedOperationException(); - } - - @Override - public void delete() { - throw new UnsupportedOperationException(); - } - - @Override - public Node copy(Graph into) { - throw new UnsupportedOperationException(); - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/VerificationListener.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/VerificationListener.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.graph; - - -public interface VerificationListener { - void verificationFailed(Node n, String message); -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/package-info.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/package-info.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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. - */ -/** - * This package contains the Node base class and the Graph container class of the Graal IR. - * - * @author Gilles Duboscq - * @author Lukas Stadler - * @author Thomas Wuerthinger - */ -package com.oracle.max.graal.graph; diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.graph/test/com/oracle/graal/graph/NodeTest.java --- a/graal/com.oracle.max.graal.graph/test/com/oracle/graal/graph/NodeTest.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +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.graal.graph; - -import static org.junit.Assert.*; - -import org.junit.Test; - -import com.oracle.max.graal.graph.Graph; -import com.oracle.max.graal.graph.Node; - -public class NodeTest { - - @Test - public void testBasics() { - - Graph g1 = new Graph(); - - DummyNode n1 = new DummyNode(2, 1, g1); - DummyNode n2 = new DummyNode(1, 1, g1); - DummyNode n3 = new DummyNode(0, 0, g1); - n2.dummySetInput(0, Node.Null); - n2.dummySetSuccessor(0, n3); - - assertSame(Node.Null, n2.inputs().get(0)); - assertSame(n3, n2.successors().get(0)); - assertEquals(n1.inputs().size(), 2); - assertEquals(n1.successors().size(), 1); - } - - @Test - public void testReplace() { - Graph g2 = new Graph(); - - DummyOp2 o1 = new DummyOp2(Node.Null, Node.Null, g2); - DummyOp2 o2 = new DummyOp2(o1, Node.Null, g2); - DummyOp2 o3 = new DummyOp2(o2, Node.Null, g2); - DummyOp2 o4 = new DummyOp2(Node.Null, Node.Null, g2); - - o2.replace(o4); - - assertFalse(o3.inputs().contains(o2)); - assertTrue(o3.inputs().contains(o4)); - assertTrue(o4.usages().contains(o3)); - } - - private static class DummyNode extends Node { - - private final int inputCount; - private final int successorCount; - - public DummyNode(int inputCount, int successorCount, Graph graph) { - super(inputCount, successorCount, graph); - this.inputCount = inputCount; - this.successorCount = successorCount; - } - - @Override - protected int inputCount() { - return super.inputCount() + inputCount; - } - - @Override - protected int successorCount() { - return super.inputCount() + successorCount; - } - - public void dummySetInput(int idx, Node n) { - inputs().set(idx, n); - } - - public void dummySetSuccessor(int idx, Node n) { - successors().set(idx, n); - } - - @Override - public Node copy(Graph into) { - return new DummyNode(inputCount, successorCount, into); - } - - } - - public static class DummyOp2 extends Node { - - public static final int SUCCESSOR_COUNT = 0; - public static final int INPUT_COUNT = 2; - public static final int INPUT_X = 0; - public static final int INPUT_Y = 1; - - public DummyOp2(Node x, Node y, Graph graph) { - this(graph); - setX(x); - setY(y); - } - public DummyOp2(Graph graph) { - super(INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - public Node x() { - return inputs().get(super.inputCount() + INPUT_X); - } - - public Node y() { - return inputs().get(super.inputCount() + INPUT_Y); - } - - public Node setX(Node n) { - return inputs().set(super.inputCount() + INPUT_X, n); - } - - public Node setY(Node n) { - return inputs().set(super.inputCount() + INPUT_Y, n); - } - - @Override - public Node copy(Graph into) { - return new DummyOp2(into); - } - } -} diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.runtime/.classpath --- a/graal/com.oracle.max.graal.runtime/.classpath Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/.classpath Mon Jun 20 19:06:35 2011 +0200 @@ -7,5 +7,6 @@ + diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotMethodResolvedImpl.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotMethodResolvedImpl.java Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotMethodResolvedImpl.java Mon Jun 20 19:06:35 2011 +0200 @@ -25,6 +25,7 @@ import java.lang.reflect.*; import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -128,7 +129,7 @@ throw new UnsupportedOperationException("jniSymbol"); } - public CiBitMap[] livenessMap() { + public BitMap[] livenessMap() { return null; } diff -r cebfa0b55183 -r 546dc7e1b184 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotMethodUnresolved.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotMethodUnresolved.java Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotMethodUnresolved.java Mon Jun 20 19:06:35 2011 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.max.graal.runtime; +import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -114,7 +115,7 @@ } @Override - public CiBitMap[] livenessMap() { + public BitMap[] livenessMap() { return null; } diff -r cebfa0b55183 -r 546dc7e1b184 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 Mon Jun 20 18:41:26 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java Mon Jun 20 19:06:35 2011 +0200 @@ -26,6 +26,8 @@ import java.lang.reflect.*; import java.util.*; +import com.oracle.max.graal.compiler.ir.*; +import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiTargetMethod.Call; import com.sun.cri.ci.CiTargetMethod.DataPatch; @@ -135,11 +137,6 @@ return ((HotSpotTypeResolved) method.holder()).constantPool(); } - @Override - public RiOsrFrame getOsrFrame(RiMethod method, int bci) { - return null; - } - public Class getJavaClass(CiConstant c) { return null; } @@ -242,4 +239,23 @@ public Object asJavaObject(CiConstant c) { return null; } + + @Override + public Node lower(Node n, CiLoweringTool tool) { + if (n instanceof LoadField) { + LoadField field = (LoadField) n; + if (field.isVolatile()) { + return null; + } + Graph graph = field.graph(); + int displacement = ((HotSpotField) field.field()).offset(); + assert field.kind != CiKind.Illegal; + MemoryRead memoryRead = new MemoryRead(field.field().kind(), displacement, graph); + memoryRead.setGuard(new IsNonNull(field.object(), graph)); + memoryRead.setNext(field.next()); + memoryRead.setLocation(field.object()); + return memoryRead; + } + return null; + } } diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/build.xml Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,8 @@ + + + + + + Builds, tests, and runs the project com.sun.hotspot.igv.graal. + + diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/manifest.mf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/manifest.mf Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +OpenIDE-Module: com.sun.hotspot.igv.graal +OpenIDE-Module-Layer: com/sun/hotspot/igv/graal/layer.xml +OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/graal/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 + diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/nbproject/build-impl.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/build-impl.xml Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + You must set 'suite.dir' to point to your containing module suite + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,8 @@ +build.xml.data.CRC32=abfbe04d +build.xml.script.CRC32=3534d355 +build.xml.stylesheet.CRC32=a56c6a5b@1.45.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=abfbe04d +nbproject/build-impl.xml.script.CRC32=2867f2d5 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.properties Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.xml Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,45 @@ + + + org.netbeans.modules.apisupport.project + + + com.sun.hotspot.igv.graal + + + + com.sun.hotspot.igv.data + + + + 1.0 + + + + com.sun.hotspot.igv.graph + + + + 1.0 + + + + com.sun.hotspot.igv.graphtotext + + + + 1.0 + + + + com.sun.hotspot.igv.structuredtext + + + + 1.0 + + + + + + + diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/nbproject/suite.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/suite.properties Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,1 @@ +suite.dir=${basedir}/.. diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,1 @@ +com.sun.hotspot.igv.graal.GraalGraphToTextConverter \ No newline at end of file diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/Bundle.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/Bundle.properties Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=Graal Compiler Support diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/GraalGraphToTextConverter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/GraalGraphToTextConverter.java Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,209 @@ +/* + * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.hotspot.igv.graal; + +import com.sun.hotspot.igv.data.InputBlock; +import com.sun.hotspot.igv.data.InputEdge; +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.data.InputNode; +import com.sun.hotspot.igv.data.Properties; +import com.sun.hotspot.igv.data.Properties.PropertyMatcher; +import com.sun.hotspot.igv.graph.Diagram; +import com.sun.hotspot.igv.graph.Figure; +import com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter; +import com.sun.hotspot.igv.structuredtext.Element; +import com.sun.hotspot.igv.structuredtext.MultiElement; +import com.sun.hotspot.igv.structuredtext.SimpleElement; +import com.sun.hotspot.igv.structuredtext.StructuredText; +import java.awt.Color; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.swing.text.Style; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyleContext; + +/** + * @author Peter Hofer + * @author Thomas Wuerthinger + */ +public class GraalGraphToTextConverter implements GraphToTextConverter { + + private Map> map; + private Map> incomingEdges; + private Map> outgoingEdges; + private InputGraph graph; + + private Collection sortNodes(Collection nodes) { + List result = new ArrayList(nodes); + Collections.sort(result, InputNode.getPropertyComparator("idx")); + return result; + } + + public StructuredText convert(InputGraph graph, Diagram diagram) { + + this.graph = graph; + map = diagram.calcSourceToFigureRelation(); + + incomingEdges = graph.findAllIngoingEdges(); + outgoingEdges = graph.findAllOutgoingEdges(); + + final StructuredText result = new StructuredText(graph.getName()); + + for (InputBlock b : graph.getBlocks()) { + result.addChild(new SimpleElement("Block " + b.getName() + "\n")); + for (InputNode n : sortNodes(b.getNodes())) { + result.addChild(getNodeElement(n)); + } + } + + boolean first = true; + for (InputNode n : sortNodes(graph.getNodes())) { + if (graph.getBlock(n) == null) { + if (first) { + first = false; + result.addChild(new SimpleElement("No block: \n")); + } + result.addChild(getNodeElement(n)); + } + } + + return result; + } + + private Element getNodeNameElement(InputNode n) { + + final SimpleElement name = new SimpleElement(n.getProperties().get("idx") + " " + n.getProperties().get("name"), calcStyle(n)); + name.addSource(n.getId()); + return name; + } + + private Element getNodeShortElement(InputNode n) { + final SimpleElement id = new SimpleElement(n.getProperties().get("idx"), calcStyle(n)); + id.addSource(n.getId()); + return id; + } + + private Element getNodeElement(InputNode n) { + + final MultiElement result = new MultiElement(); + + result.print("\t"); + result.addChild(getNodeNameElement(n)); + + result.print(" :::"); + + // NOTE: lists in ingoingEdges/outgoingEdges are sorted by from/to slot + // and for slots that are connected with multiple edges, by + // from/to node + + int succCount = Integer.parseInt(n.getProperties().get("successorCount")); + InputEdge[] outgoing = outgoingEdges.get(n).toArray(new InputEdge[0]); + + int i = 0; + if (outgoing.length > 0 && outgoing[0].getFromIndex() < succCount) { + // Node has successors (each connected to a different slot) + result.print(" Succ = ["); + while (i < outgoing.length && outgoing[i].getFromIndex() < succCount) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(outgoing[i].getTo()))); + result.print(" "); + i++; + } + result.print("]"); + } + if (i < outgoing.length) { + // Node has usages (all connected to a single slot) + result.print(" Usages = ["); + while (i < outgoing.length) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(outgoing[i].getTo()))); + result.print(" "); + i++; + } + result.print("]"); + } + + int predCount = Integer.parseInt(n.getProperties().get("predecessorCount")); + InputEdge[] incoming = incomingEdges.get(n).toArray(new InputEdge[0]); + + int j = 0; + if (incoming.length > 0 && incoming[0].getToIndex() < predCount) { + // Node has predecessors (each connected to a different slot) + result.print(" Pred = ["); + while (j < incoming.length && incoming[j].getToIndex() < predCount) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(incoming[j].getFrom()))); + result.print(" "); + j++; + } + result.print("]"); + } + if (j < incoming.length) { + // Node has inputs (each connected to a different slot) + result.print(" Inputs = ["); + while (j < incoming.length) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(incoming[j].getFrom()))); + result.print(" "); + j++; + } + result.print("]"); + } + + result.print("\n"); + return result; + } + private static final PropertyMatcher MATCHER = new Properties.StringPropertyMatcher("origin", "Graal"); + + public boolean canConvert(InputGraph graph) { + return graph.getGroup().getProperties().selectSingle(MATCHER) != null; + } + + private Color calcColor(InputNode node) { + Set
figureSet = this.map.get(node); + if (figureSet != null && figureSet.size() == 1) { + return figureSet.iterator().next().getColor(); + } else { + return Color.WHITE; + } + } + + private Color lessColor(Color c) { + return new Color(255 - (255 - c.getRed()) / 4, 255 - (255 - c.getGreen()) / 4, 255 - (255 - c.getBlue()) / 4); + } + + private Style calcStyle(InputNode node) { + Color c = calcColor(node); + Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); + Style newStyle = StyleContext.getDefaultStyleContext().addStyle(null, defaultStyle); + + StyleConstants.setBackground(newStyle, lessColor(c)); + return newStyle; + } +} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/color.filter --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/color.filter Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,9 @@ +colorize("name", ".*", white); +colorize("name", "StartNode|EndNode|LoopBegin|LoopEnd|Return", red); +colorize("name", "Phi:.*", magenta); +colorize("name", "FrameState@.*", new java.awt.Color(0.5, 0.8, 1.0)); +colorize("name", "If", pink); +colorize("name", "const.*", new java.awt.Color(0.7, 0.7, 0.7)); +colorize("name", "Local", new java.awt.Color(0.85, 0.85, 0.85)); +colorize("name", "\\+|-|\\*|/", cyan); +colorize("name", "Comp .*", yellow); \ No newline at end of file diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml Mon Jun 20 19:06:35 2011 +0200 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/build.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/build.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project com.sun.hotspot.igv.maxine. - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/Maxine/manifest.mf Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.maxine -OpenIDE-Module-Layer: com/sun/hotspot/igv/maxine/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/maxine/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/build-impl.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/genfiles.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=44af392c -nbproject/build-impl.xml.script.CRC32=1a1fcc4d -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.5 -javac.compilerargs=-Xlint -Xlint:-serial diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.maxine - - - - com.sun.hotspot.igv.data - - - - 1.0 - - - - com.sun.hotspot.igv.graph - - - - 1.0 - - - - com.sun.hotspot.igv.graphtotext - - - - 1.0 - - - - com.sun.hotspot.igv.structuredtext - - - - 1.0 - - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/suite.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -com.sun.hotspot.igv.maxine.CirGraphToTextConverter \ No newline at end of file diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/Bundle.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/Bundle.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -OpenIDE-Module-Name=Maxine diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/CirGraphToTextConverter.java --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/CirGraphToTextConverter.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.hotspot.igv.maxine; - -import com.sun.hotspot.igv.data.InputEdge; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.InputNode; -import com.sun.hotspot.igv.data.Pair; -import com.sun.hotspot.igv.data.Properties; -import com.sun.hotspot.igv.data.Properties.PropertyMatcher; -import com.sun.hotspot.igv.data.Properties.RegexpPropertyMatcher; -import com.sun.hotspot.igv.data.Properties.StringPropertyMatcher; -import com.sun.hotspot.igv.graph.Diagram; -import com.sun.hotspot.igv.graph.Figure; -import com.sun.hotspot.igv.graphtotext.BFSGraphToTextConverter; -import com.sun.hotspot.igv.graphtotext.services.AbstractGraphToTextVisitor; -import com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter; -import com.sun.hotspot.igv.graphtotext.services.GraphToTextVisitor; -import com.sun.hotspot.igv.structuredtext.Element; -import com.sun.hotspot.igv.structuredtext.MultiElement; -import com.sun.hotspot.igv.structuredtext.SimpleElement; -import com.sun.hotspot.igv.structuredtext.StructuredText; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.swing.text.Style; -import javax.swing.text.StyleConstants; -import javax.swing.text.StyleContext; - -/** - * - * @author Thomas Wuerthinger - */ -public class CirGraphToTextConverter implements GraphToTextConverter { - - private static final String CALL_OPERATOR = " \u2022 "; - - private Map> map; - private InputGraph graph; - - public StructuredText convert(InputGraph graph, Diagram diagram) { - map = diagram.calcSourceToFigureRelation(); - this.graph = graph; - - BFSGraphToTextConverter converter = new BFSGraphToTextConverter(nodeVisitor); - converter.registerVisitor(localVariableVisitor, new StringPropertyMatcher("type", "LocalVariable")); - converter.registerVisitor(parameterVisitor, new StringPropertyMatcher("type", "Parameter")); - converter.registerVisitor(closureVisitor, new RegexpPropertyMatcher("type", "Closure")); - converter.registerVisitor(continuationVisitor, new RegexpPropertyMatcher("type", "Continuation")); - converter.registerVisitor(callVisitor, new RegexpPropertyMatcher("type", "Call")); - converter.registerVisitor(blockVisitor, new RegexpPropertyMatcher("type", "Block")); - return converter.convert(graph, diagram); - } - private GraphToTextVisitor nodeVisitor = new NodeVisitor(); - private GraphToTextVisitor localVariableVisitor = new NodeVisitor(); - private GraphToTextVisitor parameterVisitor = new NodeVisitor(); - private GraphToTextVisitor closureVisitor = new ClosureVisitor("proc"); - private GraphToTextVisitor continuationVisitor = new ClosureVisitor("cont"); - private GraphToTextVisitor callVisitor = new CallVisitor(); - private GraphToTextVisitor blockVisitor = new BlockVisitor(); - - private void printOffset(List path, MultiElement elem) { - for (int i = 0; i < path.size(); i++) { - InputEdge cur = path.get(i); - InputNode fromNode = graph.getNode(cur.getFrom()); - SimpleElement simpleElem = new SimpleElement(" ", calcStyle(fromNode)); - simpleElem.addSource(fromNode.getId()); - elem.addChild(simpleElem); - } - } - - private class NodeVisitor extends AbstractGraphToTextVisitor { - - @Override - public Element cyclicVisit(InputNode node, List path) { - SimpleElement elem = new SimpleElement(node.getProperties().get("name"), calcStyle(node)); - elem.addSource(node.getId()); - return elem; - } - } - - private Color calcColor(InputNode node) { - Set
figureSet = this.map.get(node); - if(figureSet != null && figureSet.size() == 1) { - return figureSet.iterator().next().getColor(); - } else { - return Color.WHITE; - } - } - - private Style calcStyle(InputNode node) { - Color c = calcColor(node); - Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); - Style newStyle = StyleContext.getDefaultStyleContext().addStyle(null, defaultStyle); - - StyleConstants.setBackground(newStyle, c); - return newStyle; - } - - private class ClosureVisitor extends AbstractGraphToTextVisitor { - - private String label; - - protected String getLabel(InputNode node) { - return label; - } - - public ClosureVisitor(String label) { - this.label = label; - } - - @Override - public Element cyclicVisit(InputNode node, List path) { - return SimpleElement.EMPTY; - } - - @Override - public Element visit(InputNode node, List path, List> children) { - MultiElement e = new MultiElement(calcStyle(node)); - e.print("{", node.getId()); - e.print(getLabel(node), node.getId()); - - e.print("[", node.getId()); - for (int i = 0; i < children.size() - 1; i++) { - Pair p = children.get(i); - e.addChild(p.getRight()); - if (i != children.size() - 2) { - e.print("|", node.getId()); - } - } - e.print("]", node.getId()); - e.print(CALL_OPERATOR, node.getId()); - e.println(); - List newPath = new ArrayList(path); - newPath.add(children.get(children.size() - 1).getLeft()); - printOffset(newPath, e); - - MultiElement childElement = new MultiElement("..."); - childElement.addChild(children.get(children.size() - 1).getRight()); - e.addChild(childElement); - - e.println(); - printOffset(path, e); - e.print("}", node.getId()); - MultiElement resElem = new MultiElement(); - resElem.addChild(e); - return resElem; - } - } - - private class CallVisitor extends AbstractGraphToTextVisitor { - - @Override - public Element cyclicVisit(InputNode node, List path) { - return SimpleElement.EMPTY; - } - - @Override - public Element visit(InputNode node, List path, List> children) { - MultiElement e = new MultiElement(calcStyle(node)); - e.print("(", node.getId()); - for (int i = 0; i < children.size(); i++) { - Pair p = children.get(i); - e.addChild(p.getRight()); - if (i != children.size() - 1) { - e.print("|", node.getId()); - } - } - e.print(")", node.getId()); - MultiElement resElem = new MultiElement(); - resElem.addChild(e); - return resElem; - } - } - - private class BlockVisitor extends ClosureVisitor { - - public BlockVisitor() { - super("block"); - } - - @Override - protected String getLabel(InputNode node) { - return node.getProperties().get("name"); - } - - @Override - public Element cyclicVisit(InputNode node, List path) { - MultiElement e = new MultiElement(calcStyle(node)); - e.print(getLabel(node), node); - return e; - } - - @Override - public Element visit(InputNode node, List path, List> children) { - return super.visit(node, path, children); - } - } - - private static final PropertyMatcher MATCHER = new Properties.RegexpPropertyMatcher("type", ".*CIR.*"); - public boolean canConvert(InputGraph graph) { - return graph.getGroup().getProperties().selectSingle(MATCHER) != null; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/color.filter --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/color.filter Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -colorize("name", ".*", white); -colorize("name", "cont",new java.awt.Color(1.0, 0.8, 0.8)); -colorize("name", "proc", new java.awt.Color(0.8, 0.8, 1.0)); -colorize("name", "call", new java.awt.Color(0.9, 0.9, 0.9)); -colorize("name", "block", new java.awt.Color(1.0, 1.0, 0.6)); -colorize("class", ".*Constant", new java.awt.Color(0.7, 1.0, 0.9)); -colorize("class", ".*Parameter", new java.awt.Color(0.9, 1.0, 0.7)); -colorize("class", ".*Variable", new java.awt.Color(0.7, 1.0, 0.7)); -colorize("class", ".*cir\.snippet.*", yellow); \ No newline at end of file diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/structural.filter --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/structural.filter Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -split("class", ".*Constant"); -split("class", ".*Variable"); -split("class", ".*Parameter"); -split("class", ".*Snippet"); -split("class", ".*Switch"); -split("class", ".*cir\.snippet.*"); -split("class", ".*cir\.builtin.*"); \ No newline at end of file diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/layer.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/layer.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/build.xml --- a/src/share/tools/IdealGraphVisualizer/Text Editor/build.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project at.ssw.visualizer.texteditor. - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/Text Editor/manifest.mf Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: at.ssw.visualizer.texteditor -OpenIDE-Module-Layer: at/ssw/visualizer/texteditor/layer.xml -OpenIDE-Module-Localizing-Bundle: at/ssw/visualizer/texteditor/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/build-impl.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/genfiles.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -build.xml.data.CRC32=be4656f4 -build.xml.script.CRC32=eccfca0f -build.xml.stylesheet.CRC32=a56c6a5b@1.45.1 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=be4656f4 -nbproject/build-impl.xml.script.CRC32=72c794c1 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/platform.properties --- a/src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/platform.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -# Deprecated since 5.0u1; for compatibility with 5.0: -disabled.clusters=\ - apisupport1,\ - enterprise4,\ - harness,\ - java1,\ - mobility8,\ - nb6.0,\ - profiler2,\ - ruby1,\ - uml4,\ - visualweb1,\ - xml1 -disabled.modules=\ - org.apache.xml.resolver,\ - org.netbeans.api.debugger,\ - org.netbeans.api.xml,\ - org.netbeans.core.ide,\ - org.netbeans.core.multiview,\ - org.netbeans.core.output2,\ - org.netbeans.insane,\ - org.netbeans.lib.cvsclient,\ - org.netbeans.libs.commons_logging,\ - org.netbeans.libs.freemarker,\ - org.netbeans.libs.ini4j,\ - org.netbeans.libs.jsch,\ - org.netbeans.libs.jsr223,\ - org.netbeans.libs.lucene,\ - org.netbeans.libs.svnClientAdapter,\ - org.netbeans.libs.xerces,\ - org.netbeans.modules.autoupdate.services,\ - org.netbeans.modules.autoupdate.ui,\ - org.netbeans.modules.classfile,\ - org.netbeans.modules.core.kit,\ - org.netbeans.modules.css.visual,\ - org.netbeans.modules.db,\ - org.netbeans.modules.db.core,\ - org.netbeans.modules.db.kit,\ - org.netbeans.modules.db.sql.editor,\ - org.netbeans.modules.db.sql.visualeditor,\ - org.netbeans.modules.dbapi,\ - org.netbeans.modules.defaults,\ - org.netbeans.modules.diff,\ - org.netbeans.modules.editor.bookmarks,\ - org.netbeans.modules.editor.bracesmatching,\ - org.netbeans.modules.editor.codetemplates,\ - org.netbeans.modules.editor.completion,\ - org.netbeans.modules.editor.errorstripe,\ - org.netbeans.modules.editor.errorstripe.api,\ - org.netbeans.modules.editor.guards,\ - org.netbeans.modules.editor.highlights,\ - org.netbeans.modules.editor.indent,\ - org.netbeans.modules.editor.kit,\ - org.netbeans.modules.editor.structure,\ - org.netbeans.modules.extbrowser,\ - org.netbeans.modules.favorites,\ - org.netbeans.modules.html,\ - org.netbeans.modules.html.editor,\ - org.netbeans.modules.html.editor.lib,\ - org.netbeans.modules.html.lexer,\ - org.netbeans.modules.httpserver,\ - org.netbeans.modules.ide.kit,\ - org.netbeans.modules.image,\ - org.netbeans.modules.javahelp,\ - org.netbeans.modules.jumpto,\ - org.netbeans.modules.languages,\ - org.netbeans.modules.languages.bat,\ - org.netbeans.modules.languages.css,\ - org.netbeans.modules.languages.diff,\ - org.netbeans.modules.languages.javascript,\ - org.netbeans.modules.languages.manifest,\ - org.netbeans.modules.languages.sh,\ - org.netbeans.modules.localhistory,\ - org.netbeans.modules.project.ant,\ - org.netbeans.modules.project.libraries,\ - org.netbeans.modules.projectapi,\ - org.netbeans.modules.projectui,\ - org.netbeans.modules.projectuiapi,\ - org.netbeans.modules.properties,\ - org.netbeans.modules.properties.syntax,\ - org.netbeans.modules.refactoring.api,\ - org.netbeans.modules.schema2beans,\ - org.netbeans.modules.servletapi,\ - org.netbeans.modules.subversion,\ - org.netbeans.modules.tasklist.kit,\ - org.netbeans.modules.tasklist.projectint,\ - org.netbeans.modules.tasklist.todo,\ - org.netbeans.modules.tasklist.ui,\ - org.netbeans.modules.templates,\ - org.netbeans.modules.timers,\ - org.netbeans.modules.usersguide,\ - org.netbeans.modules.utilities,\ - org.netbeans.modules.utilities.project,\ - org.netbeans.modules.versioning,\ - org.netbeans.modules.versioning.system.cvss,\ - org.netbeans.modules.versioning.util,\ - org.netbeans.modules.web.flyingsaucer,\ - org.netbeans.modules.xml.axi,\ - org.netbeans.modules.xml.catalog,\ - org.netbeans.modules.xml.core,\ - org.netbeans.modules.xml.lexer,\ - org.netbeans.modules.xml.multiview,\ - org.netbeans.modules.xml.retriever,\ - org.netbeans.modules.xml.schema.completion,\ - org.netbeans.modules.xml.schema.model,\ - org.netbeans.modules.xml.tax,\ - org.netbeans.modules.xml.text,\ - org.netbeans.modules.xml.tools,\ - org.netbeans.modules.xml.wsdl.model,\ - org.netbeans.modules.xml.xam,\ - org.netbeans.modules.xml.xdm,\ - org.netbeans.modules.xsl,\ - org.netbeans.spi.debugger.ui,\ - org.netbeans.spi.editor.hints,\ - org.netbeans.spi.navigator,\ - org.netbeans.spi.palette,\ - org.netbeans.spi.tasklist,\ - org.netbeans.spi.viewmodel,\ - org.netbeans.swing.dirchooser,\ - org.openide.compat,\ - org.openide.util.enumerations -enabled.clusters=\ - ide8,\ - platform7 -nbplatform.active=default diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/project.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.5 -javac.compilerargs=-Xlint -Xlint:-serial diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/project.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - at.ssw.visualizer.texteditor - - - - com.sun.hotspot.igv.data - - - - 1.0 - - - - org.netbeans.modules.editor - - - - 3 - 1.42.1.3.9.2 - - - - org.netbeans.modules.editor.fold - - - - 1 - 1.10.1 - - - - org.netbeans.modules.editor.lib - - - - 3 - 3.8.1.13.8 - - - - org.netbeans.modules.editor.lib2 - - - - 1 - 1.28.1.2 - - - - org.netbeans.modules.editor.mimelookup - - - - 1 - 1.11.1 - - - - org.netbeans.modules.editor.settings - - - - 1 - 1.24.1 - - - - org.netbeans.modules.editor.util - - - - 1 - 1.28.1 - - - - org.openide.actions - - - - 6.9.1.1 - - - - org.openide.awt - - - - 7.23.1 - - - - org.openide.nodes - - - - 7.9.1.1 - - - - org.openide.text - - - - 6.22.1 - - - - org.openide.util - - - - 7.22.1.1 - - - - org.openide.util.lookup - - - - 8.3.1 - - - - org.openide.windows - - - - 6.26.1 - - - - - at.ssw.visualizer.texteditor - at.ssw.visualizer.texteditor.fold - at.ssw.visualizer.texteditor.highlight - at.ssw.visualizer.texteditor.hyperlink - at.ssw.visualizer.texteditor.model - at.ssw.visualizer.texteditor.tooltip - at.ssw.visualizer.texteditor.view - - - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/Text Editor/nbproject/suite.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/core/selection/Selection.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/core/selection/Selection.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -package at.ssw.visualizer.core.selection; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.swing.Timer; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -/** - * - * @author Christian Wimmer - */ -public class Selection { - private Map elements; - private List listeners; - private Timer eventTimer; - - private ActionListener eventTimerListener = new ActionListener() { - public void actionPerformed(ActionEvent event) { - doFireChangeEvent(); - } - }; - - public Selection() { - elements = new HashMap(); - listeners = new ArrayList(); - eventTimer = new Timer(100, eventTimerListener); - eventTimer.setRepeats(false); - } - - private void doPut(Class clazz, Object element) { - elements.put(clazz, element); - for (Class i : clazz.getInterfaces()) { - doPut(i, element); - } - } - - public void put(Object element) { - doPut(element.getClass(), element); - fireChangeEvent(); - SelectionManager.getDefault().fireChangeEvent(); - } - - @SuppressWarnings(value = "unchecked") - public T get(Class clazz) { - return (T) elements.get(clazz); - } - - - protected void doFireChangeEvent() { - ChangeEvent event = new ChangeEvent(this); - for (ChangeListener listener : listeners.toArray(new ChangeListener[listeners.size()])) { - listener.stateChanged(event); - } - } - - protected void fireChangeEvent() { - eventTimer.restart(); - } - - public void addChangeListener(ChangeListener listener) { - listeners.add(listener); - } - - public void removeChangeListener(ChangeListener listener) { - listeners.remove(listener); - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/core/selection/SelectionManager.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/core/selection/SelectionManager.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -package at.ssw.visualizer.core.selection; - -import javax.swing.event.ChangeListener; - -/** - * - * @author Christian Wimmer - */ -public class SelectionManager { - private static final SelectionManager SINGLETON = new SelectionManager(); - - public static SelectionManager getDefault() { - return SINGLETON; - } - - - /** Default selection returned when no TopComponent is active. - * It is also used to maintain listeners added to the selection manager. */ - private final Selection emptySelection; - private Selection curSelection; - - private SelectionManager() { - emptySelection = new Selection(); - curSelection = emptySelection; - } - - public Selection getCurSelection() { - return curSelection; - } - - public void setSelection(Selection sel) { - if (curSelection != sel) { - curSelection = sel; - fireChangeEvent(); - } - } - - public void removeSelection(Selection sel) { - if (curSelection == sel) { - curSelection = emptySelection; - fireChangeEvent(); - } - } - - protected void fireChangeEvent() { - emptySelection.fireChangeEvent(); - } - - public void addChangeListener(ChangeListener listener) { - emptySelection.addChangeListener(listener); - } - - public void removeChangeListener(ChangeListener listener) { - emptySelection.removeChangeListener(listener); - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/core/selection/SelectionProvider.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/core/selection/SelectionProvider.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -package at.ssw.visualizer.core.selection; - -/** - * - * @author Christian Wimmer - */ -public interface SelectionProvider { - public Selection getSelection(); -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/Bundle.properties --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/Bundle.properties Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -OpenIDE-Module-Name=Text Editor diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/Editor.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/Editor.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -package at.ssw.visualizer.texteditor; - -import at.ssw.visualizer.core.selection.Selection; -import at.ssw.visualizer.core.selection.SelectionManager; -import at.ssw.visualizer.core.selection.SelectionProvider; -import at.ssw.visualizer.texteditor.model.BlockRegion; -import at.ssw.visualizer.texteditor.model.Text; -import com.sun.hotspot.igv.data.InputBlock; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import org.openide.text.CloneableEditor; -import org.openide.windows.TopComponent; - -/** - * Abstract template class of a Editor class of the Visualizer. - * - * Must be initialized with a custom EditorSupport class and the - * method creatClonedObject must be overwritten by - * the Editor implementation. - * - * @author Alexander Reder - */ -public abstract class Editor extends CloneableEditor implements SelectionProvider { - - protected Selection selection; - private boolean selectionUpdating; - private InputBlock[] curBlocks; - private boolean initialized; - - protected Editor(EditorSupport support) { - super(support); - selection = new Selection(); - selection.put(support.getControlFlowGraph()); - selection.addChangeListener(selectionListener); - } - - public Selection getSelection() { - return selection; - } - - @Override - protected void componentShowing() { - super.componentShowing(); - if (!initialized) { - getEditorPane().addCaretListener(caretListener); - initialized = true; - } - } - - @Override - protected void componentActivated() { - super.componentActivated(); - SelectionManager.getDefault().setSelection(selection); - } - - @Override - protected void componentClosed() { - super.componentClosed(); - SelectionManager.getDefault().removeSelection(selection); - } - - @Override - public int getPersistenceType() { - return TopComponent.PERSISTENCE_NEVER; - } - - private ChangeListener selectionListener = new ChangeListener() { - public void stateChanged(ChangeEvent event) { - if (selectionUpdating) { - return; - } - selectionUpdating = true; - - Text text = (Text) getEditorPane().getDocument().getProperty(Text.class); - InputBlock[] newBlocks = selection.get(InputBlock[].class); - - if (newBlocks != null && newBlocks.length > 0 && !Arrays.equals(curBlocks, newBlocks)) { - BlockRegion r = text.getBlocks().get(newBlocks[0]); - int startOffset = r.getNameStart(); - int endOffset = r.getNameEnd(); - - if (newBlocks.length > 1) { - for (InputBlock b : newBlocks) { - r = text.getBlocks().get(b); - startOffset = Math.min(startOffset, r.getStart()); - endOffset = Math.max(endOffset, r.getEnd()); - } - } - - getEditorPane().select(startOffset, endOffset); - } - curBlocks = newBlocks; - selectionUpdating = false; - } - }; - - - private CaretListener caretListener = new CaretListener() { - public void caretUpdate(CaretEvent event) { - if (selectionUpdating) { - return; - } - selectionUpdating = true; - - Text text = (Text) getEditorPane().getDocument().getProperty(Text.class); - List newBlocks = new ArrayList(); - int startOffset = Math.min(event.getDot(), event.getMark()); - int endOffset = Math.max(event.getDot(), event.getMark()); - - for (BlockRegion region : text.getBlocks().values()) { - if (region.getStart() <= endOffset && region.getEnd() > startOffset) { - newBlocks.add(region.getBlock()); - } - } - - curBlocks = newBlocks.toArray(new InputBlock[newBlocks.size()]); - selection.put(curBlocks); - selectionUpdating = false; - } - }; - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/EditorKit.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/EditorKit.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -package at.ssw.visualizer.texteditor; - -import at.ssw.visualizer.texteditor.tooltip.ToolTipAction; -import javax.swing.Action; -import javax.swing.text.TextAction; -import org.netbeans.modules.editor.NbEditorKit; - -/** - * Abstract template class of a EditorKit class of the Visualizer. - * - * The scanner field must be initialized with the - * custom Scanner implementation and the method - * getContentType must be overwritten and return the mime type - * for the editor. - * - * @author Alexander Reder - */ -public abstract class EditorKit extends NbEditorKit { - - @Override - protected Action[] getCustomActions() { - Action[] prev = super.getCustomActions(); - Action[] added = new Action[]{new ToolTipAction()}; - if (prev != null) { - return TextAction.augmentList(prev, added); - } else { - return added; - } - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/EditorSupport.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/EditorSupport.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -package at.ssw.visualizer.texteditor; - -import at.ssw.visualizer.texteditor.model.Text; -import com.sun.hotspot.igv.data.InputGraph; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Date; -import javax.swing.text.EditorKit; -import javax.swing.text.StyledDocument; -import org.openide.cookies.EditorCookie; -import org.openide.cookies.EditCookie; -import org.openide.text.CloneableEditorSupport; -import org.openide.windows.CloneableOpenSupport; - -/** - * Abstract template class of a EditorSupport class of the - * Visulizer. - * - * The text field must be initialized by the implementing class - * and the methods createCloneableEditor and - * initializeCloneableEditor must be overwritten by the implenting class. - * createCloneableEditor must return a custom implementation - * of the Editor class. - * initializeClonableEditor is used to set the icon, e.g. - * editor.setIcon(Utilities.loadImage(IconsImage)); . - * - * @author Bernhard Stiftner - * @author Christian Wimmer - * @author Alexander Reder - */ -public abstract class EditorSupport extends CloneableEditorSupport implements EditCookie, EditorCookie, EditorCookie.Observable { - - protected InputGraph cfg; - protected Text text; - - protected EditorSupport(InputGraph cfg) { - super(new Env()); - ((Env) this.env).editorSupport = this; - this.cfg = cfg; - } - - public InputGraph getControlFlowGraph() { - return cfg; - } - - @Override - protected StyledDocument createStyledDocument(EditorKit kit) { - StyledDocument doc = super.createStyledDocument(kit); - - // Back-link from Document to our internal data model. - doc.putProperty(Text.class, text); - doc.putProperty(InputGraph.class, cfg); - - return doc; - } - - public abstract String getMimeType(); - - protected String messageOpening() { - return "Opening " + messageToolTip(); - } - - protected String messageOpened() { - return "Opened " + messageToolTip(); - } - - protected String messageSave() { - throw new UnsupportedOperationException("Not supported yet."); - } - - protected String messageName() { - return cfg.getName(); - } - - protected String messageToolTip() { - return cfg.getGroup().getName() + " - " + cfg.getName(); - } - - public static class Env implements CloneableEditorSupport.Env { - - private PropertyChangeSupport prop = new PropertyChangeSupport(this); - private VetoableChangeSupport veto = new VetoableChangeSupport(this); - - /** - * Back-link to outer class EditorSupport. Env must be a static class - * because it is passed to super constructor of EditorSupport. - */ - private EditorSupport editorSupport; - - public InputStream inputStream() throws IOException { - return new ByteArrayInputStream(editorSupport.text.getText().getBytes()); - } - - public OutputStream outputStream() throws IOException { - throw new IOException("Editor is readonly"); - } - - public Date getTime() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getMimeType() { - return editorSupport.getMimeType(); - } - - public boolean isValid() { - return true; - } - - public boolean isModified() { - return false; - } - - public void markModified() throws IOException { - throw new IOException("Editor is readonly"); - } - - public void unmarkModified() { - // Nothing to do. - } - - public CloneableOpenSupport findCloneableOpenSupport() { - return editorSupport; - } - - public void addPropertyChangeListener(PropertyChangeListener l) { - prop.addPropertyChangeListener(l); - } - - public void removePropertyChangeListener(PropertyChangeListener l) { - prop.removePropertyChangeListener(l); - } - - public void addVetoableChangeListener(VetoableChangeListener l) { - veto.addVetoableChangeListener(l); - } - - public void removeVetoableChangeListener(VetoableChangeListener l) { - veto.removeVetoableChangeListener(l); - } - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/fold/FoldManager.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/fold/FoldManager.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -package at.ssw.visualizer.texteditor.fold; - -import at.ssw.visualizer.texteditor.model.FoldingRegion; -import at.ssw.visualizer.texteditor.model.Text; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.JComponent; -import javax.swing.event.DocumentEvent; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import org.netbeans.api.editor.fold.Fold; -import org.netbeans.editor.CodeFoldingSideBar; -import org.netbeans.spi.editor.fold.FoldHierarchyTransaction; -import org.netbeans.spi.editor.fold.FoldOperation; - -/** - * - * @author Alexander Reder - */ -public class FoldManager implements org.netbeans.spi.editor.fold.FoldManager { - - protected FoldOperation operation; - - public void init(FoldOperation operation) { - this.operation = operation; - } - - public void initFolds(FoldHierarchyTransaction transaction) { - Document document = operation.getHierarchy().getComponent().getDocument(); - Text text = (Text) document.getProperty(Text.class); - if (document.getLength() == 0 || text == null) { - return; - } - - try { - for (FoldingRegion fr : text.getFoldings()) { - operation.addToHierarchy(fr.getKind(), fr.getKind().toString(), fr.isInitiallyCollapsed(), fr.getStart(), fr.getEnd(), 0, 0, null, transaction); - } - } catch (BadLocationException ex) { - Logger logger = Logger.getLogger(FoldManager.class.getName()); - logger.log(Level.SEVERE, ex.getMessage(), ex); - } - } - - public void insertUpdate(DocumentEvent arg0, FoldHierarchyTransaction arg1) { - } - - public void removeUpdate(DocumentEvent arg0, FoldHierarchyTransaction arg1) { - } - - public void changedUpdate(DocumentEvent arg0, FoldHierarchyTransaction arg1) { - } - - public void removeEmptyNotify(Fold arg0) { - } - - public void removeDamagedNotify(Fold arg0) { - } - - public void expandNotify(Fold arg0) { - } - - public void release() { - } - - public static class FoldManagerFactory implements org.netbeans.spi.editor.fold.FoldManagerFactory { - - public FoldManager createFoldManager() { - return new FoldManager(); - } - } - - public static class SideBarFactory implements org.netbeans.editor.SideBarFactory { - - public JComponent createSideBar(JTextComponent target) { - return new CodeFoldingSideBar(target); - } - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/highlight/HighlightsContainer.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/highlight/HighlightsContainer.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -package at.ssw.visualizer.texteditor.highlight; - -import at.ssw.visualizer.texteditor.model.Scanner; -import at.ssw.visualizer.texteditor.model.Text; -import at.ssw.visualizer.texteditor.model.TextRegion; -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; -import javax.swing.text.AttributeSet; -import javax.swing.text.Caret; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import javax.swing.text.SimpleAttributeSet; -import org.netbeans.api.editor.mimelookup.MimeLookup; -import org.netbeans.api.editor.mimelookup.MimePath; -import org.netbeans.api.editor.settings.FontColorSettings; -import org.netbeans.editor.TokenID; -import org.netbeans.spi.editor.highlighting.HighlightsSequence; -import org.netbeans.spi.editor.highlighting.ZOrder; -import org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer; -import org.openide.util.WeakListeners; - -/** - * - * @author Christian Wimmer - * @author Alexander Reder - */ -public class HighlightsContainer extends AbstractHighlightsContainer { - - private static final String HIGHLIGHT_COLORING = "at-ssw-visualizer-highlight"; - - protected final JTextComponent component; - protected final Document document; - protected final AttributeSet highlightColoring; - protected final Scanner scanner; - - protected TextRegion[] curRegions = null; - - private final CaretListener caretListener = new CaretListener() { - - public void caretUpdate(CaretEvent event) { - TextRegion[] newRegions = findRegions(); - if (newRegions != curRegions) { - curRegions = newRegions; - fireHighlightsChange(0, document.getLength()); - } - } - - }; - - protected HighlightsContainer(JTextComponent component, Document document) { - this.document = document; - this.component = component; - component.addCaretListener(WeakListeners.create(CaretListener.class, caretListener, component)); - - // Load the coloring. - Text t = (Text) document.getProperty(Text.class); - MimePath mimePath = MimePath.parse(t.getMimeType()); - FontColorSettings fcs = MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class); - AttributeSet highlight = fcs.getFontColors(HIGHLIGHT_COLORING); - highlightColoring = highlight != null ? highlight : SimpleAttributeSet.EMPTY; - - scanner = t.getScanner(); - scanner.setText(document); - curRegions = findRegions(); - } - - public HighlightsSequence getHighlights(int startOffset, int endOffset) { - return new RegionSequence(); - } - - protected TextRegion[] findRegions() { - Text text = (Text) document.getProperty(Text.class); - Caret caret = component.getCaret(); - if (text == null || caret == null) { - return null; - } - scanner.findTokenBegin(caret.getDot()); - TokenID token = scanner.nextToken(); - if (token.getNumericID() < 0) { - return null; - } - - return text.getHighlighting(scanner.getTokenString()); - } - - protected class RegionSequence implements HighlightsSequence { - - private int idx = -1; - - public boolean moveNext() { - idx++; - return curRegions != null && idx < curRegions.length; - } - - public int getStartOffset() { - return curRegions[idx].getStart(); - } - - public int getEndOffset() { - return curRegions[idx].getEnd(); - } - - public AttributeSet getAttributes() { - return highlightColoring; - } - } - - public static final class HighlightsLayerFactory implements org.netbeans.spi.editor.highlighting.HighlightsLayerFactory { - - public org.netbeans.spi.editor.highlighting.HighlightsLayer[] createLayers(Context context) { - Text t = (Text) context.getDocument().getProperty(Text.class); - if(t == null) { - return new org.netbeans.spi.editor.highlighting.HighlightsLayer[0]; - } - return new org.netbeans.spi.editor.highlighting.HighlightsLayer[]{org.netbeans.spi.editor.highlighting.HighlightsLayer.create("at-ssw-visualizer-highlighting", ZOrder.SHOW_OFF_RACK, true, new HighlightsContainer(context.getComponent(), context.getDocument()))}; - } - - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/hyperlink/HyperlinkProvider.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/hyperlink/HyperlinkProvider.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -package at.ssw.visualizer.texteditor.hyperlink; - -import at.ssw.visualizer.texteditor.model.Scanner; -import at.ssw.visualizer.texteditor.model.Text; -import at.ssw.visualizer.texteditor.model.TextRegion; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import org.netbeans.editor.TokenID; -import org.netbeans.editor.Utilities; - -/** - * - * @author Bernhard Stiftner - * @author Christian Wimmer - * @author Alexander Reder - */ -public class HyperlinkProvider implements org.netbeans.lib.editor.hyperlink.spi.HyperlinkProvider { - - protected Scanner scanner = null; - - protected TextRegion findTarget(Document doc, int offset) { - Text text = (Text) doc.getProperty(Text.class); - if (text == null) { - return null; - } - - scanner = text.getScanner(); - scanner.setText(doc); - scanner.findTokenBegin(offset); - TokenID token = scanner.nextToken(); - if (token.getNumericID() < 0) { - return null; - } - - return text.getHyperlinkTarget(scanner.getTokenString()); - } - - public boolean isHyperlinkPoint(Document doc, int offset) { - return findTarget(doc, offset) != null; - } - - public int[] getHyperlinkSpan(Document doc, int offset) { - if (findTarget(doc, offset) != null) { - return new int[]{scanner.getTokenOffset(), scanner.getTokenOffset() + scanner.getTokenLength()}; - } - return null; - } - - public void performClickAction(Document doc, int offset) { - TextRegion target = findTarget(doc, offset); - if (target != null) { - JTextComponent editor = Utilities.getFocusedComponent(); - editor.select(target.getStart(), target.getEnd()); - } - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/layer.xml --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/layer.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/BlockRegion.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/BlockRegion.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -package at.ssw.visualizer.texteditor.model; - -import com.sun.hotspot.igv.data.InputBlock; - -/** - * - * @author Christian Wimmer - */ -public class BlockRegion extends TextRegion { - - private InputBlock block; - - private int nameStart; - private int nameEnd; - - public BlockRegion(InputBlock block, int start, int end, int nameStart, int nameEnd) { - super(start, end); - this.block = block; - this.nameStart = nameStart; - this.nameEnd = nameEnd; - } - - - public InputBlock getBlock() { - return block; - } - - public int getNameStart() { - return nameStart; - } - - public int getNameEnd() { - return nameEnd; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/FoldingRegion.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/FoldingRegion.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -package at.ssw.visualizer.texteditor.model; - -import org.netbeans.api.editor.fold.FoldType; - -/** - * - * @author Christian Wimmer - * @author Alexander Reder - */ -public class FoldingRegion extends TextRegion { - - - private FoldType kind; - private boolean initallyCollapsed; - - - public FoldingRegion(FoldType kind, int start, int end, boolean initiallyCollapsed) { - super(start, end); - this.kind = kind; - this.initallyCollapsed = initiallyCollapsed; - } - - - public FoldType getKind() { - return kind; - } - - public boolean isInitiallyCollapsed() { - return initallyCollapsed; - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/HoverParser.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/HoverParser.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -package at.ssw.visualizer.texteditor.model; - -import java.util.Iterator; - -/** - * - * @author ChristianWimmer - */ -public class HoverParser implements Iterator { - - private static String HOVER_START = "<@"; - private static String HOVER_SEP = "|@"; - private static String HOVER_END = ">@"; - private String text; - private int curPos; - private String curText; - private String curHover; - private boolean curNewLine; - - public static String firstLine(String text) { - if (text == null) { - return ""; - } - HoverParser p = new HoverParser(text); - StringBuilder result = new StringBuilder(text.length()); - while (p.hasNext()) { - String part = p.next(); - if (p.isNewLine()) { - break; - } - result.append(part); - } - return result.toString(); - } - - public HoverParser(String text) { - this.text = text; - } - - private void advance() { - int lineStart = text.indexOf('\n', curPos); - int nextStart = text.indexOf(HOVER_START, curPos); - - if (lineStart == curPos) { - curText = "\n"; - curHover = null; - curPos = lineStart + 1; - curNewLine = true; - while (curPos < text.length() && text.charAt(curPos) <= ' ') { - curPos++; - } - return; - } - curNewLine = false; - if (lineStart != -1 && (nextStart == -1 || lineStart < nextStart)) { - curText = text.substring(curPos, lineStart); - curHover = null; - curPos = lineStart; - return; - } - - if (nextStart == curPos) { - int nextSep = text.indexOf(HOVER_SEP, nextStart); - if (nextSep != -1) { - int nextEnd = text.indexOf(HOVER_END, nextSep); - if (nextEnd != -1) { - curText = text.substring(nextStart + HOVER_START.length(), nextSep); - curHover = text.substring(nextSep + HOVER_SEP.length(), nextEnd); - while (curHover.endsWith("\n")) { - curHover = curHover.substring(0, curHover.length() - 1); - } - curPos = nextEnd + HOVER_END.length(); - return; - } - } - } - - if (nextStart == curPos) { - // Incomplete hover sequence. Make sure we make progress by just advancing to the next chararter. - nextStart++; - } - - if (nextStart != -1) { - curText = text.substring(curPos, nextStart); - curHover = null; - curPos = nextStart; - } else if (curPos < text.length()) { - curText = text.substring(curPos); - curHover = null; - curPos = text.length(); - } else { - curText = null; - curHover = null; - } - } - - public boolean hasNext() { - return curPos < text.length(); - } - - public String next() { - advance(); - return curText; - } - - public String getHover() { - return curHover; - } - - public boolean isNewLine() { - return curNewLine; - } - - public void remove() { - throw new UnsupportedOperationException("Not supported."); - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/Scanner.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/Scanner.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -package at.ssw.visualizer.texteditor.model; - -import java.util.BitSet; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import org.netbeans.editor.Syntax; -import org.netbeans.editor.TokenContextPath; - -/** - * The implementing class must specify the used TokenIDs and - * implement the scanner for the specified text. - * - * @author Alexander Reder - * @author Christian Wimmer - */ -public abstract class Scanner extends Syntax { - protected static final int EOF = 0; - protected static final BitSet DIGIT = charsOf("0123456789"); - protected static final BitSet HEX = charsOf("0123456789abcdefABCDEF"); - protected static final BitSet LETTER = charsOf("_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); - protected static final BitSet LETTER_DIGIT = charsOf("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); - protected static final BitSet LC_LETTER = charsOf("_abcdefghijklmnopqrstuvwxyz"); - protected static final BitSet LC_LETTER_DIGIT = charsOf("0123456789_abcdefghijklmnopqrstuvwxyz"); - - protected static BitSet charsOf(String s) { - BitSet result = new BitSet(); - for (int i = 0; i < s.length(); i++) { - result.set(s.charAt(i)); - } - return result; - } - - protected BitSet whitespace; - protected char ch; - - public Scanner(String whitespace, TokenContextPath tokenContextPath) { - this.whitespace = charsOf(whitespace); - this.whitespace.set(EOF); - - this.tokenContextPath = tokenContextPath; - } - - public void setText(Document document) { - try { - setText(document.getText(0, document.getLength()), 0, document.getLength()); - } catch (BadLocationException ex) { - Logger logger = Logger.getLogger(Scanner.class.getName()); - logger.log(Level.SEVERE, ex.getMessage(), ex); - } - } - - public void setText(String s, int offset, int length) { - this.buffer = s.toCharArray(); - this.offset = offset; - this.tokenOffset = offset; - this.stopOffset = Math.min(buffer.length, offset + length); - } - - public String getTokenString() { - return new String(buffer, getTokenOffset(), getTokenLength()); - } - - public void findTokenBegin(int offset) { - this.offset = Math.max(offset, 0); - findTokenBegin(); - } - - /** - * If offset is in a token this method will read backwards until a - * whitespace character occurs. - */ - protected void findTokenBegin() { - if (offset >= stopOffset) { - offset = stopOffset - 1; - } - - if (!whitespace.get(buffer[offset])) { - while (offset > 0 && !whitespace.get(buffer[offset - 1])) { - offset--; - } - } - ch = buffer[offset]; - tokenOffset = offset; - } - - /** - * Reads the next character. - */ - protected void readNext() { - offset++; - if (offset < stopOffset) { - ch = buffer[offset]; - } else { - ch = EOF; - } - } - - protected boolean isWhitespace() { - boolean result = false; - while (whitespace.get(ch) && ch != EOF) { - result = true; - readNext(); - } - return result; - } - - /** - * Read to the next whitespace - */ - protected void readToWhitespace() { - do { - readNext(); - } while (!whitespace.get(ch)); - } - - private boolean readNextOrRestart(boolean result, boolean readNext) { - if (result) { - if (readNext) { - readNext(); - } - } else { - offset = tokenOffset; - ch = buffer[offset]; - } - return result; - } - - protected boolean isKeyword(Set keywords) { - int beginOffset = offset; - int endOffset = offset; - while (endOffset < stopOffset && !whitespace.get(buffer[endOffset])) { - endOffset++; - } - String word = new String(buffer, beginOffset, endOffset - beginOffset); - if (!keywords.contains(word)) { - return false; - } - - offset = endOffset - 1; - readNext(); - return true; - } - - protected boolean expectEnd() { - return readNextOrRestart(whitespace.get(ch), false); - } - - protected boolean expectEnd(char expected) { - return readNextOrRestart(ch == expected, false) && offset + 1 < stopOffset && whitespace.get(buffer[offset + 1]); - } - - protected boolean expectChar(char expected) { - return readNextOrRestart(ch == expected, true); - } - - protected boolean expectChar(BitSet expected) { - return readNextOrRestart(expected.get(ch), true); - } - - protected boolean expectChars(BitSet expected) { - while (expected.get(ch)) { - readNext(); - } - return true; - } - - protected boolean skipUntil(char expected) { - while (ch != expected && !whitespace.get(ch)) { - readNext(); - } - return expectChar(expected); - } - - protected boolean beforeChar(char before) { - int curOffset = offset - 1; - while (curOffset >= 0 && buffer[curOffset] != before && whitespace.get(buffer[curOffset])) { - curOffset--; - } - return curOffset >= 0 && buffer[curOffset] == before; - } - - protected boolean beforeChars(BitSet before) { - int curOffset = offset - 1; - while (curOffset >= 0 && !before.get(buffer[curOffset]) && whitespace.get(buffer[curOffset])) { - curOffset--; - } - return curOffset >= 0 && before.get(buffer[curOffset]); - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/Text.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/Text.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -package at.ssw.visualizer.texteditor.model; - -import com.sun.hotspot.igv.data.InputBlock; -import com.sun.hotspot.igv.data.InputGraph; -import java.util.Map; - -/** - * @author Christian Wimmer - * @author Alexander Reder - */ -public class Text { - - private InputGraph cfg; - - private String text; - private FoldingRegion[] foldings; - private Map hyperlinks; - private Map stringHovers; - private Map regionHovers; - private Map highlighting; - private Map blocks; - private Scanner scanner; - private String mimeType; - - - public Text(InputGraph cfg, String text, FoldingRegion[] foldings, Map hyperlinks, Map stringHovers, Map regionHovers, Map highlighting, Map blocks, Scanner scanner, String mimeType) { - this.cfg = cfg; - this.text = text; - this.foldings = foldings; - this.hyperlinks = hyperlinks; - this.stringHovers = stringHovers; - this.regionHovers = regionHovers; - this.highlighting = highlighting; - this.blocks = blocks; - this.scanner = scanner; - this.mimeType = mimeType; - } - - public InputGraph getCfg() { - return cfg; - } - - public String getText() { - return text; - } - - public FoldingRegion[] getFoldings() { - return foldings; - } - - public TextRegion getHyperlinkTarget(String key) { - return hyperlinks.get(key); - } - - public String getStringHover(String key) { - return stringHovers.get(key); - } - - public String getRegionHover(int position) { - for (TextRegion r : regionHovers.keySet()) { - if (r.getStart() <= position && r.getEnd() >= position) { - return regionHovers.get(r); - } - } - return null; - } - - public TextRegion[] getHighlighting(String key) { - return highlighting.get(key); - } - - public Map getBlocks() { - return blocks; - } - - public Scanner getScanner() { - return scanner; - } - - public String getMimeType() { - return mimeType; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/TextBuilder.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/TextBuilder.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -package at.ssw.visualizer.texteditor.model; - -import com.sun.hotspot.igv.data.InputBlock; -import com.sun.hotspot.igv.data.InputGraph; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * - * @author Alexander Reder - */ -public abstract class TextBuilder { - - protected StringBuilder text; - protected Scanner scanner; - protected List foldingRegions; - protected Map hyperlinks; - protected Map stringHovers; - protected Map regionHovers; - protected Map highlighting; - protected Map blocks; - protected Set hoverKeys; - protected Map hoverDefinitions; - protected Map> hoverReferences; - - public TextBuilder() { - text = new StringBuilder(4 * 1024); - foldingRegions = new ArrayList(); - hyperlinks = new HashMap(); - stringHovers = new HashMap(); - regionHovers = new HashMap(); - highlighting = new HashMap(); - blocks = new HashMap(); - hoverKeys = new HashSet(); - hoverDefinitions = new HashMap(); - hoverReferences = new HashMap>(); - } - - public abstract Text buildDocument(InputGraph cfg); - - protected abstract void buildHighlighting(); - - protected Text buildText(InputGraph cfg, String mimeType) { - buildHovers(); - buildHighlighting(); - return new Text(cfg, text.toString(), foldingRegions.toArray(new FoldingRegion[foldingRegions.size()]), hyperlinks, stringHovers, regionHovers, highlighting, blocks, scanner, mimeType); - } - - protected void appendBlockDetails(InputBlock block) { - text.append(blockDetails(block)); - } - - protected String blockDetails(InputBlock block) { - StringBuilder sb = new StringBuilder(); - sb.append(block.getName()); - hoverKeys.add(block.getName()); - // TODO: predecessors, successors, BCI, ... - return sb.toString(); - } - - protected void appendBlockList(StringBuilder sb, String prefix, List blocks) { - for (InputBlock block : blocks) { - sb.append(prefix); - prefix = ","; - sb.append(block.getName()); - } - } - - private void appendList(StringBuilder sb, String prefix, List values) { - for (String value : values) { - sb.append(prefix).append(value); - prefix = ","; - } - } - - protected void buildHovers() { - StringBuilder sb; - for(String key : hoverKeys) { - sb = new StringBuilder(); - if(hoverDefinitions.containsKey(key) && hoverReferences.containsKey(key)) { - sb.append("Definition;\n"); - sb.append(hoverDefinitions.get(key)); - sb.append("\n"); - } - if(hoverReferences.containsKey(key)) { - sb.append("References:\n"); - for(String ref : hoverReferences.get(key)) { - sb.append(ref); - sb.append("\n"); - } - } - if(sb.length() > 0) { - stringHovers.put(key, sb.toString().substring(0, sb.length() - 1)); - } - } - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/TextRegion.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/model/TextRegion.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -package at.ssw.visualizer.texteditor.model; - -/** - * - * @author Christian Wimmer - * @author Alexander Reder - */ -public class TextRegion { - - private int start; - private int end; - - public TextRegion(int start, int end) { - this.start = start; - this.end = end; - } - - - public int getStart() { - return start; - } - - public int getEnd() { - return end; - } - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/preferences.xml --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/preferences.xml Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/tooltip/StyledToolTip.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/tooltip/StyledToolTip.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -package at.ssw.visualizer.texteditor.tooltip; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import javax.swing.JEditorPane; -import javax.swing.JPanel; -import javax.swing.border.LineBorder; -import javax.swing.text.EditorKit; - -/** - * - * @author Bernhard Stiftner - * @author Christian Wimmer - * @author Alexander Reder - */ -public class StyledToolTip extends JPanel { - - public static final int BORDER = 2; - - private final String text; - private final JEditorPane toolTipPane; - - public StyledToolTip(String text, EditorKit editorKit) { - this.text = text; - - setBackground(new Color(235, 235, 163)); - setBorder(new LineBorder(Color.BLACK)); - setOpaque(true); - setLayout(new BorderLayout()); - - toolTipPane = new JEditorPane(); - toolTipPane.setEditable(false); - toolTipPane.setEditorKit(editorKit); - toolTipPane.setText(text); - - add(toolTipPane, BorderLayout.CENTER); - } - - @Override - public Dimension getPreferredSize() { - // Workaround: JEditorPane does not provide a proper width (only few pixels), - // so make the tooltip as large as the editor it is shown in - Dimension prefSize = super.getPreferredSize(); - prefSize.width = Integer.MAX_VALUE; - return prefSize; - } - - @Override - protected void paintComponent(Graphics g) { - // Workaround: Add a new line at the end so that the caret is not in the visible area. - toolTipPane.setText(text + "\n"); - - super.paintComponent(g); - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/tooltip/ToolTipAction.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/tooltip/ToolTipAction.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -package at.ssw.visualizer.texteditor.tooltip; - -import at.ssw.visualizer.texteditor.model.Scanner; -import at.ssw.visualizer.texteditor.model.Text; -import java.awt.event.ActionEvent; -import javax.swing.text.JTextComponent; -import org.netbeans.api.editor.EditorActionRegistration; -import org.netbeans.editor.BaseDocument; -import org.netbeans.editor.EditorUI; -import org.netbeans.editor.PopupManager; -import org.netbeans.editor.TokenID; -import org.netbeans.editor.Utilities; -import org.netbeans.editor.ext.ExtKit; -import org.netbeans.editor.ext.ToolTipSupport; -import org.netbeans.modules.editor.NbEditorKit; - -/** - * - * @author Christian Wimmer - * @author Alexander Reder - */ -public class ToolTipAction extends NbEditorKit.NbBuildToolTipAction { - public ToolTipAction() { - putValue(NAME, ExtKit.buildToolTipAction); - } - - @Override - public void actionPerformed(ActionEvent evt, JTextComponent target) { - if (!showTooltip(target)) { - super.actionPerformed(evt, target); - } - } - - private boolean showTooltip(JTextComponent target) { - BaseDocument document = Utilities.getDocument(target); - Text text = (Text) document.getProperty(Text.class); - if (text == null) { - return false; - } - - EditorUI ui = Utilities.getEditorUI(target); - ToolTipSupport tts = ui.getToolTipSupport(); - int offset = target.viewToModel(tts.getLastMouseEvent().getPoint()); - - String toolTipText = text.getRegionHover(offset); - - if (toolTipText == null) { - Scanner scanner = text.getScanner(); - scanner.setText(document); - scanner.findTokenBegin(offset); - TokenID token = scanner.nextToken(); - if (token.getNumericID() < 0) { - return false; - } - - toolTipText = text.getStringHover(scanner.getTokenString()); - if (toolTipText == null) { - return false; - } - } - - StyledToolTip tooltip = new StyledToolTip(toolTipText, target.getUI().getEditorKit(target)); - - tts.setToolTip(tooltip, PopupManager.ViewPortBounds, PopupManager.Largest, 0, 0); - return true; - } -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/view/AbstractTextViewTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/view/AbstractTextViewTopComponent.java Mon Jun 20 18:41:26 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -package at.ssw.visualizer.texteditor.view; - -import at.ssw.visualizer.core.selection.Selection; -import at.ssw.visualizer.core.selection.SelectionManager; -import at.ssw.visualizer.texteditor.EditorKit; -import com.sun.hotspot.igv.data.InputBlock; -import com.sun.hotspot.igv.data.InputGraph; -import java.awt.BorderLayout; -import java.util.Arrays; -import javax.swing.BorderFactory; -import javax.swing.JEditorPane; -import javax.swing.JScrollPane; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import org.openide.windows.TopComponent; - -/** - * - * @author Alexander Reder - */ -public abstract class AbstractTextViewTopComponent extends TopComponent { - - protected InputGraph curCFG; - protected InputBlock[] curBlocks; - - private JEditorPane editorPane; - - // EditorKit must be set in the imlementation class - public AbstractTextViewTopComponent(EditorKit kit) { - editorPane = new JEditorPane(); - editorPane.setEditorKit(kit); - editorPane.setEditable(false); - JScrollPane scrollPane = new JScrollPane(editorPane); - scrollPane.setViewportBorder(BorderFactory.createEmptyBorder()); - scrollPane.setBorder(BorderFactory.createEmptyBorder()); - setLayout(new BorderLayout()); - add(scrollPane); - } - - @Override - protected void componentShowing() { - super.componentShowing(); - SelectionManager.getDefault().addChangeListener(selectionChangeListener); - updateContent(); - } - - @Override - protected void componentHidden() { - super.componentHidden(); - SelectionManager.getDefault().removeChangeListener(selectionChangeListener); - curCFG = null; - curBlocks = null; - } - - - private ChangeListener selectionChangeListener = new ChangeListener() { - public void stateChanged(ChangeEvent event) { - updateContent(); - } - }; - - protected void updateContent() { - Selection selection = SelectionManager.getDefault().getCurSelection(); - InputGraph newCFG = selection.get(InputGraph.class); - InputBlock[] newBlocks = selection.get(InputBlock[].class); - - if (newCFG == null || newBlocks == null || newBlocks.length == 0) { - editorPane.setText("No block selected\n"); - } else if (curCFG != newCFG || !Arrays.equals(curBlocks, newBlocks)) { - editorPane.setText(getContent(newCFG, newBlocks)); - } - curCFG = newCFG; - curBlocks = newBlocks; - } - - protected abstract String getContent(InputGraph cfg, InputBlock[] blocks); - -} diff -r cebfa0b55183 -r 546dc7e1b184 src/share/tools/IdealGraphVisualizer/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Mon Jun 20 18:41:26 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Mon Jun 20 19:06:35 2011 +0200 @@ -21,14 +21,12 @@ ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ ${project.com.sun.hotspot.igv.filterwindow}:\ ${project.com.sun.hotspot.igv.graphtotext}:\ - ${project.com.sun.hotspot.igv.maxine}:\ ${project.com.sun.hotspot.igv.java6scriptingproxy}:\ ${project.com.sun.hotspot.igv.graphtexteditor}:\ ${project.com.sun.hotspot.igv.structuredtext}:\ ${project.com.sun.hotspot.igv.texteditor}:\ ${project.com.sun.hotspot.igv.selectioncoordinator}:\ - ${project.at.ssw.visualizer.texteditor} -project.at.ssw.visualizer.texteditor=Text Editor + ${project.com.sun.hotspot.igv.graal} project.com.sun.hotspot.connection=NetworkConnection project.com.sun.hotspot.igv.bytecodes=Bytecodes project.com.sun.hotspot.igv.controlflow=ControlFlow @@ -37,13 +35,13 @@ project.com.sun.hotspot.igv.difference=Difference project.com.sun.hotspot.igv.filter=Filter project.com.sun.hotspot.igv.filterwindow=FilterWindow +project.com.sun.hotspot.igv.graal=Graal project.com.sun.hotspot.igv.graph=Graph project.com.sun.hotspot.igv.graphtexteditor=GraphTextEditor project.com.sun.hotspot.igv.graphtotext=GraphToText project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout project.com.sun.hotspot.igv.java6scriptingproxy=Java6ScriptingProxy project.com.sun.hotspot.igv.layout=Layout -project.com.sun.hotspot.igv.maxine=Maxine project.com.sun.hotspot.igv.rhino=RhinoScriptEngineProxy project.com.sun.hotspot.igv.selectioncoordinator=SelectionCoordinator project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler diff -r cebfa0b55183 -r 546dc7e1b184 src/share/vm/classfile/systemDictionary.hpp --- a/src/share/vm/classfile/systemDictionary.hpp Mon Jun 20 18:41:26 2011 +0200 +++ b/src/share/vm/classfile/systemDictionary.hpp Mon Jun 20 19:06:35 2011 +0200 @@ -200,7 +200,7 @@ template(CiTargetMethod_Safepoint_klass, com_sun_cri_ci_CiTargetMethod_Safepoint, Opt) \ template(CiTargetMethod_ExceptionHandler_klass, com_sun_cri_ci_CiTargetMethod_ExceptionHandler, Opt) \ template(CiTargetMethod_Mark_klass, com_sun_cri_ci_CiTargetMethod_Mark, Opt) \ - template(CiBitMap_klass, com_sun_cri_ci_CiBitMap, Opt) \ + template(GraalBitMap_klass, com_oracle_max_graal_graph_BitMap, Opt) \ template(CiDebugInfo_klass, com_sun_cri_ci_CiDebugInfo, Opt) \ template(CiFrame_klass, com_sun_cri_ci_CiFrame, Opt) \ template(CiValue_klass, com_sun_cri_ci_CiValue, Opt) \ diff -r cebfa0b55183 -r 546dc7e1b184 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Mon Jun 20 18:41:26 2011 +0200 +++ b/src/share/vm/classfile/vmSymbols.hpp Mon Jun 20 19:06:35 2011 +0200 @@ -286,7 +286,7 @@ template(com_sun_cri_ci_CiTargetMethod_Safepoint, "com/sun/cri/ci/CiTargetMethod$Safepoint") \ template(com_sun_cri_ci_CiTargetMethod_ExceptionHandler, "com/sun/cri/ci/CiTargetMethod$ExceptionHandler") \ template(com_sun_cri_ci_CiTargetMethod_Mark, "com/sun/cri/ci/CiTargetMethod$Mark") \ - template(com_sun_cri_ci_CiBitMap, "com/sun/cri/ci/CiBitMap") \ + template(com_oracle_max_graal_graph_BitMap, "com/oracle/max/graal/graph/BitMap") \ template(com_sun_cri_ci_CiDebugInfo, "com/sun/cri/ci/CiDebugInfo") \ template(com_sun_cri_ci_CiFrame, "com/sun/cri/ci/CiFrame") \ template(com_sun_cri_ci_CiValue, "com/sun/cri/ci/CiValue") \ diff -r cebfa0b55183 -r 546dc7e1b184 src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Mon Jun 20 18:41:26 2011 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Mon Jun 20 19:06:35 2011 +0200 @@ -55,11 +55,11 @@ static bool is_bit_set(oop bit_map, int i) { const int MapWordBits = 64; if (i < MapWordBits) { - jlong low = CiBitMap::low(bit_map); + jlong low = GraalBitMap::low(bit_map); return (low & (1LL << i)) != 0; } else { jint extra_idx = (i - MapWordBits) / MapWordBits; - arrayOop extra = (arrayOop) CiBitMap::extra(bit_map); + arrayOop extra = (arrayOop) GraalBitMap::extra(bit_map); assert(extra_idx >= 0 && extra_idx < extra->length(), "unexpected index"); jlong word = ((jlong*) extra->base(T_LONG))[extra_idx]; return (word & (1LL << (i % MapWordBits))) != 0; @@ -73,7 +73,7 @@ oop frame_map = (oop) CiDebugInfo::frameRefMap(debug_info); if (register_map != NULL) { - assert(CiBitMap::size(register_map) == (unsigned) NUM_CPU_REGS, "unexpected register_map length"); + assert(BitMap::size(register_map) == (unsigned) NUM_CPU_REGS, "unexpected register_map length"); for (jint i = 0; i < NUM_CPU_REGS; i++) { bool is_oop = is_bit_set(register_map, i); VMReg reg = get_hotspot_reg(i); @@ -87,7 +87,7 @@ } if (frame_size > 0) { - assert(CiBitMap::size(frame_map) == frame_size / HeapWordSize, "unexpected frame_map length"); + assert(BitMap::size(frame_map) == frame_size / HeapWordSize, "unexpected frame_map length"); for (jint i = 0; i < frame_size / HeapWordSize; i++) { bool is_oop = is_bit_set(frame_map, i); @@ -100,7 +100,7 @@ } } } else { - assert(frame_map == NULL || CiBitMap::size(frame_map) == 0, "cannot have frame_map for frames with size 0"); + assert(frame_map == NULL || BitMap::size(frame_map) == 0, "cannot have frame_map for frames with size 0"); } return map; diff -r cebfa0b55183 -r 546dc7e1b184 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Mon Jun 20 18:41:26 2011 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Mon Jun 20 19:06:35 2011 +0200 @@ -140,13 +140,13 @@ end_class \ start_class(CiDebugInfo) \ oop_field(CiDebugInfo, codePos, "Lcom/sun/cri/ci/CiCodePos;") \ - oop_field(CiDebugInfo, registerRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ - oop_field(CiDebugInfo, frameRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ + oop_field(CiDebugInfo, registerRefMap, "Lcom/oracle/max/graal/graph/BitMap;") \ + oop_field(CiDebugInfo, frameRefMap, "Lcom/oracle/max/graal/graph/BitMap;") \ end_class \ - start_class(CiBitMap) \ - int_field(CiBitMap, size) \ - long_field(CiBitMap, low) \ - oop_field(CiBitMap, extra, "[J") \ + start_class(GraalBitMap) \ + int_field(GraalBitMap, size) \ + long_field(GraalBitMap, low) \ + oop_field(GraalBitMap, extra, "[J") \ end_class \ start_class(CiFrame) \ oop_field(CiFrame, values, "[Lcom/sun/cri/ci/CiValue;") \ @@ -217,7 +217,7 @@ /* end*/ #define START_CLASS(name) \ - class name : AllStatic { \ +class name : AllStatic { \ private: \ friend class GraalCompiler; \ static void check(oop obj) { assert(obj != NULL, "NULL field access of class " #name); assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected"); } \ diff -r cebfa0b55183 -r 546dc7e1b184 src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Mon Jun 20 18:41:26 2011 +0200 +++ b/src/share/vm/runtime/arguments.cpp Mon Jun 20 19:06:35 2011 +0200 @@ -2690,12 +2690,12 @@ scp_p->add_prefix(temp); sprintf(temp, "%s/com.oracle.max.asm/bin", maxine_dir); scp_p->add_prefix(temp); + sprintf(temp, "%s/com.oracle.max.graal.graph/bin", maxine_dir); + scp_p->add_prefix(temp); sprintf(temp, "%s/graal/com.oracle.max.graal.compiler/bin", graal_dir); scp_p->add_prefix(temp); sprintf(temp, "%s/graal/com.oracle.max.graal.runtime/bin", graal_dir); scp_p->add_prefix(temp); - sprintf(temp, "%s/graal/com.oracle.max.graal.graph/bin", graal_dir); - scp_p->add_prefix(temp); sprintf(temp, "%s/graal/com.oracle.max.graal.graphviz/bin", graal_dir); scp_p->add_prefix(temp); *scp_assembly_required_p = true;