org.apache.bcel.verifier.structurals

Class Subroutines.SubroutineImpl

private class Subroutines.SubroutineImpl extends Object implements Subroutine

This inner class implements the Subroutine interface.
Field Summary
Setinstructions
The instructions that belong to this subroutine.
intlocalVariable
The Local Variable slot where the first instruction of this subroutine (an ASTORE) stores the JsrInstruction's ReturnAddress in and the RET of this subroutine operates on.
SettheJSRs
The JSR or JSR_W instructions that define this subroutine by targeting it.
InstructionHandletheRET
The RET instruction that leaves this subroutine.
static intUNSET
UNSET, a symbol for an uninitialized localVariable field.
Constructor Summary
SubroutineImpl()
The default constructor.
Method Summary
voidaddEnteringJsrInstruction(InstructionHandle jsrInst)
Adds a new JSR or JSR_W that has this subroutine as its target.
voidaddInstruction(InstructionHandle ih)
booleancontains(InstructionHandle inst)
int[]getAccessedLocalsIndices()
InstructionHandle[]getEnteringJsrInstructions()
InstructionHandle[]getInstructions()
InstructionHandlegetLeavingRET()
int[]getRecursivelyAccessedLocalsIndices()
voidsetLeavingRET()
Sets the leaving RET instruction.
voidsetLocalVariable(int i)
Subroutine[]subSubs()
StringtoString()
Returns a String representation of this object, merely for debugging purposes.
void_getRecursivelyAccessedLocalsIndicesHelper(Set s, Subroutine[] subs)
A recursive helper method for getRecursivelyAccessedLocalsIndices().

Field Detail

instructions

private Set instructions
The instructions that belong to this subroutine.

localVariable

private int localVariable
The Local Variable slot where the first instruction of this subroutine (an ASTORE) stores the JsrInstruction's ReturnAddress in and the RET of this subroutine operates on.

theJSRs

private Set theJSRs
The JSR or JSR_W instructions that define this subroutine by targeting it.

theRET

private InstructionHandle theRET
The RET instruction that leaves this subroutine.

UNSET

private static final int UNSET
UNSET, a symbol for an uninitialized localVariable field. This is used for the "top-level" Subroutine; i.e. no subroutine.

Constructor Detail

SubroutineImpl

public SubroutineImpl()
The default constructor.

Method Detail

addEnteringJsrInstruction

public void addEnteringJsrInstruction(InstructionHandle jsrInst)
Adds a new JSR or JSR_W that has this subroutine as its target.

addInstruction

void addInstruction(InstructionHandle ih)

contains

public boolean contains(InstructionHandle inst)

getAccessedLocalsIndices

public int[] getAccessedLocalsIndices()

getEnteringJsrInstructions

public InstructionHandle[] getEnteringJsrInstructions()

getInstructions

public InstructionHandle[] getInstructions()

getLeavingRET

public InstructionHandle getLeavingRET()

getRecursivelyAccessedLocalsIndices

public int[] getRecursivelyAccessedLocalsIndices()

setLeavingRET

void setLeavingRET()
Sets the leaving RET instruction. Must be invoked after all instructions are added. Must not be invoked for top-level 'subroutine'.

setLocalVariable

void setLocalVariable(int i)

subSubs

public Subroutine[] subSubs()

toString

public String toString()
Returns a String representation of this object, merely for debugging purposes. (Internal) Warning: Verbosity on a problematic subroutine may cause stack overflow errors due to recursive subSubs() calls. Don't use this, then.

_getRecursivelyAccessedLocalsIndicesHelper

private void _getRecursivelyAccessedLocalsIndicesHelper(Set s, Subroutine[] subs)
A recursive helper method for getRecursivelyAccessedLocalsIndices().

See Also: getRecursivelyAccessedLocalsIndices