Todo
refer to the paper.
getTopLevel()
| Modifier and Type | Class and Description |
|---|---|
| private static enum | |
| private class | Subroutines.SubroutineImpl
This inner class implements the Subroutine interface. |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | subroutines
The map containing the subroutines found. |
| public final Subroutine | TOPLEVEL
This is referring to a special subroutine, namely the top level. |
| Access | Constructor and Description |
|---|---|
| public | Subroutines(final MethodGen
A MethodGen object representing method to create the Subroutine objects of. Assumes that JustIce strict
checks are needed. mg)Constructs a new instance. |
| public | Subroutines(final MethodGen
A MethodGen object representing method to create the Subroutine objects of. mg, final boolean whether to enable additional JustIce checks enableJustIceCheck)Constructs a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public Subroutine | getSubroutine(final InstructionHandle leader)
Returns the Subroutine object associated with the given leader (that is, the first instruction of the subroutine). |
| private static InstructionHandle[] | getSuccessors(final InstructionHandle instruction)
A utility method that calculates the successors of a given InstructionHandle in the same subroutine. |
| public Subroutine | getTopLevel()
For easy handling, the piece of code that is not a subroutine, the top-level, is also modeled as a Subroutine object. |
| private void | noRecursiveCalls(final Subroutine sub, final Set<Integer> set)
This (recursive) utility method makes sure that no subroutine is calling a subroutine that uses the same local variable for the RET as themselves (recursively). |
| public Subroutine | subroutineOf(final InstructionHandle any)
Returns the subroutine object associated with the given instruction. |
| public String | toString()
Overrides java. |
| subroutines | back to summary |
|---|---|
| private final Map<InstructionHandle, Subroutine> subroutines The map containing the subroutines found. Key: InstructionHandle of the leader of the subroutine. Elements: SubroutineImpl objects. | |
| TOPLEVEL | back to summary |
|---|---|
| public final Subroutine TOPLEVEL This is referring to a special subroutine, namely the top level. This is not really a subroutine but we use it to distinguish between top level instructions and unreachable instructions. | |
| Subroutines | back to summary |
|---|---|
| public Subroutines(final MethodGen mg) Constructs a new instance.
| |
| Subroutines | back to summary |
|---|---|
| public Subroutines(final MethodGen mg, final boolean enableJustIceCheck) Constructs a new instance.
| |
| getSubroutine | back to summary |
|---|---|
| public Subroutine getSubroutine(final InstructionHandle leader) Returns the Subroutine object associated with the given leader (that is, the first instruction of the subroutine). You must not use this to get the top-level instructions modeled as a Subroutine object.
| |
| getSuccessors | back to summary |
|---|---|
| private static InstructionHandle[] getSuccessors(final InstructionHandle instruction) A utility method that calculates the successors of a given InstructionHandle in the same subroutine. That means, a RET does not have any successors as defined here. A JsrInstruction has its physical successor as its successor (opposed to its target) as defined here. | |
| getTopLevel | back to summary |
|---|---|
| public Subroutine getTopLevel() For easy handling, the piece of code that is not a subroutine, the top-level, is also modeled as a Subroutine object. It is a special Subroutine object where you must not invoke getEnteringJsrInstructions() or getLeavingRET(). | |
| noRecursiveCalls | back to summary |
|---|---|
| private void noRecursiveCalls(final Subroutine sub, final Set<Integer> set) This (recursive) utility method makes sure that no subroutine is calling a subroutine that uses the same local variable for the RET as themselves (recursively). This includes that subroutines may not call themselves recursively, even not through intermediate calls to other subroutines.
| |
| subroutineOf | back to summary |
|---|---|
| public Subroutine subroutineOf(final InstructionHandle any) Returns the subroutine object associated with the given instruction. This is a costly operation, you should consider using getSubroutine(InstructionHandle). Returns 'null' if the given InstructionHandle lies in so-called 'dead code', i.e. code that can never be executed. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a String representation of this object; merely for debugging puposes.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Subroutines. | |
| public static final Subroutines. | |
| public static final Subroutines. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Subroutines. | |
| public static Subroutines. |
| BLACK | back to summary |
|---|---|
| public static final Subroutines. | |
| GRAY | back to summary |
|---|---|
| public static final Subroutines. | |
| WHITE | back to summary |
|---|---|
| public static final Subroutines. | |
| ColourConstants | back to summary |
|---|---|
| private ColourConstants() | |
| valueOf | back to summary |
|---|---|
| public static Subroutines. | |
| values | back to summary |
|---|---|
| public static Subroutines. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Subroutines. | |
| private final 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 final 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. |
| private static final int | UNSET
UNSET, a symbol for an uninitialized localVariable field. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addEnteringJsrInstruction(final InstructionHandle jsrInst)
Adds a new JSR or JSR_W that has this subroutine as its target. |
| pack-priv void | |
| public boolean | contains(final InstructionHandle
The InstructionHandle to test. inst)Implements org. |
| public int[] | getAccessedLocalsIndices()
Implements org. |
| public InstructionHandle[] | getEnteringJsrInstructions()
Implements org. |
| public InstructionHandle[] | getInstructions()
Implements org. |
| public InstructionHandle | getLeavingRET()
Implements org. |
| public int[] | getRecursivelyAccessedLocalsIndices()
Implements org. |
| private void | getRecursivelyAccessedLocalsIndicesHelper(final Set<Integer> set, final Subroutine[] subs)
A recursive helper method for getRecursivelyAccessedLocalsIndices(). |
| pack-priv void | |
| pack-priv void | |
| public Subroutine[] | subSubs()
Implements org. |
| public String | toString()
Overrides java. |
| EMPTY_ARRAY | back to summary |
|---|---|
| private final Subroutines. | |
| instructions | back to summary |
|---|---|
| private final Set<InstructionHandle> instructions The instructions that belong to this subroutine. | |
| localVariable | back to summary |
|---|---|
| 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 | back to summary |
|---|---|
| private final Set<InstructionHandle> theJSRs The JSR or JSR_W instructions that define this subroutine by targeting it. | |
| theRET | back to summary |
|---|---|
| private InstructionHandle theRET The RET instruction that leaves this subroutine. | |
| UNSET | back to summary |
|---|---|
| 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. | |
| SubroutineImpl | back to summary |
|---|---|
| public SubroutineImpl() The default constructor. | |
| addEnteringJsrInstruction | back to summary |
|---|---|
| public void addEnteringJsrInstruction(final InstructionHandle jsrInst) Adds a new JSR or JSR_W that has this subroutine as its target. | |
| addInstruction | back to summary |
|---|---|
| pack-priv void addInstruction(final InstructionHandle ih) | |
| contains | back to summary |
|---|---|
| public boolean contains(final InstructionHandle inst) Implements org. Doc from org. Returns if the given InstructionHandle refers to an instruction that is part of this subroutine. This is a convenience method that saves iteration over the InstructionHandle objects returned by getInstructions().
| |
| getAccessedLocalsIndices | back to summary |
|---|---|
| public int[] getAccessedLocalsIndices() Implements org. Doc from org. 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.
| |
| getEnteringJsrInstructions | back to summary |
|---|---|
| public InstructionHandle[] getEnteringJsrInstructions() Implements org. Doc from org. Returns all the JsrInstructions that have the first instruction of this subroutine as their target. Must not be invoked on the 'top-level subroutine'.
| |
| getInstructions | back to summary |
|---|---|
| public InstructionHandle[] getInstructions() Implements org. Doc from org. Returns all instructions that together form this subroutine. Note that an instruction is part of exactly one subroutine (the top-level code is considered to be a special subroutine) - else it is not reachable at all (dead code).
| |
| getLeavingRET | back to summary |
|---|---|
| public InstructionHandle getLeavingRET() Implements org. Doc from org. Returns the one and only RET that leaves the subroutine. Note that JustIce has a pretty rigid notion of a subroutine. Must not be invoked on the 'top-level subroutine'.
| |
| getRecursivelyAccessedLocalsIndices | back to summary |
|---|---|
| public int[] getRecursivelyAccessedLocalsIndices() Implements org. Doc from org. 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.
| |
| getRecursivelyAccessedLocalsIndicesHelper | back to summary |
|---|---|
| private void getRecursivelyAccessedLocalsIndicesHelper(final Set<Integer> set, final Subroutine[] subs) A recursive helper method for getRecursivelyAccessedLocalsIndices(). | |
| setLeavingRET | back to summary |
|---|---|
| pack-priv void setLeavingRET() Sets the leaving RET instruction. Must be invoked after all instructions are added. Must not be invoked for top-level 'subroutine'. | |
| setLocalVariable | back to summary |
|---|---|
| pack-priv void setLocalVariable(final int i) | |
| subSubs | back to summary |
|---|---|
| public Subroutine[] subSubs() Implements org. Doc from org. Returns the subroutines that are directly called from this subroutine.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. 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.
| |