com.sun.hotspot.igv.data.InputBlock Java Examples

The following examples show how to use com.sun.hotspot.igv.data.InputBlock. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerCompilerScheduler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public InputBlock getCommonDominator(int a, int b) {
    InputBlock ba = blocks.get(a);
    InputBlock bb = blocks.get(b);
    if (ba == bb) {
        return ba;
    }
    Set<InputBlock> visited = new HashSet<InputBlock>();
    while (ba != null) {
        visited.add(ba);
        ba = dominatorMap.get(ba);
    }

    while (bb != null) {
        if (visited.contains(bb)) {
            return bb;
        }
        bb = dominatorMap.get(bb);
    }

    assert false;
    return null;
}
 
Example #2
Source File: ServerCompilerScheduler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public InputBlock getCommonDominator(int a, int b) {
    InputBlock ba = blocks.get(a);
    InputBlock bb = blocks.get(b);
    if (ba == bb) {
        return ba;
    }
    Set<InputBlock> visited = new HashSet<>();
    while (ba != null) {
        visited.add(ba);
        ba = dominatorMap.get(ba);
    }

    while (bb != null) {
        if (visited.contains(bb)) {
            return bb;
        }
        bb = dominatorMap.get(bb);
    }

    assert false;
    return null;
}
 
Example #3
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public InputBlock getCommonDominator(int a, int b) {
    InputBlock ba = blocks.get(a);
    InputBlock bb = blocks.get(b);
    if (ba == bb) {
        return ba;
    }
    Set<InputBlock> visited = new HashSet<InputBlock>();
    while (ba != null) {
        visited.add(ba);
        ba = dominatorMap.get(ba);
    }

    while (bb != null) {
        if (visited.contains(bb)) {
            return bb;
        }
        bb = dominatorMap.get(bb);
    }

    assert false;
    return null;
}
 
Example #4
Source File: ServerCompilerScheduler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public InputBlock getCommonDominator(int a, int b) {
    InputBlock ba = blocks.get(a);
    InputBlock bb = blocks.get(b);
    if (ba == bb) {
        return ba;
    }
    Set<InputBlock> visited = new HashSet<InputBlock>();
    while (ba != null) {
        visited.add(ba);
        ba = dominatorMap.get(ba);
    }

    while (bb != null) {
        if (visited.contains(bb)) {
            return bb;
        }
        bb = dominatorMap.get(bb);
    }

    assert false;
    return null;
}
 
Example #5
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public InputBlock getCommonDominator(int a, int b) {
    InputBlock ba = blocks.get(a);
    InputBlock bb = blocks.get(b);
    if (ba == bb) {
        return ba;
    }
    Set<InputBlock> visited = new HashSet<InputBlock>();
    while (ba != null) {
        visited.add(ba);
        ba = dominatorMap.get(ba);
    }

    while (bb != null) {
        if (visited.contains(bb)) {
            return bb;
        }
        bb = dominatorMap.get(bb);
    }

    assert false;
    return null;
}
 
Example #6
Source File: Block.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Set<? extends Cluster> getSuccessors() {
    Set<Block> succs = new HashSet<Block>();
    for (InputBlock b : inputBlock.getSuccessors()) {
        succs.add(diagram.getBlock(b));
    }
    return succs;
}
 
Example #7
Source File: BlockWidget.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #8
Source File: Source.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean isInBlock(InputGraph g, InputBlock blockNode) {

        for (InputNode n : this.getSourceNodes()) {
            if (g.getBlock(n) == blockNode) {
                return true;
            }
        }
        return false;
    }
 
Example #9
Source File: Diagram.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void updateBlocks() {
    blocks.clear();
    for (InputBlock b : graph.getBlocks()) {
        Block curBlock = new Block(b, this);
        blocks.put(b, curBlock);
    }
}
 
Example #10
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void markWithBlock(Node n, InputBlock b, Set<Node> reachable) {
    assert !reachable.contains(n);
    Stack<Node> stack = new Stack<Node>();
    stack.push(n);
    n.block = b;
    b.addNode(n.inputNode.getId());
    reachable.add(n);

    while (!stack.isEmpty()) {
        Node cur = stack.pop();
        for (Node s : cur.succs) {
            if (!reachable.contains(s)) {
                reachable.add(s);
                s.block = b;
                b.addNode(s.inputNode.getId());
                stack.push(s);
            }
        }

        for (Node s : cur.preds) {
            if (!reachable.contains(s)) {
                reachable.add(s);
                s.block = b;
                b.addNode(s.inputNode.getId());
                stack.push(s);
            }
        }
    }
}
 
Example #11
Source File: Block.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Set<? extends Cluster> getSuccessors() {
    Set<Block> succs = new HashSet<Block>();
    for (InputBlock b : inputBlock.getSuccessors()) {
        succs.add(diagram.getBlock(b));
    }
    return succs;
}
 
Example #12
Source File: ServerCompilerScheduler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void markWithBlock(Node n, InputBlock b, Set<Node> reachable) {
    assert !reachable.contains(n);
    Stack<Node> stack = new Stack<>();
    stack.push(n);
    n.block = b;
    b.addNode(n.inputNode.getId());
    reachable.add(n);

    while (!stack.isEmpty()) {
        Node cur = stack.pop();
        for (Node s : cur.succs) {
            if (!reachable.contains(s)) {
                reachable.add(s);
                s.block = b;
                b.addNode(s.inputNode.getId());
                stack.push(s);
            }
        }

        for (Node s : cur.preds) {
            if (!reachable.contains(s)) {
                reachable.add(s);
                s.block = b;
                b.addNode(s.inputNode.getId());
                stack.push(s);
            }
        }
    }
}
 
Example #13
Source File: ControlFlowScene.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void performSelection(Rectangle rectangle) {

        if (rectangle.width < 0) {
            rectangle.x += rectangle.width;
            rectangle.width *= -1;
        }

        if (rectangle.height < 0) {
            rectangle.y += rectangle.height;
            rectangle.height *= -1;
        }

        boolean changed = false;
        for (InputBlock b : this.getNodes()) {
            BlockWidget w = (BlockWidget) findWidget(b);
            Rectangle r = new Rectangle(w.getBounds());
            r.setLocation(w.getLocation());
            if (r.intersects(rectangle)) {
                if (!selection.contains(w)) {
                    changed = true;
                    selection.add(w);
                    w.setState(w.getState().deriveSelected(true));
                }
            } else {
                if (selection.contains(w)) {
                    changed = true;
                    selection.remove(w);
                    w.setState(w.getState().deriveSelected(false));
                }
            }
        }

        if (changed) {
            selectionChanged();
        }

    }
 
Example #14
Source File: Diagram.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void updateBlocks() {
    blocks.clear();
    for (InputBlock b : graph.getBlocks()) {
        Block curBlock = new Block(b, this);
        blocks.put(b, curBlock);
    }
}
 
Example #15
Source File: BlockWidget.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public BlockWidget(Scene scene, Diagram d, InputBlock blockNode) {
    super(scene);
    this.blockNode = blockNode;
    this.diagram = d;
    this.setBackground(BACKGROUND_COLOR);
    this.setOpaque(true);
    this.setCheckClipping(true);
}
 
Example #16
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void buildCommonDominators() {
    commonDominator = new InputBlock[this.blocks.size()][this.blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        for (int j = 0; j < blocks.size(); j++) {
            commonDominator[i][j] = getCommonDominator(i, j);
        }
    }
}
 
Example #17
Source File: BlockWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #18
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Collection<InputBlock> schedule(InputGraph graph) {
    if (graph.getBlocks().size() > 0) {
        Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
        for (InputNode n : tmpNodes) {
            String block = getBlockName(n);
            if (graph.getBlock(n) == null) {
                graph.getBlock(block).addNode(n);
                assert graph.getBlock(n) != null;
            }
        }
        return graph.getBlocks();
    } else {
        nodes = new ArrayList<Node>();
        inputNodeToNode = new HashMap<InputNode, Node>();

        this.graph = graph;
        buildUpGraph();
        buildBlocks();
        buildDominators();
        buildCommonDominators();
        scheduleLatest();

        for (InputNode n : graph.getNodes()) {
            assert graph.getBlock(n) != null;
        }

        return blocks;
    }
}
 
Example #19
Source File: Parser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputBlock start() throws SAXException {
    String s = readRequiredAttribute(NODE_ID_PROPERTY);

    int id = 0;
    try {
        id = lookupID(s);
    } catch (NumberFormatException e) {
        throw new SAXException(e);
    }
    getParentObject().addNode(id);
    return getParentObject();
}
 
Example #20
Source File: Parser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputBlock start() throws SAXException {
    InputGraph graph = getParentObject();
    String name = readRequiredAttribute(BLOCK_NAME_PROPERTY).intern();
    InputBlock b = new InputBlock(getParentObject(), name);
    graph.addBlock(b);
    return b;
}
 
Example #21
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void markWithBlock(Node n, InputBlock b, Set<Node> reachable) {
    assert !reachable.contains(n);
    Stack<Node> stack = new Stack<Node>();
    stack.push(n);
    n.block = b;
    b.addNode(n.inputNode.getId());
    reachable.add(n);

    while (!stack.isEmpty()) {
        Node cur = stack.pop();
        for (Node s : cur.succs) {
            if (!reachable.contains(s)) {
                reachable.add(s);
                s.block = b;
                b.addNode(s.inputNode.getId());
                stack.push(s);
            }
        }

        for (Node s : cur.preds) {
            if (!reachable.contains(s)) {
                reachable.add(s);
                s.block = b;
                b.addNode(s.inputNode.getId());
                stack.push(s);
            }
        }
    }
}
 
Example #22
Source File: Source.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean isInBlock(InputGraph g, InputBlock blockNode) {

        for (InputNode n : this.getSourceNodes()) {
            if (g.getBlock(n) == blockNode) {
                return true;
            }
        }
        return false;
    }
 
Example #23
Source File: Diagram.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void updateBlocks() {
    blocks.clear();
    for (InputBlock b : graph.getBlocks()) {
        Block curBlock = new Block(b, this);
        blocks.put(b, curBlock);
    }
}
 
Example #24
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Collection<InputBlock> schedule(InputGraph graph) {
    if (graph.getBlocks().size() > 0) {
        Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
        for (InputNode n : tmpNodes) {
            String block = getBlockName(n);
            if (graph.getBlock(n) == null) {
                graph.getBlock(block).addNode(n);
                assert graph.getBlock(n) != null;
            }
        }
        return graph.getBlocks();
    } else {
        nodes = new ArrayList<Node>();
        inputNodeToNode = new HashMap<InputNode, Node>();

        this.graph = graph;
        buildUpGraph();
        buildBlocks();
        buildDominators();
        buildCommonDominators();
        scheduleLatest();

        for (InputNode n : graph.getNodes()) {
            assert graph.getBlock(n) != null;
        }

        return blocks;
    }
}
 
Example #25
Source File: ControlFlowScene.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected void attachEdgeSourceAnchor(InputBlockEdge edge, InputBlock oldSourceNode, InputBlock sourceNode) {
    Widget w = this.findWidget(edge);
    assert w instanceof ConnectionWidget;
    ConnectionWidget cw = (ConnectionWidget) w;
    cw.setSourceAnchor(AnchorFactory.createRectangularAnchor(findWidget(sourceNode)));

}
 
Example #26
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void buildCommonDominators() {
    commonDominator = new InputBlock[this.blocks.size()][this.blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        for (int j = 0; j < blocks.size(); j++) {
            commonDominator[i][j] = getCommonDominator(i, j);
        }
    }
}
 
Example #27
Source File: ControlFlowScene.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void performSelection(Rectangle rectangle) {

        if (rectangle.width < 0) {
            rectangle.x += rectangle.width;
            rectangle.width *= -1;
        }

        if (rectangle.height < 0) {
            rectangle.y += rectangle.height;
            rectangle.height *= -1;
        }

        boolean changed = false;
        for (InputBlock b : this.getNodes()) {
            BlockWidget w = (BlockWidget) findWidget(b);
            Rectangle r = new Rectangle(w.getBounds());
            r.setLocation(w.getLocation());
            if (r.intersects(rectangle)) {
                if (!selection.contains(w)) {
                    changed = true;
                    selection.add(w);
                    w.setState(w.getState().deriveSelected(true));
                }
            } else {
                if (selection.contains(w)) {
                    changed = true;
                    selection.remove(w);
                    w.setState(w.getState().deriveSelected(false));
                }
            }
        }

        if (changed) {
            selectionChanged();
        }

    }
 
Example #28
Source File: BlockWidget.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #29
Source File: ServerCompilerScheduler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void buildCommonDominators() {
    commonDominator = new InputBlock[this.blocks.size()][this.blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        for (int j = 0; j < blocks.size(); j++) {
            commonDominator[i][j] = getCommonDominator(i, j);
        }
    }
}
 
Example #30
Source File: ServerCompilerScheduler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Collection<InputBlock> schedule(InputGraph graph) {
    if (graph.getBlocks().size() > 0) {
        Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
        for (InputNode n : tmpNodes) {
            String block = getBlockName(n);
            if (graph.getBlock(n) == null) {
                graph.getBlock(block).addNode(n);
                assert graph.getBlock(n) != null;
            }
        }
        return graph.getBlocks();
    } else {
        nodes = new ArrayList<Node>();
        inputNodeToNode = new HashMap<InputNode, Node>();

        this.graph = graph;
        buildUpGraph();
        buildBlocks();
        buildDominators();
        buildCommonDominators();
        scheduleLatest();

        for (InputNode n : graph.getNodes()) {
            assert graph.getBlock(n) != null;
        }

        return blocks;
    }
}