|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.Util.LightBasicBlocks.LightBasicBlock
public class LightBasicBlock
LightBasicBlock
is designed as a compact version of a
BasicBlock
. The next and the previous basic blocks, as well
as the composing instructions are stored in arrays, instead of expensive
Set
s. The traversal of these structures is far cheaper that
the equaivalent operation on BasicBlock
s: no
Iterator
object need to be dynamically created, it's juat an
integer index.
Use: To obtain the LightBasicBlock
s of a
given method, you have to obtain a
BasicBlock.Factory
for that method and pass it to
LightBasicBlock.Factory
.
If the "quad-with-try" IR is used, the light basic blocks contain info about the handlers that handle the exceptions that could be thrown by the instructions from each light basic block.
Note: The interface might seem minimal but I recommend that
you use it instead of adding some other methods. For example, one might
complain that there are no methods to return the number of predecessors,
nor the i
-th predecessor. Here is why: you are expected to
traverse the list of predecessors in the cheapest way: extract the array
of predecessors and then do a for whose condition looks something like
i<pred.length
instead of i<lbb.predLength()
(one method call per iteration!).
Nested Class Summary | |
---|---|
static class |
LightBasicBlock.Factory
Converts the large, set based, basic blocks produced by a BasicBlock.Factory into smaller, array based,
light basic blocks. |
Field Summary | |
---|---|
String |
str
|
Object |
user_info
Deprecated. |
Method Summary | |
---|---|
HCodeElement[] |
getElements()
Returns the inctructions in this basic block. |
HCodeElement |
getFirstElement()
Returns the first instruction from this basic block. |
int |
getHandlerStartIndex()
Returns the index of the first handler into the array of next (light) basic blocks. |
HCodeElement |
getLastElement()
Returns the last instruction from this basic block. |
LightBasicBlock[] |
getNextLBBs()
Returns the array of successor light basic blocks. |
LightBasicBlock[] |
getPrevLBBs()
Returns the array of predecessor light basic blocks. |
int |
getProtectedStartIndex()
Returns the index of the first protected basic block in the array of (light) basic blocks. |
String |
toString()
String representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Object user_info
public String str
Method Detail |
---|
public final LightBasicBlock[] getNextLBBs()
getHandlerStartIndex()
on (including
that position), the entries of the returned array point to
light basic blocks corresponding to the handlers for the
instructions of this (light) basic block. The handlers appear
in the order in which they catch exceptions. The exit point of
the method is considered to be the default handler (any
uncaught exception is sent to the caller).
public final int getHandlerStartIndex()
getNextLBBs
public final LightBasicBlock[] getPrevLBBs()
HANDLER
instruction, the
entries of the returned array starting from position
getProtectedStartIndex()
on (including that
position) point to the light basic block composed of
instructions which are protected by this this
basic block. The end of the method is the only basic block
that has both normal flow predecessors and protected basic
blocks (any uncaught exception is passed down to the
caller).
public final int getProtectedStartIndex()
getPrevLBBs
public final HCodeElement[] getElements()
this
basic block.
public final HCodeElement getFirstElement()
this
basic block.
public final HCodeElement getLastElement()
this
basic block.
public final String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |