# HG changeset patch # User Josef Eisl # Date 1394727076 -3600 # Node ID 18d5ffb7ac38662c1098bc551018a072f70b15ba # Parent f5b3292b4ded4a6d599ec0ec5acf0ac906e7a082 Create AbstractBlockBase. diff -r f5b3292b4ded -r 18d5ffb7ac38 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/AbstractBlockBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/AbstractBlockBase.java Thu Mar 13 17:11:16 2014 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 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.nodes.cfg; + +import java.util.*; + +public abstract class AbstractBlockBase> implements AbstractBlock { + + protected int id; + + protected List predecessors; + protected List successors; + + protected T dominator; + + private boolean align; + private int linearScanNumber; + + protected AbstractBlockBase() { + this.id = ControlFlowGraph.BLOCK_ID_INITIAL; + this.linearScanNumber = -1; + } + + public int getId() { + return id; + } + + public List getPredecessors() { + return predecessors; + } + + public List getSuccessors() { + return successors; + } + + public T getDominator() { + return dominator; + } + + @Override + public String toString() { + return "B" + id; + } + + public int getPredecessorCount() { + return getPredecessors().size(); + } + + public int getSuccessorCount() { + return getSuccessors().size(); + } + + public int getLinearScanNumber() { + return linearScanNumber; + } + + public void setLinearScanNumber(int linearScanNumber) { + this.linearScanNumber = linearScanNumber; + } + + public boolean isAligned() { + return align; + } + + public void setAlign(boolean align) { + this.align = align; + } +} diff -r f5b3292b4ded -r 18d5ffb7ac38 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java Thu Mar 13 13:28:09 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java Thu Mar 13 17:11:16 2014 +0100 @@ -27,34 +27,18 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; -public final class Block implements AbstractBlock { +public final class Block extends AbstractBlockBase { protected final AbstractBeginNode beginNode; - protected int id; - protected FixedNode endNode; protected Loop loop; - protected List predecessors; - protected List successors; - - protected Block dominator; protected List dominated; protected Block postdominator; - private boolean align; - private int linearScanNumber; - protected Block(AbstractBeginNode node) { this.beginNode = node; - - this.id = ControlFlowGraph.BLOCK_ID_INITIAL; - this.linearScanNumber = -1; - } - - public int getId() { - return id; } public AbstractBeginNode getBeginNode() { @@ -89,22 +73,10 @@ return predecessors.get(0); } - public List getPredecessors() { - return predecessors; - } - public Block getFirstSuccessor() { return successors.get(0); } - public List getSuccessors() { - return successors; - } - - public Block getDominator() { - return dominator; - } - public Block getEarliestPostDominated() { Block b = this; while (true) { @@ -187,14 +159,6 @@ return "B" + id; } - public int getPredecessorCount() { - return getPredecessors().size(); - } - - public int getSuccessorCount() { - return getSuccessors().size(); - } - public boolean dominates(Block block) { return block.isDominatedBy(this); } @@ -209,19 +173,4 @@ return dominator.isDominatedBy(block); } - public int getLinearScanNumber() { - return linearScanNumber; - } - - public void setLinearScanNumber(int linearScanNumber) { - this.linearScanNumber = linearScanNumber; - } - - public boolean isAligned() { - return align; - } - - public void setAlign(boolean align) { - this.align = align; - } }