changeset 4486:f3cc08cb211d

Imported data model from c1visualizer.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 30 Jan 2012 23:11:38 +0100
parents 3b776fb6ffd9
children aae5b3773e63
files src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/bc/Bytecodes.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/BasicBlock.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/ControlFlowGraph.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/IRInstruction.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/State.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/StateEntry.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/ChildInterval.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/Interval.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/IntervalList.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/Range.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/UsePosition.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/nc/NativeMethod.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/bc/BytecodesImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/BasicBlockImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/ControlFlowGraphImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/IRInstructionImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/StateEntryImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/StateImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/ChildIntervalImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/IntervalImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/IntervalListImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/RangeImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/UsePositionImpl.java src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/nc/NativeMethodImpl.java src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/AbstractFolderElement.java
diffstat 25 files changed, 1167 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/bc/Bytecodes.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,33 @@
+package at.ssw.visualizer.model.bc;
+
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+
+/**
+ * This class holds the bytecode of a method and provides severel methods
+ * accessing the details.
+ *
+ * @author Alexander Reder
+ * @author Christian Wimmer
+ */
+public interface Bytecodes {
+    /**
+     * Back-link to the control flow graph where the bytecodes were loaded from.
+     */
+    public ControlFlowGraph getControlFlowGraph();
+
+    /**
+     * Called before the first call of getBytecodes() or getEpilogue(). Can be called multiple times.
+     */
+    public void parseBytecodes();
+    
+    /**
+     * The bytecodes of the method in the given bytecode range.
+     *
+     * @param   fromBCI starting BCI (including this bci)
+     * @param   toBCI   ending BCI (not including this bci)
+     * @return          string representation of the bytecodes
+     */
+    public String getBytecodes(int fromBCI, int toBCI);
+    
+    public String getEpilogue();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/BasicBlock.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,47 @@
+package at.ssw.visualizer.model.cfg;
+
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface BasicBlock {
+    public ControlFlowGraph getParent();
+
+    public String getName();
+
+    public int getFromBci();
+
+    public int getToBci();
+
+    public List<BasicBlock> getPredecessors();
+
+    public List<BasicBlock> getSuccessors();
+
+    public List<BasicBlock> getXhandlers();
+
+    public List<String> getFlags();
+
+    public BasicBlock getDominator();
+
+    public int getLoopIndex();
+
+    public int getLoopDepth();
+
+    public int getFirstLirId();
+
+    public int getLastLirId();
+
+    public boolean hasState();
+
+    public List<State> getStates();
+
+    public boolean hasHir();
+
+    public List<IRInstruction> getHirInstructions();
+
+    public boolean hasLir();
+
+    public List<IRInstruction> getLirOperations();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/ControlFlowGraph.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,26 @@
+package at.ssw.visualizer.model.cfg;
+
+import at.ssw.visualizer.model.bc.Bytecodes;
+import at.ssw.visualizer.model.nc.NativeMethod;
+import com.sun.hotspot.igv.data.FolderElement;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface ControlFlowGraph extends FolderElement {
+    public List<BasicBlock> getBasicBlocks();
+
+    public BasicBlock getBasicBlockByName(String name);
+
+    public Bytecodes getBytecodes();
+
+    public NativeMethod getNativeMethod();
+
+    public boolean hasState();
+
+    public boolean hasHir();
+
+    public boolean hasLir();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/IRInstruction.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,19 @@
+package at.ssw.visualizer.model.cfg;
+
+import java.util.Collection;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface IRInstruction {
+    public static String HIR_NAME = "tid";
+    public static String HIR_TEXT = "instruction";
+    public static String HIR_OPERAND = "result";
+
+    public static String LIR_NUMBER = "nr";
+    public static String LIR_TEXT = "instruction";
+
+    public Collection<String> getNames();
+    public String getValue(String name);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/State.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,17 @@
+package at.ssw.visualizer.model.cfg;
+
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface State {
+    public String getKind();
+
+    public int getSize();
+
+    public String getMethod();
+
+    public List<StateEntry> getEntries();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/cfg/StateEntry.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,19 @@
+package at.ssw.visualizer.model.cfg;
+
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface StateEntry {
+    public int getIndex();
+
+    public String getName();
+
+    public boolean hasPhiOperands();
+
+    public List<String> getPhiOperands();
+
+    public String getOperand();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/ChildInterval.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,29 @@
+package at.ssw.visualizer.model.interval;
+
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface ChildInterval {
+    public Interval getParent();
+
+    public String getRegNum();
+
+    public String getType();
+
+    public String getOperand();
+
+    public String getSpillState();
+
+    public ChildInterval getRegisterHint();
+
+    public List<Range> getRanges();
+
+    public List<UsePosition> getUsePositions();
+
+    public int getFrom();
+
+    public int getTo();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/Interval.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,19 @@
+package at.ssw.visualizer.model.interval;
+
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface Interval {
+    public IntervalList getParent();
+
+    public List<ChildInterval> getChildren();
+
+    public String getRegNum();
+
+    public int getFrom();
+
+    public int getTo();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/IntervalList.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,16 @@
+package at.ssw.visualizer.model.interval;
+
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface IntervalList {
+    public List<Interval> getIntervals();
+
+    public ControlFlowGraph getControlFlowGraph();
+
+    public int getNumLIROperations();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/Range.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,11 @@
+package at.ssw.visualizer.model.interval;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface Range {
+    public int getFrom();
+
+    public int getTo();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/interval/UsePosition.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,11 @@
+package at.ssw.visualizer.model.interval;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public interface UsePosition {
+    public char getKind();
+
+    public int getPosition();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/model/nc/NativeMethod.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,15 @@
+package at.ssw.visualizer.model.nc;
+
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+
+/**
+ *
+ * @author Alexander Reder
+ */
+public interface NativeMethod {
+
+    public ControlFlowGraph getControlFlowGraph();
+    
+    public String getMethodText();
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/bc/BytecodesImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,166 @@
+package at.ssw.visualizer.modelimpl.bc;
+
+import at.ssw.visualizer.model.bc.Bytecodes;
+import at.ssw.visualizer.model.cfg.BasicBlock;
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+import at.ssw.visualizer.modelimpl.cfg.BasicBlockImpl;
+import java.util.Arrays;
+
+/**
+ * This class holds the bytecode of a method and provides severel methods
+ * accessing the details.
+ *
+ * @author Christian Wimmer
+ */
+public class BytecodesImpl implements Bytecodes {
+    private ControlFlowGraph controlFlowGraph;
+    private String bytecodeString;
+
+    private String[] bytecodes;
+    private String epilogue;
+    
+
+    public BytecodesImpl(ControlFlowGraph controlFlowGraph, String bytecodeString) {
+        this.controlFlowGraph = controlFlowGraph;
+        this.bytecodeString = bytecodeString;
+    }
+    
+    public void parseBytecodes() {
+        String[] lines = bytecodeString.split("\n");
+
+        boolean inPrologue = true;
+        String[] result = new String[lines.length * 3];
+        int lastBci = -1;
+        int lnr = 0; 
+        for (; lnr < lines.length; lnr++) {
+            String line = lines[lnr];
+
+            line = line.trim();
+            if (line.startsWith("[")) {
+                int end = line.indexOf(']');
+                if (end != -1) {
+                    line = line.substring(end + 1, line.length());
+                }
+            }
+            
+            line = line.trim();
+            int space1 = line.indexOf(' ');
+            if (space1 <= 0) {
+                if (inPrologue) {
+                    continue;
+                } else {
+                    break;
+                }
+            }
+            String bciStr = line.substring(0, space1);
+            if (bciStr.endsWith(":")) {
+                bciStr = bciStr.substring(0, bciStr.length() - 1);
+            }
+
+            int bci;
+            try {
+                bci = Integer.parseInt(bciStr);
+            } catch (NumberFormatException ex) {
+                // Ignore invalid lines.
+                if (inPrologue) {
+                    continue;
+                } else {
+                    break;
+                }
+            }
+
+            String opcode = line.substring(space1 + 1);
+            String params = "";
+            int space2 = opcode.indexOf(' ');
+            if (space2 > 0) {
+                params = opcode.substring(space2 + 1).trim();
+                opcode = opcode.substring(0, space2);
+            }
+            String tail = "";
+            int space3 = params.indexOf('|');
+            if (space3 >= 0) {
+                tail = params.substring(space3);
+                params = params.substring(0, space3);
+            }
+
+//            if (!"ldc".equals(opcode) || !params.startsWith("\"")) {
+//                // Separate packages with "." instead of "/"
+//                params = params.replace('/', '.');
+//            }
+            
+            String printLine = bciStr + ":" + "    ".substring(Math.min(bciStr.length(), 3)) +
+                    opcode + "              ".substring(Math.min(opcode.length(), 13)) +
+                    params + "        ".substring(Math.min(params.length(), 8)) +
+                    tail;
+
+            
+            if (bci >= result.length) {
+                result = Arrays.copyOf(result, Math.max(bci + 1, result.length * 2));
+            }
+            result[bci] = printLine;
+            inPrologue = false;
+            lastBci = Math.max(lastBci, bci);
+        }
+
+        StringBuilder epilogueBuilder = new StringBuilder();
+        for (; lnr < lines.length; lnr++) {
+            epilogueBuilder.append(lines[lnr]).append("\n");
+        }
+        epilogue = epilogueBuilder.toString();
+        bytecodes = Arrays.copyOf(result, lastBci + 1);
+    
+        
+        BasicBlockImpl[] blocks = new BasicBlockImpl[bytecodes.length];
+        for (BasicBlock b : controlFlowGraph.getBasicBlocks()) {
+            if (b instanceof BasicBlockImpl) {
+                BasicBlockImpl block = (BasicBlockImpl) b;
+                if (block.getToBci() != -1) {
+                    // Do not override existing values.
+                    return;
+                }
+                if (block.getFromBci() >= 0 && block.getFromBci() < blocks.length) {
+                    blocks[block.getFromBci()] = block;
+                }
+            }
+        }
+        
+        int curToBci = -1;
+        for (int i = blocks.length - 1; i >= 0; i--) {
+            if (bytecodes[i] != null && curToBci == -1) {
+                curToBci = i;
+            }
+            if (blocks[i] != null) {
+                blocks[i].setToBci(curToBci);
+                curToBci = -1;
+            }
+        }
+    }
+    
+    public ControlFlowGraph getControlFlowGraph() {
+        return controlFlowGraph;
+    }
+
+    public String getBytecodes(int fromBCI, int toBCI) {
+        if (fromBCI < 0) {
+            return "";
+        }
+        toBCI = Math.min(toBCI, bytecodes.length);
+        StringBuilder sb = new StringBuilder();
+        for (int i = fromBCI; i < toBCI; i++) {
+            if (bytecodes[i] != null) {
+                sb.append(bytecodes[i]).append("\n");
+            }
+        }
+        return sb.toString();
+    }
+
+    @Override
+    public String getEpilogue() {
+        return epilogue;
+    }
+
+    @Override
+    public String toString() {
+        return "Bytecodes " + getControlFlowGraph().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/BasicBlockImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,143 @@
+package at.ssw.visualizer.modelimpl.cfg;
+
+import at.ssw.visualizer.model.cfg.BasicBlock;
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+import at.ssw.visualizer.model.cfg.IRInstruction;
+import at.ssw.visualizer.model.cfg.State;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class BasicBlockImpl implements BasicBlock {
+
+    private ControlFlowGraph parent;
+    private String name;
+    private int fromBci;
+    private int toBci;
+    private BasicBlock[] predecessors;
+    private BasicBlock[] successors;
+    private BasicBlock[] xhandlers;
+    private String[] flags;
+    private BasicBlock dominator;
+    private int loopIndex;
+    private int loopDepth;
+    private int firstLirId;
+    private int lastLirId;
+    private State[] states;
+    private IRInstruction[] hirInstructions;
+    private IRInstruction[] lirOperations;
+
+    public void setValues(String name, int fromBci, int toBci, BasicBlock[] predecessors, BasicBlock[] successors, BasicBlock[] xhandlers, String[] flags, BasicBlock dominator, int loopIndex, int loopDepth, int firstLirId, int lastLirId, State[] states, IRInstruction[] hirInstructions, IRInstruction[] lirOperations) {
+        this.name = name;
+        this.fromBci = fromBci;
+        this.toBci = toBci;
+
+        this.predecessors = predecessors;
+        this.successors = successors;
+        this.xhandlers = xhandlers;
+
+        this.flags = flags;
+        this.dominator = dominator;
+        this.loopIndex = loopIndex;
+        this.loopDepth = loopDepth;
+        this.firstLirId = firstLirId;
+        this.lastLirId = lastLirId;
+
+        this.states = states;
+        this.hirInstructions = hirInstructions;
+        this.lirOperations = lirOperations;
+    }
+
+    public ControlFlowGraph getParent() {
+        return parent;
+    }
+
+    protected void setParent(ControlFlowGraphImpl parent) {
+        this.parent = parent;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int getFromBci() {
+        return fromBci;
+    }
+
+    public int getToBci() {
+        return toBci;
+    }
+
+    public void setToBci(int toBci) {
+        this.toBci = toBci;
+    }
+
+    public List<BasicBlock> getPredecessors() {
+        return Collections.unmodifiableList(Arrays.asList(predecessors));
+    }
+
+    public List<BasicBlock> getSuccessors() {
+        return Collections.unmodifiableList(Arrays.asList(successors));
+    }
+
+    public List<BasicBlock> getXhandlers() {
+        return Collections.unmodifiableList(Arrays.asList(xhandlers));
+    }
+
+    public List<String> getFlags() {
+        return Collections.unmodifiableList(Arrays.asList(flags));
+    }
+
+    public BasicBlock getDominator() {
+        return dominator;
+    }
+
+    public int getLoopIndex() {
+        return loopIndex;
+    }
+
+    public int getLoopDepth() {
+        return loopDepth;
+    }
+
+    public int getFirstLirId() {
+        return firstLirId;
+    }
+
+    public int getLastLirId() {
+        return lastLirId;
+    }
+
+    public boolean hasState() {
+        return states != null;
+    }
+
+    public List<State> getStates() {
+        return Collections.unmodifiableList(Arrays.asList(states));
+    }
+
+    public boolean hasHir() {
+        return hirInstructions != null;
+    }
+
+    public List<IRInstruction> getHirInstructions() {
+        return Collections.unmodifiableList(Arrays.asList(hirInstructions));
+    }
+
+    public boolean hasLir() {
+        return lirOperations != null;
+    }
+
+    public List<IRInstruction> getLirOperations() {
+        return Collections.unmodifiableList(Arrays.asList(lirOperations));
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/ControlFlowGraphImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,83 @@
+package at.ssw.visualizer.modelimpl.cfg;
+
+import at.ssw.visualizer.model.bc.Bytecodes;
+import at.ssw.visualizer.model.cfg.BasicBlock;
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+import at.ssw.visualizer.model.nc.NativeMethod;
+import com.sun.hotspot.igv.data.AbstractFolderElement;
+import com.sun.hotspot.igv.data.FolderElement;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class ControlFlowGraphImpl extends AbstractFolderElement implements ControlFlowGraph {
+    private BasicBlock[] basicBlocks;
+    private Map<String, BasicBlock> blockNames;
+    private Bytecodes bytecodes;
+    private NativeMethod nativeMethod;
+    private boolean hasState;
+    private boolean hasHir;
+    private boolean hasLir;
+
+    public ControlFlowGraphImpl(String shortName, String name, BasicBlockImpl[] basicBlocks) {
+        super(shortName, name);
+        this.basicBlocks = basicBlocks;
+
+        blockNames = new HashMap<String, BasicBlock>(basicBlocks.length);
+        nativeMethod = null;
+        for (BasicBlockImpl block : basicBlocks) {
+            block.setParent(this);
+            blockNames.put(block.getName(), block);
+            hasState |= block.hasState();
+            hasHir |= block.hasHir();
+            hasLir |= block.hasLir();
+        }
+    }
+
+    public List<BasicBlock> getBasicBlocks() {
+        return Collections.unmodifiableList(Arrays.asList(basicBlocks));
+    }
+
+    public BasicBlock getBasicBlockByName(String name) {
+        return blockNames.get(name);
+    }
+
+    public Bytecodes getBytecodes() {
+        return bytecodes;
+    }
+
+    public void setBytecodes(Bytecodes bytecodes) {
+        this.bytecodes = bytecodes;
+    }
+
+    public NativeMethod getNativeMethod() {
+        return nativeMethod;
+    }
+
+    public void setNativeMethod(NativeMethod nativeMethod) {
+        this.nativeMethod = nativeMethod;
+    }
+
+    public boolean hasState() {
+        return hasState;
+    }
+
+    public boolean hasHir() {
+        return hasHir;
+    }
+
+    public boolean hasLir() {
+        return hasLir;
+    }
+
+    @Override
+    public String toString() {
+        return "    CFG \"" + getName() + "\": " + basicBlocks.length + " blocks\n";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/IRInstructionImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,40 @@
+package at.ssw.visualizer.modelimpl.cfg;
+
+import at.ssw.visualizer.model.cfg.IRInstruction;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+
+public class IRInstructionImpl implements IRInstruction {
+    private LinkedHashMap<String, String> data;
+
+    public IRInstructionImpl(LinkedHashMap<String, String> data) {
+        this.data = data;
+    }
+
+    public IRInstructionImpl(String pinned, int bci, int useCount, String name, String text, String operand) {
+        data = new LinkedHashMap<String, String>();
+        data.put("p", pinned);
+        data.put("bci", Integer.toString(bci));
+        data.put("use", Integer.toString(useCount));
+        data.put(HIR_NAME, name);
+        if (operand != null) {
+            data.put(HIR_OPERAND, operand);
+        }
+        data.put(HIR_TEXT, text);
+    }
+
+    public IRInstructionImpl(int number, String text) {
+        data = new LinkedHashMap<String, String>();
+        data.put(LIR_NUMBER, Integer.toString(number));
+        data.put(LIR_TEXT, text);
+    }
+
+    public Collection<String> getNames() {
+        return Collections.unmodifiableSet(data.keySet());
+    }
+
+    public String getValue(String name) {
+        return data.get(name);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/StateEntryImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,44 @@
+package at.ssw.visualizer.modelimpl.cfg;
+
+import at.ssw.visualizer.model.cfg.StateEntry;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class StateEntryImpl implements StateEntry {
+    private int index;
+    private String name;
+    private String[] phiOperands;
+    private String operand;
+
+    public StateEntryImpl(int index, String name, String[] phiOperands, String operand) {
+        this.index = index;
+        this.name = name;
+        this.phiOperands = phiOperands;
+        this.operand = operand;
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean hasPhiOperands() {
+        return phiOperands != null;
+    }
+
+    public List<String> getPhiOperands() {
+        return Collections.unmodifiableList(Arrays.asList(phiOperands));
+    }
+
+    public String getOperand() {
+        return operand;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/cfg/StateImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,41 @@
+package at.ssw.visualizer.modelimpl.cfg;
+
+import at.ssw.visualizer.model.cfg.State;
+import at.ssw.visualizer.model.cfg.StateEntry;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class StateImpl implements State {
+    private String kind;
+    private int size;
+    private String method;
+    private StateEntry[] entries;
+
+    public StateImpl(String kind, int size, String method, StateEntryImpl[] entries) {
+        this.kind = kind;
+        this.size = size;
+        this.method = method;
+        this.entries = entries;
+    }
+
+    public String getKind() {
+        return kind;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public List<StateEntry> getEntries() {
+        return Collections.unmodifiableList(Arrays.asList(entries));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/ChildIntervalImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,118 @@
+package at.ssw.visualizer.modelimpl.interval;
+
+import at.ssw.visualizer.model.interval.ChildInterval;
+import at.ssw.visualizer.model.interval.Interval;
+import at.ssw.visualizer.model.interval.Range;
+import at.ssw.visualizer.model.interval.UsePosition;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class ChildIntervalImpl implements ChildInterval, Comparable<ChildIntervalImpl> {
+    private Interval parent;
+    private String regNum;
+    private String type;
+    private String operand;
+    private String spillState;
+    private ChildInterval registerHint;
+    private Range[] ranges;
+    private UsePosition[] usePositions;
+
+    public void setValues(String regNum, String type, String operand, String spillState, ChildInterval registerHint, Range[] ranges, UsePosition[] usePositions) {
+        this.regNum = regNum;
+        this.type = type;
+        this.operand = operand;
+        this.spillState = spillState;
+        this.registerHint = registerHint;
+        this.ranges = ranges;
+        this.usePositions = usePositions;
+    }
+    
+    public Interval getParent() {
+        return parent;
+    }
+
+    protected void setParent(IntervalImpl parent) {
+        this.parent = parent;
+    }
+
+    public String getRegNum() {
+        return regNum;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public String getOperand() {
+        return operand;
+    }
+
+    public String getSpillState() {
+        return spillState;
+    }
+
+    public ChildInterval getRegisterHint() {
+        return registerHint;
+    }
+
+    public List<Range> getRanges() {
+        return Collections.unmodifiableList(Arrays.asList(ranges));
+    }
+
+    public List<UsePosition> getUsePositions() {
+        return Collections.unmodifiableList(Arrays.asList(usePositions));
+    }
+
+
+    public int getFrom() {
+        return ranges[0].getFrom();
+    }
+
+    public int getTo() {
+        return ranges[ranges.length - 1].getTo();
+    }
+
+
+    public int compareTo(ChildIntervalImpl other) {
+        return getFrom() - other.getFrom();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder result = new StringBuilder();
+        result.append(regNum);
+        result.append(": ");
+        result.append(getType());
+        result.append(", ");
+        result.append(getOperand());
+        result.append(", ");
+        if (registerHint != null) {
+            result.append(registerHint.getRegNum());
+        } else {
+            result.append("null");
+        }
+
+        result.append("  ");
+        for (int i = 0; i < ranges.length; i++) {
+            if (i > 0) {
+                result.append(", ");
+            }
+            result.append(ranges[i]);
+        }
+
+        result.append("  ");
+        for (int i = 0; i < usePositions.length; i++) {
+            if (i > 0) {
+                result.append(", ");
+            }
+            result.append(usePositions[i]);
+        }
+
+        return result.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/IntervalImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,60 @@
+package at.ssw.visualizer.modelimpl.interval;
+
+import at.ssw.visualizer.model.interval.ChildInterval;
+import at.ssw.visualizer.model.interval.Interval;
+import at.ssw.visualizer.model.interval.IntervalList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class IntervalImpl implements Interval {
+    private IntervalList parent;
+    private ChildInterval[] children;
+
+    public IntervalImpl(ChildIntervalImpl[] children) {
+        this.children = children;
+        for (ChildIntervalImpl child : children) {
+            child.setParent(this);
+        }
+    }
+
+    public IntervalList getParent() {
+        return parent;
+    }
+
+    protected void setParent(IntervalListImpl parent) {
+        this.parent = parent;
+    }
+
+    public List<ChildInterval> getChildren() {
+        return Collections.unmodifiableList(Arrays.asList(children));
+    }
+
+    public String getRegNum() {
+        return children[0].getRegNum();
+    }
+
+    public int getFrom() {
+        return children[0].getFrom();
+    }
+
+    public int getTo() {
+        return children[children.length - 1].getTo();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder result = new StringBuilder();
+        for (int i = 0; i < children.length; i++) {
+            if (i > 0) {
+                result.append("\n  ");
+            }
+            result.append(children[i]);
+        }
+        return result.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/IntervalListImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,53 @@
+package at.ssw.visualizer.modelimpl.interval;
+
+import at.ssw.visualizer.model.cfg.BasicBlock;
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+import at.ssw.visualizer.model.interval.Interval;
+import at.ssw.visualizer.model.interval.IntervalList;
+import com.sun.hotspot.igv.data.AbstractFolderElement;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class IntervalListImpl extends AbstractFolderElement implements IntervalList {
+    private Interval[] intervals;
+    private ControlFlowGraph controlFlowGraph;
+    private int numLIROperations;
+
+    public IntervalListImpl(String shortName, String name, IntervalImpl[] intervals, ControlFlowGraph controlFlowGraph) {
+        super(shortName, name);
+        this.intervals = intervals;
+        this.controlFlowGraph = controlFlowGraph;
+
+        for (IntervalImpl interval : intervals) {
+            interval.setParent(this);
+            numLIROperations = Math.max(numLIROperations, interval.getTo());
+        }
+        for (BasicBlock basicBlock : controlFlowGraph.getBasicBlocks()) {
+            numLIROperations = Math.max(numLIROperations, basicBlock.getLastLirId() + 2);
+        }
+    }
+
+
+    public List<Interval> getIntervals() {
+        return Collections.unmodifiableList(Arrays.asList(intervals));
+    }
+
+    public ControlFlowGraph getControlFlowGraph() {
+        return controlFlowGraph;
+    }
+
+    public int getNumLIROperations() {
+        return numLIROperations;
+    }
+
+
+    @Override
+    public String toString() {
+        return "    Intervals \"" + getName() + "\": " + intervals.length + " intervals\n";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/RangeImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,36 @@
+package at.ssw.visualizer.modelimpl.interval;
+
+import at.ssw.visualizer.model.interval.Range;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class RangeImpl implements Range, Comparable<RangeImpl> {
+    private int from;
+    private int to;
+
+    public RangeImpl(int from, int to) {
+        this.from = from;
+        this.to = to;
+    }
+
+
+    public int getFrom() {
+        return from;
+    }
+
+    public int getTo() {
+        return to;
+    }
+
+
+    public int compareTo(RangeImpl other) {
+        return getFrom() - other.getFrom();
+    }
+
+    @Override
+    public String toString() {
+        return "[" + from + ", " + to + "]";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/interval/UsePositionImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,36 @@
+package at.ssw.visualizer.modelimpl.interval;
+
+import at.ssw.visualizer.model.interval.UsePosition;
+
+/**
+ *
+ * @author Christian Wimmer
+ */
+public class UsePositionImpl implements UsePosition, Comparable<UsePositionImpl> {
+    private int position;
+    private char kind;
+
+    public UsePositionImpl(int position, char kind) {
+        this.position = position;
+        this.kind = kind;
+    }
+
+
+    public char getKind() {
+        return kind;
+    }
+
+    public int getPosition() {
+        return position;
+    }
+
+
+    public int compareTo(UsePositionImpl other) {
+        return getPosition() - other.getPosition();
+    }
+
+    @Override
+    public String toString() {
+        return position + "(" + kind + ")";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/at/ssw/visualizer/modelimpl/nc/NativeMethodImpl.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,28 @@
+package at.ssw.visualizer.modelimpl.nc;
+
+import at.ssw.visualizer.model.cfg.ControlFlowGraph;
+import at.ssw.visualizer.model.nc.NativeMethod;
+
+/**
+ *
+ * @author Alexander Reder
+ */
+public class NativeMethodImpl implements NativeMethod {
+
+    private ControlFlowGraph controlFlowGraph;
+    private String methodText;
+    
+    public NativeMethodImpl(ControlFlowGraph controlFlowGraph, String methodText) {
+        this.controlFlowGraph = controlFlowGraph;
+        this.methodText = methodText;
+    }
+
+    public ControlFlowGraph getControlFlowGraph() {
+        return controlFlowGraph;
+    }
+    
+    public String getMethodText() {
+        return methodText;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/AbstractFolderElement.java	Mon Jan 30 23:11:38 2012 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.data;
+
+public class AbstractFolderElement implements FolderElement {
+    
+    private String name;
+    private String shortName;
+    private Folder parent;
+    
+    public AbstractFolderElement(String name, String shortName) {
+        this.name = name;
+        this.shortName = shortName;
+    }
+
+    public String getShortName() {
+        return shortName;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public Folder getParent() {
+        return parent;
+    }
+
+    @Override
+    public void setParent(Folder parent) {
+        this.parent = parent;
+    }
+}