Class VariableTable
java.lang.Object
com.offbynull.coroutines.instrumenter.asm.VariableTable
Tracks extra variables used for instrumentation as well as arguments passed in to a method.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classRepresents an entry within the local variable table of a method. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<VariableTable.Variable> private intprivate List<VariableTable.Variable> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateVariableTable(boolean isStatic, org.objectweb.asm.Type objectType, org.objectweb.asm.Type methodType, int maxLocals) VariableTable(org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode methodNode) Constructs aVariableTableobject. -
Method Summary
Modifier and TypeMethodDescriptionacquireExtra(Class<?> type) Equivalent to callingacquireExtra(Type.getType(type)).acquireExtra(org.objectweb.asm.Type type) Acquire a new variable for use when instrumenting some code within the method thisVariableTableis for.intGet number of arguments.getArgument(int index) Get the variable for an argument passed in to the method.voidreleaseExtra(VariableTable.Variable variable) Release a variable that was acquired withacquireExtra(org.objectweb.asm.Type).
-
Field Details
-
argVars
-
extraOffset
private int extraOffset -
extraVars
-
-
Constructor Details
-
VariableTable
public VariableTable(org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode methodNode) Constructs aVariableTableobject.- Parameters:
classNode- class thatmethodeNoderesides inmethodNode- method this variable table is for
-
VariableTable
private VariableTable(boolean isStatic, org.objectweb.asm.Type objectType, org.objectweb.asm.Type methodType, int maxLocals)
-
-
Method Details
-
getArgument
Get the variable for an argument passed in to the method. Remember that if the method is static, arguments start at 0th index in the local variables table. If it isn't static, they start at 1 (0th would be "this").Values returned by this method must never be passed in to
releaseExtra(com.offbynull.coroutines.instrumenter.asm.VariableTable.Variable).- Parameters:
index- index of argument- Returns:
VariableTable.Variableobject that represents the argument- Throws:
IllegalArgumentException- ifindexis not the index of an argument
-
acquireExtra
Equivalent to callingacquireExtra(Type.getType(type)).- Parameters:
type- type which variable is for- Returns:
- new variable
- Throws:
NullPointerException- if any argument isnull
-
acquireExtra
Acquire a new variable for use when instrumenting some code within the method thisVariableTableis for.- Parameters:
type- type which variable is for- Returns:
- new variable
- Throws:
NullPointerException- if any argument isnullIllegalArgumentException- iftypeis of sort ofType.VOIDorType.METHOD
-
releaseExtra
Release a variable that was acquired withacquireExtra(org.objectweb.asm.Type).- Parameters:
variable- variable to release- Throws:
NullPointerException- if any argument isnullIllegalArgumentException- ifvariablewasn't acquired from this object, or ifvariablerefers to an argument, or ifvariablehas already been released
-
getArgCount
public int getArgCount()Get number of arguments.- Returns:
- number of arguments
-