Package serp.bytecode
Class Local
java.lang.Object
serp.bytecode.Local
- All Implemented Interfaces:
BCEntity,InstructionPtr
- Direct Known Subclasses:
LocalVariable,LocalVariableType
A local variable or local variable type.
- Author:
- Abe White, Sakir Murat Cengiz
-
Method Summary
Modifier and TypeMethodDescriptionReturn the class loader to use when loading related classes.getCode()Returns the Code block that owns the Instruction(s) this InstructionPtr points to.getEnd()The lastInstructionfor which this local is in scope.intGet the number of bytes for which this local has a value in the code byte array.intgetLocal()Get the local variable index of the current frame for this local.getName()Return the name of this local, or null if unset.intReturn theConstantPoolindex of theUTF8Entrythat describes the name of this local.intgetParam()Return the parameter that this local corresponds to, or -1 if none.getPool()Return the constant pool of the current class.Return the project of the current class.getStart()Return the instruction marking the beginning of this local.intReturn the index into the code byte array at which this local starts.getTable()The owning table.intReturn theConstantPoolindex of theUTF8Entrythat describes this local.Return the full name of the local's type, or null if unset.booleanisValid()Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.voidreplaceTarget(Instruction oldTarget, Instruction newTarget) Replace the given old, likely invalid, target with a new target.voidsetEnd(Instruction end) Set the lastInstructionfor which this local is in scope.voidsetLength(int length) Set the number of bytes for which this local has a value in the code byte array.voidsetLocal(int index) Set the local variable index of the current frame for this local.voidSet the name of this inner local.voidsetNameIndex(int nameIndex) Set theConstantPoolindex of theUTF8Entrythat describes the name of this local.voidsetParam(int param) Set the method parameter that this local corresponds to.voidsetStart(Instruction instruction) Set theInstructionmarking the beginning this local.voidsetStartPc(int startPc) Set the index into the code byte array at which this local starts.voidSet the type of this local.voidsetTypeIndex(int index) Set theConstantPoolindex of theUTF8Entrythat describes this local.voidUse the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr.
-
Method Details
-
getTable
The owning table. -
getLocal
public int getLocal()Get the local variable index of the current frame for this local. -
setLocal
public void setLocal(int index) Set the local variable index of the current frame for this local. -
getParam
public int getParam()Return the parameter that this local corresponds to, or -1 if none. -
setParam
public void setParam(int param) Set the method parameter that this local corresponds to. -
getStartPc
public int getStartPc()Return the index into the code byte array at which this local starts. -
getStart
Return the instruction marking the beginning of this local. -
setStartPc
public void setStartPc(int startPc) Set the index into the code byte array at which this local starts. -
setStart
Set theInstructionmarking the beginning this local. The instruction must already be a part of the method. WARNING: if this instruction is deleted, the results are undefined. -
getEnd
The lastInstructionfor which this local is in scope. -
getLength
public int getLength()Get the number of bytes for which this local has a value in the code byte array. -
setEnd
Set the lastInstructionfor which this local is in scope. The instruction must already be a part of the method. WARNING: if this instruction is deleted, the results are undefined. -
setLength
public void setLength(int length) Set the number of bytes for which this local has a value in the code byte array. -
updateTargets
public void updateTargets()Description copied from interface:InstructionPtrUse the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr. This method will be called after the byte code has been read in for the first time and before it is written after modification.- Specified by:
updateTargetsin interfaceInstructionPtr
-
replaceTarget
Description copied from interface:InstructionPtrReplace the given old, likely invalid, target with a new target. The new target Instruction is guaranteed to be in the same code block as this InstructionPtr.- Specified by:
replaceTargetin interfaceInstructionPtr
-
getNameIndex
public int getNameIndex()Return theConstantPoolindex of theUTF8Entrythat describes the name of this local. Defaults to 0. -
setNameIndex
public void setNameIndex(int nameIndex) Set theConstantPoolindex of theUTF8Entrythat describes the name of this local. -
getName
Return the name of this local, or null if unset. -
setName
Set the name of this inner local. -
getTypeIndex
public int getTypeIndex()Return theConstantPoolindex of theUTF8Entrythat describes this local. Defaults to 0. -
setTypeIndex
public void setTypeIndex(int index) Set theConstantPoolindex of theUTF8Entrythat describes this local. -
getTypeName
Return the full name of the local's type, or null if unset. -
setType
Set the type of this local. -
getProject
Description copied from interface:BCEntityReturn the project of the current class.- Specified by:
getProjectin interfaceBCEntity
-
getPool
Description copied from interface:BCEntityReturn the constant pool of the current class. -
getClassLoader
Description copied from interface:BCEntityReturn the class loader to use when loading related classes.- Specified by:
getClassLoaderin interfaceBCEntity
-
isValid
public boolean isValid()Description copied from interface:BCEntityReturn false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined. -
getCode
Description copied from interface:InstructionPtrReturns the Code block that owns the Instruction(s) this InstructionPtr points to.- Specified by:
getCodein interfaceInstructionPtr
-