org.jikesrvm.compilers.baseline
Class BasicBlock

java.lang.Object
  extended by org.jikesrvm.compilers.baseline.BasicBlock

final class BasicBlock
extends Object

Structure to describe the basic blocks of the byte code Used in calculating stack map and local variable map for the garbage collector.


Field Summary
private  int blockNumber
          ID number (index into block array)
private  int end
          ending byte in byte code array
static int EXITBLOCK
           
(package private) static byte INJSR
           
(package private) static byte JSRENTRY
           
(package private) static byte JSREXIT
           
(package private) static byte METHODENTRY
           
static int NOTBLOCK
           
private  short pred1
           
private  short pred2
           
private  int predcount
          number of preceding basic blocks
private  short[] restPredecessors
          list of rest preceding basic blocks
private  int start
          starting byte in byte code array
static int STARTBBNUMBER
           
static int STARTPREDSIZE
           
private  byte state
          additional state info for jsr handling, and other flags
(package private) static byte TRYBLOCK
           
(package private) static byte TRYHANDLERSTART
           
(package private) static byte TRYSTART
           
 
Constructor Summary
BasicBlock(int startval, int bn)
          This should be called only from the factory.
BasicBlock(int startval, int endval, int blockNumber)
          This should be used when building the EXIT block EXIT is likely to have several predecessors.
 
Method Summary
 void addPredecessor(BasicBlock predbb)
           
 void addUniquePredecessor(BasicBlock predbb)
          This method first checks if a block is already on the predecessor list.
 int getBlockNumber()
           
 int getEnd()
           
 int[] getPredecessors()
           
 int getStart()
           
 byte getState()
           
 boolean isInJSR()
           
 boolean isJSREntry()
           
 boolean isJSRExit()
           
 boolean isMethodEntry()
           
 boolean isTryBlock()
           
 boolean isTryHandlerStart()
           
 boolean isTryStart()
           
(package private)  void setEnd(int endval)
           
(package private)  void setStart(int startval)
           
(package private)  void setState(byte stateval)
           
static void transferPredecessors(BasicBlock fromBB, BasicBlock toBB)
          transfer predecessor blocks from one block to another
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTBLOCK

public static final int NOTBLOCK
See Also:
Constant Field Values

EXITBLOCK

public static final int EXITBLOCK
See Also:
Constant Field Values

STARTPREDSIZE

public static final int STARTPREDSIZE
See Also:
Constant Field Values

STARTBBNUMBER

public static final int STARTBBNUMBER
See Also:
Constant Field Values

JSRENTRY

static final byte JSRENTRY
See Also:
Constant Field Values

JSREXIT

static final byte JSREXIT
See Also:
Constant Field Values

METHODENTRY

static final byte METHODENTRY
See Also:
Constant Field Values

TRYSTART

static final byte TRYSTART
See Also:
Constant Field Values

TRYBLOCK

static final byte TRYBLOCK
See Also:
Constant Field Values

INJSR

static final byte INJSR
See Also:
Constant Field Values

TRYHANDLERSTART

static final byte TRYHANDLERSTART
See Also:
Constant Field Values

blockNumber

private final int blockNumber
ID number (index into block array)


start

private int start
starting byte in byte code array


end

private int end
ending byte in byte code array


predcount

private int predcount
number of preceding basic blocks


pred1

private short pred1

pred2

private short pred2

restPredecessors

private short[] restPredecessors
list of rest preceding basic blocks


state

private byte state
additional state info for jsr handling, and other flags

Constructor Detail

BasicBlock

BasicBlock(int startval,
           int bn)
This should be called only from the factory.


BasicBlock

BasicBlock(int startval,
           int endval,
           int blockNumber)
This should be used when building the EXIT block EXIT is likely to have several predecessors.

Method Detail

transferPredecessors

public static void transferPredecessors(BasicBlock fromBB,
                                        BasicBlock toBB)
transfer predecessor blocks from one block to another


setStart

void setStart(int startval)

setEnd

void setEnd(int endval)

setState

void setState(byte stateval)

getStart

public int getStart()

getEnd

public int getEnd()

getBlockNumber

public int getBlockNumber()

getState

public byte getState()

isJSRExit

public boolean isJSRExit()

isJSREntry

public boolean isJSREntry()

isInJSR

public boolean isInJSR()

isMethodEntry

public boolean isMethodEntry()

isTryStart

public boolean isTryStart()

isTryBlock

public boolean isTryBlock()

isTryHandlerStart

public boolean isTryHandlerStart()

addPredecessor

public void addPredecessor(BasicBlock predbb)

addUniquePredecessor

public void addUniquePredecessor(BasicBlock predbb)
This method first checks if a block is already on the predecessor list. Used with try blocks being added to their catch block as predecessors.


getPredecessors

public int[] getPredecessors()