org.apache.bcel.verifier.structurals

Class Subroutines.SubroutineImpl

Enclosing Class:
Subroutines
Implemented Interfaces:
Subroutine

private class Subroutines.SubroutineImpl
extends java.lang.Object
implements Subroutine

This inner class implements the Subroutine interface.

Field Summary

private static int
UNSET
UNSET, a symbol for an uninitialized localVariable field.
private Set
instructions
The instructions that belong to this subroutine.
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.
private Set
theJSRs
The JSR or JSR_W instructions that define this subroutine by targeting it.
private InstructionHandle
theRET
The RET instruction that leaves this subroutine.

Constructor Summary

SubroutineImpl()
The default constructor.

Method Summary

private void
_getRecursivelyAccessedLocalsIndicesHelper(Set s, Subroutine[] subs)
A recursive helper method for getRecursivelyAccessedLocalsIndices().
void
addEnteringJsrInstruction(InstructionHandle jsrInst)
Adds a new JSR or JSR_W that has this subroutine as its target.
(package private) void
addInstruction(InstructionHandle ih)
boolean
contains(InstructionHandle inst)
int[]
getAccessedLocalsIndices()
InstructionHandle[]
getEnteringJsrInstructions()
InstructionHandle[]
getInstructions()
InstructionHandle
getLeavingRET()
int[]
getRecursivelyAccessedLocalsIndices()
(package private) void
setLeavingRET()
Sets the leaving RET instruction.
(package private) void
setLocalVariable(int i)
Subroutine[]
subSubs()
String
toString()
Returns a String representation of this object, merely for debugging purposes.

Field Details

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.
Field Value:
-1

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.

Constructor Details

SubroutineImpl

public SubroutineImpl()
The default constructor.

Method Details

_getRecursivelyAccessedLocalsIndicesHelper

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

addEnteringJsrInstruction

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

addInstruction

(package private)  void addInstruction(InstructionHandle ih)

contains

public boolean contains(InstructionHandle inst)
Specified by:
contains in interface Subroutine

getAccessedLocalsIndices

public int[] getAccessedLocalsIndices()
Specified by:
getAccessedLocalsIndices in interface Subroutine

getEnteringJsrInstructions

public InstructionHandle[] getEnteringJsrInstructions()
Specified by:
getEnteringJsrInstructions in interface Subroutine

getInstructions

public InstructionHandle[] getInstructions()
Specified by:
getInstructions in interface Subroutine

getLeavingRET

public InstructionHandle getLeavingRET()
Specified by:
getLeavingRET in interface Subroutine

getRecursivelyAccessedLocalsIndices

public int[] getRecursivelyAccessedLocalsIndices()
Specified by:
getRecursivelyAccessedLocalsIndices in interface Subroutine

setLeavingRET

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

setLocalVariable

(package private)  void setLocalVariable(int i)

subSubs

public Subroutine[] subSubs()
Specified by:
subSubs in interface Subroutine

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.