public class Subroutines
extends java.lang.Object
getTopLevel()
Modifier and Type | Class and Description |
---|---|
private class |
Subroutines.SubroutineImpl
This inner class implements the Subroutine interface.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.Integer |
BLACK |
private static java.lang.Integer |
GRAY |
private java.util.Map<InstructionHandle,Subroutine> |
subroutines
The map containing the subroutines found.
|
Subroutine |
TOPLEVEL
This is referring to a special subroutine, namely the
top level.
|
private static java.lang.Integer |
WHITE |
Constructor and Description |
---|
Subroutines(MethodGen mg)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Subroutine |
getSubroutine(InstructionHandle leader)
Returns the Subroutine object associated with the given
leader (that is, the first instruction of the subroutine).
|
private static InstructionHandle[] |
getSuccessors(InstructionHandle instruction)
A utility method that calculates the successors of a given InstructionHandle
in the same subroutine.
|
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(Subroutine sub,
java.util.Set<java.lang.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).
|
Subroutine |
subroutineOf(InstructionHandle any)
Returns the subroutine object associated with the
given instruction.
|
java.lang.String |
toString()
Returns a String representation of this object; merely for debugging puposes.
|
private static final java.lang.Integer WHITE
private static final java.lang.Integer GRAY
private static final java.lang.Integer BLACK
private java.util.Map<InstructionHandle,Subroutine> subroutines
public final Subroutine TOPLEVEL
public Subroutines(MethodGen mg)
mg
- A MethodGen object representing method to
create the Subroutine objects of.private void noRecursiveCalls(Subroutine sub, java.util.Set<java.lang.Integer> set)
StructuralCodeConstraintException
- if the above constraint is not satisfied.public Subroutine getSubroutine(InstructionHandle leader)
getTopLevel()
public Subroutine subroutineOf(InstructionHandle any)
getSubroutine(InstructionHandle)
,
getTopLevel()
public Subroutine getTopLevel()
private static InstructionHandle[] getSuccessors(InstructionHandle instruction)
public java.lang.String toString()
toString
in class java.lang.Object