private class Subroutines.SubroutineImpl extends java.lang.Object implements Subroutine
Modifier and Type | Field and Description |
---|---|
private java.util.Set<InstructionHandle> |
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 java.util.Set<InstructionHandle> |
theJSRs
The JSR or JSR_W instructions that define this
subroutine by targeting it.
|
private InstructionHandle |
theRET
The RET instruction that leaves this subroutine.
|
private static int |
UNSET
UNSET, a symbol for an uninitialized localVariable
field.
|
Constructor and Description |
---|
SubroutineImpl()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
_getRecursivelyAccessedLocalsIndicesHelper(java.util.Set<java.lang.Integer> 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)
Returns if the given InstructionHandle refers to an instruction
that is part of this subroutine.
|
int[] |
getAccessedLocalsIndices()
Returns an int[] containing the indices of the local variable slots
accessed by this Subroutine (read-accessed, write-accessed or both);
local variables referenced by subroutines of this subroutine are
not included.
|
InstructionHandle[] |
getEnteringJsrInstructions()
Returns all the JsrInstructions that have the
first instruction of this subroutine as their target.
|
InstructionHandle[] |
getInstructions()
Returns all instructions that together form this subroutine.
|
InstructionHandle |
getLeavingRET()
Returns the one and only RET that leaves the subroutine.
|
int[] |
getRecursivelyAccessedLocalsIndices()
Returns an int[] containing the indices of the local variable slots
accessed by this Subroutine (read-accessed, write-accessed or both);
local variables referenced by subroutines of this subroutine are
included.
|
(package private) void |
setLeavingRET()
Sets the leaving RET instruction.
|
(package private) void |
setLocalVariable(int i) |
Subroutine[] |
subSubs()
Returns the subroutines that are directly called from this subroutine.
|
java.lang.String |
toString()
Returns a String representation of this object, merely
for debugging purposes.
|
private static final int UNSET
private int localVariable
private java.util.Set<InstructionHandle> instructions
private java.util.Set<InstructionHandle> theJSRs
private InstructionHandle theRET
public boolean contains(InstructionHandle inst)
Subroutine
contains
in interface Subroutine
Subroutine.getInstructions()
public java.lang.String toString()
toString
in class java.lang.Object
void setLeavingRET()
public InstructionHandle[] getEnteringJsrInstructions()
Subroutine
getEnteringJsrInstructions
in interface Subroutine
public void addEnteringJsrInstruction(InstructionHandle jsrInst)
public InstructionHandle getLeavingRET()
Subroutine
getLeavingRET
in interface Subroutine
Subroutines
public InstructionHandle[] getInstructions()
Subroutine
getInstructions
in interface Subroutine
void addInstruction(InstructionHandle ih)
public int[] getRecursivelyAccessedLocalsIndices()
Subroutine
getRecursivelyAccessedLocalsIndices
in interface Subroutine
Subroutine.getAccessedLocalsIndices()
private void _getRecursivelyAccessedLocalsIndicesHelper(java.util.Set<java.lang.Integer> s, Subroutine[] subs)
getRecursivelyAccessedLocalsIndices()
public int[] getAccessedLocalsIndices()
Subroutine
getAccessedLocalsIndices
in interface Subroutine
Subroutine.getRecursivelyAccessedLocalsIndices()
public Subroutine[] subSubs()
Subroutine
subSubs
in interface Subroutine
void setLocalVariable(int i)