Package proguard.classfile.editor
Class InstructionSequenceBuilder
- java.lang.Object
-
- proguard.classfile.editor.InstructionSequenceBuilder
-
public class InstructionSequenceBuilder extends java.lang.Object
This utility class allows to construct sequences of instructions and their constants.
-
-
Constructor Summary
Constructors Constructor Description InstructionSequenceBuilder()
Creates a new InstructionSequenceBuilder.InstructionSequenceBuilder(ClassPool programClassPool, ClassPool libraryClassPool)
Creates a new InstructionSequenceBuilder that automatically initializes class references and class member references in new constants.InstructionSequenceBuilder(ConstantPoolEditor constantPoolEditor)
Creates a new InstructionSequenceBuilder.InstructionSequenceBuilder(ProgramClass targetClass)
Creates a new InstructionSequenceBuilder.InstructionSequenceBuilder(ProgramClass targetClass, ClassPool programClassPool, ClassPool libraryClassPool)
Creates a new InstructionSequenceBuilder that automatically initializes class references and class member references in new constants.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Instruction[]
__()
Short forinstructions()
.InstructionSequenceBuilder
aaload()
InstructionSequenceBuilder
aastore()
InstructionSequenceBuilder
aconst_null()
InstructionSequenceBuilder
aload(int variableIndex)
InstructionSequenceBuilder
aload_0()
InstructionSequenceBuilder
aload_1()
InstructionSequenceBuilder
aload_2()
InstructionSequenceBuilder
aload_3()
InstructionSequenceBuilder
anewarray(int constantIndex)
InstructionSequenceBuilder
anewarray(java.lang.String elementTypeName, Clazz referencedClass)
InstructionSequenceBuilder
anewarray(Clazz elementType)
InstructionSequenceBuilder
appendInstruction(Instruction instruction)
Appends the given instruction.InstructionSequenceBuilder
appendInstructions(Instruction[] instructions)
Appends the given instructions.InstructionSequenceBuilder
areturn()
InstructionSequenceBuilder
arraylength()
InstructionSequenceBuilder
astore(int variableIndex)
InstructionSequenceBuilder
astore_0()
InstructionSequenceBuilder
astore_1()
InstructionSequenceBuilder
astore_2()
InstructionSequenceBuilder
astore_3()
InstructionSequenceBuilder
athrow()
InstructionSequenceBuilder
baload()
InstructionSequenceBuilder
bastore()
InstructionSequenceBuilder
bipush(int constant)
InstructionSequenceBuilder
boxPrimitiveType(char sourceType)
Box the primitive value present on the stack.InstructionSequenceBuilder
caload()
InstructionSequenceBuilder
castore()
InstructionSequenceBuilder
catch_(Instruction instruction)
Short forappendInstruction(Instruction)
.InstructionSequenceBuilder
checkcast(int constantIndex)
InstructionSequenceBuilder
checkcast(java.lang.String typeName)
InstructionSequenceBuilder
checkcast(java.lang.String typeName, Clazz referencedClass)
InstructionSequenceBuilder
checkcast(Clazz type)
Constant[]
constants()
Returns the accumulated set of constants and resets the set in the builder.InstructionSequenceBuilder
d2f()
InstructionSequenceBuilder
d2i()
InstructionSequenceBuilder
d2l()
InstructionSequenceBuilder
dadd()
InstructionSequenceBuilder
daload()
InstructionSequenceBuilder
dastore()
InstructionSequenceBuilder
dcmpg()
InstructionSequenceBuilder
dcmpl()
InstructionSequenceBuilder
dconst(int constant)
InstructionSequenceBuilder
dconst_0()
InstructionSequenceBuilder
dconst_1()
InstructionSequenceBuilder
ddiv()
InstructionSequenceBuilder
dload(int variableIndex)
InstructionSequenceBuilder
dload_0()
InstructionSequenceBuilder
dload_1()
InstructionSequenceBuilder
dload_2()
InstructionSequenceBuilder
dload_3()
InstructionSequenceBuilder
dmul()
InstructionSequenceBuilder
dneg()
InstructionSequenceBuilder
drem()
InstructionSequenceBuilder
dreturn()
InstructionSequenceBuilder
dstore(int variableIndex)
InstructionSequenceBuilder
dstore_0()
InstructionSequenceBuilder
dstore_1()
InstructionSequenceBuilder
dstore_2()
InstructionSequenceBuilder
dstore_3()
InstructionSequenceBuilder
dsub()
InstructionSequenceBuilder
dup()
InstructionSequenceBuilder
dup_x1()
InstructionSequenceBuilder
dup_x2()
InstructionSequenceBuilder
dup2()
InstructionSequenceBuilder
dup2_x1()
InstructionSequenceBuilder
dup2_x2()
InstructionSequenceBuilder
f2d()
InstructionSequenceBuilder
f2i()
InstructionSequenceBuilder
f2l()
InstructionSequenceBuilder
fadd()
InstructionSequenceBuilder
faload()
InstructionSequenceBuilder
fastore()
InstructionSequenceBuilder
fcmpg()
InstructionSequenceBuilder
fcmpl()
InstructionSequenceBuilder
fconst(int constant)
InstructionSequenceBuilder
fconst_0()
InstructionSequenceBuilder
fconst_1()
InstructionSequenceBuilder
fconst_2()
InstructionSequenceBuilder
fdiv()
InstructionSequenceBuilder
fload(int variableIndex)
InstructionSequenceBuilder
fload_0()
InstructionSequenceBuilder
fload_1()
InstructionSequenceBuilder
fload_2()
InstructionSequenceBuilder
fload_3()
InstructionSequenceBuilder
fmul()
InstructionSequenceBuilder
fneg()
InstructionSequenceBuilder
frem()
InstructionSequenceBuilder
freturn()
InstructionSequenceBuilder
fstore(int variableIndex)
InstructionSequenceBuilder
fstore_0()
InstructionSequenceBuilder
fstore_1()
InstructionSequenceBuilder
fstore_2()
InstructionSequenceBuilder
fstore_3()
InstructionSequenceBuilder
fsub()
ConstantPoolEditor
getConstantPoolEditor()
Returns the ConstantPoolEditor used by this builder to create constants.InstructionSequenceBuilder
getfield(int constantIndex)
InstructionSequenceBuilder
getfield(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
getfield(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
InstructionSequenceBuilder
getfield(Clazz clazz, Field field)
InstructionSequenceBuilder
getstatic(int constantIndex)
InstructionSequenceBuilder
getstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
getstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
InstructionSequenceBuilder
getstatic(Clazz clazz, Field field)
InstructionSequenceBuilder
goto_(int branchOffset)
InstructionSequenceBuilder
goto_w(int branchOffset)
InstructionSequenceBuilder
i2b()
InstructionSequenceBuilder
i2c()
InstructionSequenceBuilder
i2d()
InstructionSequenceBuilder
i2f()
InstructionSequenceBuilder
i2l()
InstructionSequenceBuilder
i2s()
InstructionSequenceBuilder
iadd()
InstructionSequenceBuilder
iaload()
InstructionSequenceBuilder
iand()
InstructionSequenceBuilder
iastore()
InstructionSequenceBuilder
iconst(int constant)
InstructionSequenceBuilder
iconst_0()
InstructionSequenceBuilder
iconst_1()
InstructionSequenceBuilder
iconst_2()
InstructionSequenceBuilder
iconst_3()
InstructionSequenceBuilder
iconst_4()
InstructionSequenceBuilder
iconst_5()
InstructionSequenceBuilder
iconst_m1()
InstructionSequenceBuilder
idiv()
InstructionSequenceBuilder
ifacmpeq(int branchOffset)
InstructionSequenceBuilder
ifacmpne(int branchOffset)
InstructionSequenceBuilder
ifeq(int branchOffset)
InstructionSequenceBuilder
ifge(int branchOffset)
InstructionSequenceBuilder
ifgt(int branchOffset)
InstructionSequenceBuilder
ificmpeq(int branchOffset)
InstructionSequenceBuilder
ificmpge(int branchOffset)
InstructionSequenceBuilder
ificmpgt(int branchOffset)
InstructionSequenceBuilder
ificmple(int branchOffset)
InstructionSequenceBuilder
ificmplt(int branchOffset)
InstructionSequenceBuilder
ificmpne(int branchOffset)
InstructionSequenceBuilder
ifle(int branchOffset)
InstructionSequenceBuilder
iflt(int branchOffset)
InstructionSequenceBuilder
ifne(int branchOffset)
InstructionSequenceBuilder
ifnonnull(int branchOffset)
InstructionSequenceBuilder
ifnull(int branchOffset)
InstructionSequenceBuilder
iinc(int variableIndex, int constant)
InstructionSequenceBuilder
iload(int variableIndex)
InstructionSequenceBuilder
iload_0()
InstructionSequenceBuilder
iload_1()
InstructionSequenceBuilder
iload_2()
InstructionSequenceBuilder
iload_3()
InstructionSequenceBuilder
imul()
InstructionSequenceBuilder
ineg()
InstructionSequenceBuilder
instanceof_(int constantIndex)
InstructionSequenceBuilder
instanceof_(java.lang.String typeName, Clazz referencedClass)
InstructionSequenceBuilder
instanceof_(Clazz type)
Instruction[]
instructions()
Returns the accumulated sequence of instructions and resets the sequence in the builder.InstructionSequenceBuilder
invokedynamic(int constantIndex)
InstructionSequenceBuilder
invokedynamic(int bootStrapMethodIndex, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokedynamic(int bootStrapMethodIndex, java.lang.String name, java.lang.String descriptor, Clazz[] referencedClasses)
InstructionSequenceBuilder
invokeinterface(int constantIndex, int constant)
InstructionSequenceBuilder
invokeinterface(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokeinterface(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
InstructionSequenceBuilder
invokeinterface(Clazz clazz, Method method)
InstructionSequenceBuilder
invokespecial(int constantIndex)
InstructionSequenceBuilder
invokespecial(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokespecial(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
InstructionSequenceBuilder
invokespecial(Clazz clazz, Method method)
InstructionSequenceBuilder
invokespecial_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokespecial_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
InstructionSequenceBuilder
invokespecial_interface(Clazz clazz, Method method)
InstructionSequenceBuilder
invokestatic(int constantIndex)
InstructionSequenceBuilder
invokestatic(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokestatic(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
InstructionSequenceBuilder
invokestatic(Clazz clazz, Method method)
InstructionSequenceBuilder
invokestatic_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokestatic_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
InstructionSequenceBuilder
invokestatic_interface(Clazz clazz, Method method)
InstructionSequenceBuilder
invokevirtual(int constantIndex)
InstructionSequenceBuilder
invokevirtual(int classIndex, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokevirtual(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
invokevirtual(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
InstructionSequenceBuilder
invokevirtual(Clazz clazz, Method method)
InstructionSequenceBuilder
ior()
InstructionSequenceBuilder
irem()
InstructionSequenceBuilder
ireturn()
InstructionSequenceBuilder
ishl()
InstructionSequenceBuilder
ishr()
InstructionSequenceBuilder
istore(int variableIndex)
InstructionSequenceBuilder
istore_0()
InstructionSequenceBuilder
istore_1()
InstructionSequenceBuilder
istore_2()
InstructionSequenceBuilder
istore_3()
InstructionSequenceBuilder
isub()
InstructionSequenceBuilder
iushr()
InstructionSequenceBuilder
ixor()
InstructionSequenceBuilder
jsr(int branchOffset)
InstructionSequenceBuilder
jsr_w(int branchOffset)
InstructionSequenceBuilder
l2d()
InstructionSequenceBuilder
l2f()
InstructionSequenceBuilder
l2i()
InstructionSequenceBuilder
label(Instruction instruction)
Short forappendInstruction(Instruction)
.InstructionSequenceBuilder
ladd()
InstructionSequenceBuilder
laload()
InstructionSequenceBuilder
land()
InstructionSequenceBuilder
lastore()
InstructionSequenceBuilder
lcmp()
InstructionSequenceBuilder
lconst(int constant)
InstructionSequenceBuilder
lconst_0()
InstructionSequenceBuilder
lconst_1()
InstructionSequenceBuilder
ldc(float value)
Appends an ldc instruction that loads a float constant with the given value.InstructionSequenceBuilder
ldc(float value, ConstantVisitor visitor)
Appends an ldc instruction that loads a float constant with the given value.InstructionSequenceBuilder
ldc(int value)
Appends an ldc instruction that loads an integer constant with the given value.InstructionSequenceBuilder
ldc(int value, ConstantVisitor visitor)
Appends an ldc instruction that loads an integer constant with the given value.InstructionSequenceBuilder
ldc(java.lang.Object primitiveArray)
Appends an ldc instruction that loads an (internal) primitive array constant with the given value.InstructionSequenceBuilder
ldc(java.lang.Object primitiveArray, ConstantVisitor visitor)
Appends an ldc instruction that loads an (internal) primitive array constant with the given value.InstructionSequenceBuilder
ldc(java.lang.String string)
Appends an ldc instruction that loads a string constant with the given value.InstructionSequenceBuilder
ldc(java.lang.String typeName, Clazz referencedClass)
Appends an ldc instruction that loads a class constant for the given type name, that references the given class.InstructionSequenceBuilder
ldc(java.lang.String typeName, Clazz referencedClass, ConstantVisitor visitor)
Appends an ldc instruction that loads a class constant for the given type name, that references the given class.InstructionSequenceBuilder
ldc(java.lang.String string, Clazz referencedClass, Member referencedMember)
Appends an ldc instruction that loads a string constant with the given value, that references the given class member.InstructionSequenceBuilder
ldc(java.lang.String string, Clazz referencedClass, Member referencedMember, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given value, that references the given class member.InstructionSequenceBuilder
ldc(java.lang.String string, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given value.InstructionSequenceBuilder
ldc(java.lang.String string, ResourceFile referencedResourceFile)
Appends an ldc instruction that loads a string constant with the given value, that references the given resource file.InstructionSequenceBuilder
ldc(java.lang.String string, ResourceFile referencedResourceFile, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given value, that references the given resource file.InstructionSequenceBuilder
ldc(Clazz clazz)
Appends an ldc instruction that loads a class constant for the given class.InstructionSequenceBuilder
ldc(Clazz clazz, ConstantVisitor visitor)
Appends an ldc instruction that loads a class constant for the given class.InstructionSequenceBuilder
ldc(Clazz clazz, Member member)
Appends an ldc instruction that loads a string constant with the given class member name.InstructionSequenceBuilder
ldc(Clazz clazz, Member member, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given class member name.InstructionSequenceBuilder
ldc(ResourceFile resourceFile)
Appends an ldc instruction that loads a string constant with the given resource file name.InstructionSequenceBuilder
ldc(ResourceFile resourceFile, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given resource file name.InstructionSequenceBuilder
ldc_(int constantIndex)
Appends an ldc instruction that loads the constant at the given index.InstructionSequenceBuilder
ldc_(int constantIndex, ConstantVisitor visitor)
Appends an ldc instruction that loads the constant at the given index.InstructionSequenceBuilder
ldc_w(float value)
Appends an ldc_w instruction that loads a float constant with the given value.InstructionSequenceBuilder
ldc_w(float value, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a float constant with the given value.InstructionSequenceBuilder
ldc_w(int value)
Appends an ldc_w instruction that loads an integer constant with the given value.InstructionSequenceBuilder
ldc_w(int value, ConstantVisitor visitor)
Appends an ldc_w instruction that loads an integer constant with the given value.InstructionSequenceBuilder
ldc_w(java.lang.Object primitiveArray)
Appends an ldc_w instruction that loads an (internal) primitive array constant with the given value.InstructionSequenceBuilder
ldc_w(java.lang.Object primitiveArray, ConstantVisitor visitor)
Appends an ldc_w instruction that loads an (internal) primitive array constant with the given value.InstructionSequenceBuilder
ldc_w(java.lang.String string)
Appends an ldc_w instruction that loads a string constant with the given value.InstructionSequenceBuilder
ldc_w(java.lang.String typeName, Clazz referencedClass)
Appends an ldc_w instruction that loads a class constant for the given type name, that references the given class.InstructionSequenceBuilder
ldc_w(java.lang.String typeName, Clazz referencedClass, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a class constant for the given type name, that references the given class.InstructionSequenceBuilder
ldc_w(java.lang.String string, Clazz referencedClass, Member referencedMember)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given class member.InstructionSequenceBuilder
ldc_w(java.lang.String string, Clazz referencedClass, Member referencedMember, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given class member.InstructionSequenceBuilder
ldc_w(java.lang.String string, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given value.InstructionSequenceBuilder
ldc_w(java.lang.String string, ResourceFile referencedResourceFile)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given resource file.InstructionSequenceBuilder
ldc_w(java.lang.String string, ResourceFile referencedResourceFile, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given resource file.InstructionSequenceBuilder
ldc_w(Clazz clazz)
Appends an ldc_w instruction that loads a class constant for the given class.InstructionSequenceBuilder
ldc_w(Clazz clazz, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a class constant for the given class.InstructionSequenceBuilder
ldc_w(Clazz clazz, Member member)
Appends an ldc_w instruction that loads a string constant with the given class member name.InstructionSequenceBuilder
ldc_w(Clazz clazz, Member member, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given class member name.InstructionSequenceBuilder
ldc_w(ResourceFile resourceFile)
Appends an ldc_w instruction that loads a string constant with the given resource file name.InstructionSequenceBuilder
ldc_w(ResourceFile resourceFile, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given resource file name.InstructionSequenceBuilder
ldc_w_(int constantIndex)
Appends an ldc_w instruction that loads the constant at the given index.InstructionSequenceBuilder
ldc_w_(int constantIndex, ConstantVisitor visitor)
Appends an ldc_w instruction that loads the constant at the given index.InstructionSequenceBuilder
ldc2_w(double value)
Appends an ldc2_w instruction that loads a double constant with the given value.InstructionSequenceBuilder
ldc2_w(double value, ConstantVisitor visitor)
Appends an ldc2_w instruction that loads a double constant with the given value.InstructionSequenceBuilder
ldc2_w(int constantIndex)
Appends an ldc2_w instruction that loads the Category 2 constant at the given index.InstructionSequenceBuilder
ldc2_w(int constantIndex, ConstantVisitor visitor)
Appends an ldc2_w instruction that loads the Category 2 constant at the given index.InstructionSequenceBuilder
ldc2_w(long value)
Appends an ldc2_w instruction that loads a long constant with the given value.InstructionSequenceBuilder
ldc2_w(long value, ConstantVisitor visitor)
Appends an ldc2_w instruction that loads a long constant with the given value.InstructionSequenceBuilder
ldiv()
InstructionSequenceBuilder
line(Instruction instruction)
Short forappendInstruction(Instruction)
.InstructionSequenceBuilder
lload(int variableIndex)
InstructionSequenceBuilder
lload_0()
InstructionSequenceBuilder
lload_1()
InstructionSequenceBuilder
lload_2()
InstructionSequenceBuilder
lload_3()
InstructionSequenceBuilder
lmul()
InstructionSequenceBuilder
lneg()
InstructionSequenceBuilder
load(int variableIndex, char type)
Loads the given variable of primitive type onto the stack.InstructionSequenceBuilder
load(int variableIndex, java.lang.String type)
Loads the given variable onto the stack.InstructionSequenceBuilder
loadFromArray(java.lang.String elementType)
Loads an element from an array.InstructionSequenceBuilder
lookupswitch(int defaultOffset, int[] cases, int[] jumpOffsets)
InstructionSequenceBuilder
lor()
InstructionSequenceBuilder
lrem()
InstructionSequenceBuilder
lreturn()
InstructionSequenceBuilder
lshl()
InstructionSequenceBuilder
lshr()
InstructionSequenceBuilder
lstore(int variableIndex)
InstructionSequenceBuilder
lstore_0()
InstructionSequenceBuilder
lstore_1()
InstructionSequenceBuilder
lstore_2()
InstructionSequenceBuilder
lstore_3()
InstructionSequenceBuilder
lsub()
InstructionSequenceBuilder
lushr()
InstructionSequenceBuilder
lxor()
static void
main(java.lang.String[] args)
Small sample application that illustrates the use of this class.InstructionSequenceBuilder
monitorenter()
InstructionSequenceBuilder
monitorexit()
InstructionSequenceBuilder
multianewarray(int constantIndex)
InstructionSequenceBuilder
multianewarray(java.lang.String typeName)
InstructionSequenceBuilder
multianewarray(java.lang.String typeName, Clazz referencedClass)
InstructionSequenceBuilder
multianewarray(Clazz type)
InstructionSequenceBuilder
new_(int constantIndex)
InstructionSequenceBuilder
new_(java.lang.String className)
InstructionSequenceBuilder
new_(java.lang.String className, Clazz referencedClass)
InstructionSequenceBuilder
new_(Clazz clazz)
InstructionSequenceBuilder
newarray(int constant)
InstructionSequenceBuilder
nop()
InstructionSequenceBuilder
pop()
InstructionSequenceBuilder
pop2()
InstructionSequenceBuilder
pushBoxedPrimitive(java.lang.Object value, java.lang.String type)
Push a primitive on the stack followed by a call to it's boxed valueOf method.InstructionSequenceBuilder
pushDefault(java.lang.String type)
Pushes a default value onto the stack.InstructionSequenceBuilder
pushDouble(double value)
Pushes the given primitive double on the stack in the most efficient way (as a dconst or ldc instruction).InstructionSequenceBuilder
pushFloat(float value)
Pushes the given primitive float on the stack in the most efficient way (as an fconst or ldc instruction).InstructionSequenceBuilder
pushInt(int value)
Pushes the given primitive int on the stack in the most efficient way (as an iconst, bipush, sipush, or ldc instruction).InstructionSequenceBuilder
pushLong(long value)
Pushes the given primitive long on the stack in the most efficient way (as an lconst or ldc instruction).InstructionSequenceBuilder
pushNewArray(java.lang.String type, int size)
Pushes a new array on the stack.InstructionSequenceBuilder
pushPrimitive(java.lang.Object value, char type)
Pushes the given primitive value on the stack.InstructionSequenceBuilder
pushPrimitiveOrString(java.lang.Object value, java.lang.String type)
Pushes the given string or primitive on the stack.InstructionSequenceBuilder
pushPrimitiveOrString(java.lang.Object value, java.lang.String type, boolean allowBoxing)
Pushes the given string or primitive on the stack.InstructionSequenceBuilder
pushPrimitiveOrStringArray(java.lang.String type, java.lang.Object[] values)
Pushes a new array with given values onto the stack.InstructionSequenceBuilder
putfield(int constantIndex)
InstructionSequenceBuilder
putfield(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
putfield(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
InstructionSequenceBuilder
putfield(Clazz clazz, Field field)
InstructionSequenceBuilder
putstatic(int constantIndex)
InstructionSequenceBuilder
putstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor)
InstructionSequenceBuilder
putstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
InstructionSequenceBuilder
putstatic(Clazz clazz, Field field)
InstructionSequenceBuilder
ret(int variableIndex)
InstructionSequenceBuilder
return_()
InstructionSequenceBuilder
saload()
InstructionSequenceBuilder
sastore()
InstructionSequenceBuilder
sipush(int constant)
int
size()
Returns the number of instructions accumulated by this InstructionSequenceBuilder.InstructionSequenceBuilder
store(int variableIndex, char type)
Stores the primitve value on top of the stack in the variable with given index.InstructionSequenceBuilder
store(int variableIndex, java.lang.String type)
Stores the value on top of the stack in the variable with given index.InstructionSequenceBuilder
storeToArray(java.lang.String elementType)
Stores an element to an array.InstructionSequenceBuilder
swap()
InstructionSequenceBuilder
tableswitch(int defaultOffset, int lowCase, int highCase, int[] jumpOffsets)
InstructionSequenceBuilder
unboxPrimitiveType(java.lang.String sourceType, java.lang.String targetType)
Unbox the object on the stack to a primitive value.InstructionSequenceBuilder
wide()
-
-
-
Constructor Detail
-
InstructionSequenceBuilder
public InstructionSequenceBuilder()
Creates a new InstructionSequenceBuilder.
-
InstructionSequenceBuilder
public InstructionSequenceBuilder(ClassPool programClassPool, ClassPool libraryClassPool)
Creates a new InstructionSequenceBuilder that automatically initializes class references and class member references in new constants.- Parameters:
programClassPool
- The program class pool from which new constants can be initialized.libraryClassPool
- The library class pool from which new constants can be initialized.
-
InstructionSequenceBuilder
public InstructionSequenceBuilder(ProgramClass targetClass)
Creates a new InstructionSequenceBuilder.- Parameters:
targetClass
- The target class for the instruction constants.
-
InstructionSequenceBuilder
public InstructionSequenceBuilder(ProgramClass targetClass, ClassPool programClassPool, ClassPool libraryClassPool)
Creates a new InstructionSequenceBuilder that automatically initializes class references and class member references in new constants.- Parameters:
targetClass
- The target class for the instruction constants.programClassPool
- The program class pool from which new constants can be initialized.libraryClassPool
- The library class pool from which new constants can be initialized.
-
InstructionSequenceBuilder
public InstructionSequenceBuilder(ConstantPoolEditor constantPoolEditor)
Creates a new InstructionSequenceBuilder.- Parameters:
constantPoolEditor
- The editor to use for creating any constants for the instructions.
-
-
Method Detail
-
getConstantPoolEditor
public ConstantPoolEditor getConstantPoolEditor()
Returns the ConstantPoolEditor used by this builder to create constants.- Returns:
- The ConstantPoolEditor used by this builder to create constants.
-
label
public InstructionSequenceBuilder label(Instruction instruction)
Short forappendInstruction(Instruction)
.- See Also:
InstructionSequenceReplacer.label()
-
catch_
public InstructionSequenceBuilder catch_(Instruction instruction)
Short forappendInstruction(Instruction)
.
-
line
public InstructionSequenceBuilder line(Instruction instruction)
Short forappendInstruction(Instruction)
.
-
appendInstruction
public InstructionSequenceBuilder appendInstruction(Instruction instruction)
Appends the given instruction.- Parameters:
instruction
- The instruction to be appended.- Returns:
- The builder itself.
-
appendInstructions
public InstructionSequenceBuilder appendInstructions(Instruction[] instructions)
Appends the given instructions.- Parameters:
instructions
- The instructions to be appended.- Returns:
- The builder itself.
-
__
public Instruction[] __()
Short forinstructions()
.
-
instructions
public Instruction[] instructions()
Returns the accumulated sequence of instructions and resets the sequence in the builder.
-
constants
public Constant[] constants()
Returns the accumulated set of constants and resets the set in the builder.
-
size
public int size()
Returns the number of instructions accumulated by this InstructionSequenceBuilder.
-
nop
public InstructionSequenceBuilder nop()
-
aconst_null
public InstructionSequenceBuilder aconst_null()
-
iconst
public InstructionSequenceBuilder iconst(int constant)
-
iconst_m1
public InstructionSequenceBuilder iconst_m1()
-
iconst_0
public InstructionSequenceBuilder iconst_0()
-
iconst_1
public InstructionSequenceBuilder iconst_1()
-
iconst_2
public InstructionSequenceBuilder iconst_2()
-
iconst_3
public InstructionSequenceBuilder iconst_3()
-
iconst_4
public InstructionSequenceBuilder iconst_4()
-
iconst_5
public InstructionSequenceBuilder iconst_5()
-
lconst
public InstructionSequenceBuilder lconst(int constant)
-
lconst_0
public InstructionSequenceBuilder lconst_0()
-
lconst_1
public InstructionSequenceBuilder lconst_1()
-
fconst
public InstructionSequenceBuilder fconst(int constant)
-
fconst_0
public InstructionSequenceBuilder fconst_0()
-
fconst_1
public InstructionSequenceBuilder fconst_1()
-
fconst_2
public InstructionSequenceBuilder fconst_2()
-
dconst
public InstructionSequenceBuilder dconst(int constant)
-
dconst_0
public InstructionSequenceBuilder dconst_0()
-
dconst_1
public InstructionSequenceBuilder dconst_1()
-
bipush
public InstructionSequenceBuilder bipush(int constant)
-
sipush
public InstructionSequenceBuilder sipush(int constant)
-
ldc
public InstructionSequenceBuilder ldc(int value)
Appends an ldc instruction that loads an integer constant with the given value.
-
ldc
public InstructionSequenceBuilder ldc(int value, ConstantVisitor visitor)
Appends an ldc instruction that loads an integer constant with the given value. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(float value)
Appends an ldc instruction that loads a float constant with the given value.
-
ldc
public InstructionSequenceBuilder ldc(float value, ConstantVisitor visitor)
Appends an ldc instruction that loads a float constant with the given value. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String string)
Appends an ldc instruction that loads a string constant with the given value.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String string, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given value. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.Object primitiveArray)
Appends an ldc instruction that loads an (internal) primitive array constant with the given value.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.Object primitiveArray, ConstantVisitor visitor)
Appends an ldc instruction that loads an (internal) primitive array constant with the given value. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(Clazz clazz, Member member)
Appends an ldc instruction that loads a string constant with the given class member name.
-
ldc
public InstructionSequenceBuilder ldc(Clazz clazz, Member member, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given class member name. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String string, Clazz referencedClass, Member referencedMember)
Appends an ldc instruction that loads a string constant with the given value, that references the given class member.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String string, Clazz referencedClass, Member referencedMember, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given value, that references the given class member. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(ResourceFile resourceFile)
Appends an ldc instruction that loads a string constant with the given resource file name.
-
ldc
public InstructionSequenceBuilder ldc(ResourceFile resourceFile, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given resource file name. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String string, ResourceFile referencedResourceFile)
Appends an ldc instruction that loads a string constant with the given value, that references the given resource file.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String string, ResourceFile referencedResourceFile, ConstantVisitor visitor)
Appends an ldc instruction that loads a string constant with the given value, that references the given resource file. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(Clazz clazz)
Appends an ldc instruction that loads a class constant for the given class.
-
ldc
public InstructionSequenceBuilder ldc(Clazz clazz, ConstantVisitor visitor)
Appends an ldc instruction that loads a class constant for the given class. Also visits the constant with the given visitor.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String typeName, Clazz referencedClass)
Appends an ldc instruction that loads a class constant for the given type name, that references the given class.
-
ldc
public InstructionSequenceBuilder ldc(java.lang.String typeName, Clazz referencedClass, ConstantVisitor visitor)
Appends an ldc instruction that loads a class constant for the given type name, that references the given class. Also visits the constant with the given visitor.
-
ldc_
public InstructionSequenceBuilder ldc_(int constantIndex)
Appends an ldc instruction that loads the constant at the given index.
-
ldc_
public InstructionSequenceBuilder ldc_(int constantIndex, ConstantVisitor visitor)
Appends an ldc instruction that loads the constant at the given index. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(int value)
Appends an ldc_w instruction that loads an integer constant with the given value.
-
ldc_w
public InstructionSequenceBuilder ldc_w(int value, ConstantVisitor visitor)
Appends an ldc_w instruction that loads an integer constant with the given value. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(float value)
Appends an ldc_w instruction that loads a float constant with the given value.
-
ldc_w
public InstructionSequenceBuilder ldc_w(float value, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a float constant with the given value. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String string)
Appends an ldc_w instruction that loads a string constant with the given value.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String string, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given value. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.Object primitiveArray)
Appends an ldc_w instruction that loads an (internal) primitive array constant with the given value.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.Object primitiveArray, ConstantVisitor visitor)
Appends an ldc_w instruction that loads an (internal) primitive array constant with the given value. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(Clazz clazz, Member member)
Appends an ldc_w instruction that loads a string constant with the given class member name.
-
ldc_w
public InstructionSequenceBuilder ldc_w(Clazz clazz, Member member, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given class member name. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String string, Clazz referencedClass, Member referencedMember)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given class member.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String string, Clazz referencedClass, Member referencedMember, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given class member. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(ResourceFile resourceFile)
Appends an ldc_w instruction that loads a string constant with the given resource file name.
-
ldc_w
public InstructionSequenceBuilder ldc_w(ResourceFile resourceFile, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given resource file name. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String string, ResourceFile referencedResourceFile)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given resource file.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String string, ResourceFile referencedResourceFile, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a string constant with the given value, that references the given resource file. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(Clazz clazz)
Appends an ldc_w instruction that loads a class constant for the given class.
-
ldc_w
public InstructionSequenceBuilder ldc_w(Clazz clazz, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a class constant for the given class. Also visits the constant with the given visitor.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String typeName, Clazz referencedClass)
Appends an ldc_w instruction that loads a class constant for the given type name, that references the given class.
-
ldc_w
public InstructionSequenceBuilder ldc_w(java.lang.String typeName, Clazz referencedClass, ConstantVisitor visitor)
Appends an ldc_w instruction that loads a class constant for the given type name, that references the given class. Also visits the constant with the given visitor.
-
ldc_w_
public InstructionSequenceBuilder ldc_w_(int constantIndex)
Appends an ldc_w instruction that loads the constant at the given index.
-
ldc_w_
public InstructionSequenceBuilder ldc_w_(int constantIndex, ConstantVisitor visitor)
Appends an ldc_w instruction that loads the constant at the given index. Also visits the constant with the given visitor.
-
ldc2_w
public InstructionSequenceBuilder ldc2_w(long value)
Appends an ldc2_w instruction that loads a long constant with the given value.
-
ldc2_w
public InstructionSequenceBuilder ldc2_w(long value, ConstantVisitor visitor)
Appends an ldc2_w instruction that loads a long constant with the given value. Also visits the constant with the given index.
-
ldc2_w
public InstructionSequenceBuilder ldc2_w(double value)
Appends an ldc2_w instruction that loads a double constant with the given value.
-
ldc2_w
public InstructionSequenceBuilder ldc2_w(double value, ConstantVisitor visitor)
Appends an ldc2_w instruction that loads a double constant with the given value. Also visits the constant with the given index.
-
ldc2_w
public InstructionSequenceBuilder ldc2_w(int constantIndex)
Appends an ldc2_w instruction that loads the Category 2 constant at the given index.
-
ldc2_w
public InstructionSequenceBuilder ldc2_w(int constantIndex, ConstantVisitor visitor)
Appends an ldc2_w instruction that loads the Category 2 constant at the given index. Also visits the constant with the given visitor.
-
iload
public InstructionSequenceBuilder iload(int variableIndex)
-
lload
public InstructionSequenceBuilder lload(int variableIndex)
-
fload
public InstructionSequenceBuilder fload(int variableIndex)
-
dload
public InstructionSequenceBuilder dload(int variableIndex)
-
aload
public InstructionSequenceBuilder aload(int variableIndex)
-
iload_0
public InstructionSequenceBuilder iload_0()
-
iload_1
public InstructionSequenceBuilder iload_1()
-
iload_2
public InstructionSequenceBuilder iload_2()
-
iload_3
public InstructionSequenceBuilder iload_3()
-
lload_0
public InstructionSequenceBuilder lload_0()
-
lload_1
public InstructionSequenceBuilder lload_1()
-
lload_2
public InstructionSequenceBuilder lload_2()
-
lload_3
public InstructionSequenceBuilder lload_3()
-
fload_0
public InstructionSequenceBuilder fload_0()
-
fload_1
public InstructionSequenceBuilder fload_1()
-
fload_2
public InstructionSequenceBuilder fload_2()
-
fload_3
public InstructionSequenceBuilder fload_3()
-
dload_0
public InstructionSequenceBuilder dload_0()
-
dload_1
public InstructionSequenceBuilder dload_1()
-
dload_2
public InstructionSequenceBuilder dload_2()
-
dload_3
public InstructionSequenceBuilder dload_3()
-
aload_0
public InstructionSequenceBuilder aload_0()
-
aload_1
public InstructionSequenceBuilder aload_1()
-
aload_2
public InstructionSequenceBuilder aload_2()
-
aload_3
public InstructionSequenceBuilder aload_3()
-
iaload
public InstructionSequenceBuilder iaload()
-
laload
public InstructionSequenceBuilder laload()
-
faload
public InstructionSequenceBuilder faload()
-
daload
public InstructionSequenceBuilder daload()
-
aaload
public InstructionSequenceBuilder aaload()
-
baload
public InstructionSequenceBuilder baload()
-
caload
public InstructionSequenceBuilder caload()
-
saload
public InstructionSequenceBuilder saload()
-
istore
public InstructionSequenceBuilder istore(int variableIndex)
-
lstore
public InstructionSequenceBuilder lstore(int variableIndex)
-
fstore
public InstructionSequenceBuilder fstore(int variableIndex)
-
dstore
public InstructionSequenceBuilder dstore(int variableIndex)
-
astore
public InstructionSequenceBuilder astore(int variableIndex)
-
istore_0
public InstructionSequenceBuilder istore_0()
-
istore_1
public InstructionSequenceBuilder istore_1()
-
istore_2
public InstructionSequenceBuilder istore_2()
-
istore_3
public InstructionSequenceBuilder istore_3()
-
lstore_0
public InstructionSequenceBuilder lstore_0()
-
lstore_1
public InstructionSequenceBuilder lstore_1()
-
lstore_2
public InstructionSequenceBuilder lstore_2()
-
lstore_3
public InstructionSequenceBuilder lstore_3()
-
fstore_0
public InstructionSequenceBuilder fstore_0()
-
fstore_1
public InstructionSequenceBuilder fstore_1()
-
fstore_2
public InstructionSequenceBuilder fstore_2()
-
fstore_3
public InstructionSequenceBuilder fstore_3()
-
dstore_0
public InstructionSequenceBuilder dstore_0()
-
dstore_1
public InstructionSequenceBuilder dstore_1()
-
dstore_2
public InstructionSequenceBuilder dstore_2()
-
dstore_3
public InstructionSequenceBuilder dstore_3()
-
astore_0
public InstructionSequenceBuilder astore_0()
-
astore_1
public InstructionSequenceBuilder astore_1()
-
astore_2
public InstructionSequenceBuilder astore_2()
-
astore_3
public InstructionSequenceBuilder astore_3()
-
iastore
public InstructionSequenceBuilder iastore()
-
lastore
public InstructionSequenceBuilder lastore()
-
fastore
public InstructionSequenceBuilder fastore()
-
dastore
public InstructionSequenceBuilder dastore()
-
aastore
public InstructionSequenceBuilder aastore()
-
bastore
public InstructionSequenceBuilder bastore()
-
castore
public InstructionSequenceBuilder castore()
-
sastore
public InstructionSequenceBuilder sastore()
-
pop
public InstructionSequenceBuilder pop()
-
pop2
public InstructionSequenceBuilder pop2()
-
dup
public InstructionSequenceBuilder dup()
-
dup_x1
public InstructionSequenceBuilder dup_x1()
-
dup_x2
public InstructionSequenceBuilder dup_x2()
-
dup2
public InstructionSequenceBuilder dup2()
-
dup2_x1
public InstructionSequenceBuilder dup2_x1()
-
dup2_x2
public InstructionSequenceBuilder dup2_x2()
-
swap
public InstructionSequenceBuilder swap()
-
iadd
public InstructionSequenceBuilder iadd()
-
ladd
public InstructionSequenceBuilder ladd()
-
fadd
public InstructionSequenceBuilder fadd()
-
dadd
public InstructionSequenceBuilder dadd()
-
isub
public InstructionSequenceBuilder isub()
-
lsub
public InstructionSequenceBuilder lsub()
-
fsub
public InstructionSequenceBuilder fsub()
-
dsub
public InstructionSequenceBuilder dsub()
-
imul
public InstructionSequenceBuilder imul()
-
lmul
public InstructionSequenceBuilder lmul()
-
fmul
public InstructionSequenceBuilder fmul()
-
dmul
public InstructionSequenceBuilder dmul()
-
idiv
public InstructionSequenceBuilder idiv()
-
ldiv
public InstructionSequenceBuilder ldiv()
-
fdiv
public InstructionSequenceBuilder fdiv()
-
ddiv
public InstructionSequenceBuilder ddiv()
-
irem
public InstructionSequenceBuilder irem()
-
lrem
public InstructionSequenceBuilder lrem()
-
frem
public InstructionSequenceBuilder frem()
-
drem
public InstructionSequenceBuilder drem()
-
ineg
public InstructionSequenceBuilder ineg()
-
lneg
public InstructionSequenceBuilder lneg()
-
fneg
public InstructionSequenceBuilder fneg()
-
dneg
public InstructionSequenceBuilder dneg()
-
ishl
public InstructionSequenceBuilder ishl()
-
lshl
public InstructionSequenceBuilder lshl()
-
ishr
public InstructionSequenceBuilder ishr()
-
lshr
public InstructionSequenceBuilder lshr()
-
iushr
public InstructionSequenceBuilder iushr()
-
lushr
public InstructionSequenceBuilder lushr()
-
iand
public InstructionSequenceBuilder iand()
-
land
public InstructionSequenceBuilder land()
-
ior
public InstructionSequenceBuilder ior()
-
lor
public InstructionSequenceBuilder lor()
-
ixor
public InstructionSequenceBuilder ixor()
-
lxor
public InstructionSequenceBuilder lxor()
-
iinc
public InstructionSequenceBuilder iinc(int variableIndex, int constant)
-
i2l
public InstructionSequenceBuilder i2l()
-
i2f
public InstructionSequenceBuilder i2f()
-
i2d
public InstructionSequenceBuilder i2d()
-
l2i
public InstructionSequenceBuilder l2i()
-
l2f
public InstructionSequenceBuilder l2f()
-
l2d
public InstructionSequenceBuilder l2d()
-
f2i
public InstructionSequenceBuilder f2i()
-
f2l
public InstructionSequenceBuilder f2l()
-
f2d
public InstructionSequenceBuilder f2d()
-
d2i
public InstructionSequenceBuilder d2i()
-
d2l
public InstructionSequenceBuilder d2l()
-
d2f
public InstructionSequenceBuilder d2f()
-
i2b
public InstructionSequenceBuilder i2b()
-
i2c
public InstructionSequenceBuilder i2c()
-
i2s
public InstructionSequenceBuilder i2s()
-
lcmp
public InstructionSequenceBuilder lcmp()
-
fcmpl
public InstructionSequenceBuilder fcmpl()
-
fcmpg
public InstructionSequenceBuilder fcmpg()
-
dcmpl
public InstructionSequenceBuilder dcmpl()
-
dcmpg
public InstructionSequenceBuilder dcmpg()
-
ifeq
public InstructionSequenceBuilder ifeq(int branchOffset)
-
ifne
public InstructionSequenceBuilder ifne(int branchOffset)
-
iflt
public InstructionSequenceBuilder iflt(int branchOffset)
-
ifge
public InstructionSequenceBuilder ifge(int branchOffset)
-
ifgt
public InstructionSequenceBuilder ifgt(int branchOffset)
-
ifle
public InstructionSequenceBuilder ifle(int branchOffset)
-
ificmpeq
public InstructionSequenceBuilder ificmpeq(int branchOffset)
-
ificmpne
public InstructionSequenceBuilder ificmpne(int branchOffset)
-
ificmplt
public InstructionSequenceBuilder ificmplt(int branchOffset)
-
ificmpge
public InstructionSequenceBuilder ificmpge(int branchOffset)
-
ificmpgt
public InstructionSequenceBuilder ificmpgt(int branchOffset)
-
ificmple
public InstructionSequenceBuilder ificmple(int branchOffset)
-
ifacmpeq
public InstructionSequenceBuilder ifacmpeq(int branchOffset)
-
ifacmpne
public InstructionSequenceBuilder ifacmpne(int branchOffset)
-
goto_
public InstructionSequenceBuilder goto_(int branchOffset)
-
jsr
public InstructionSequenceBuilder jsr(int branchOffset)
-
ret
public InstructionSequenceBuilder ret(int variableIndex)
-
tableswitch
public InstructionSequenceBuilder tableswitch(int defaultOffset, int lowCase, int highCase, int[] jumpOffsets)
-
lookupswitch
public InstructionSequenceBuilder lookupswitch(int defaultOffset, int[] cases, int[] jumpOffsets)
-
ireturn
public InstructionSequenceBuilder ireturn()
-
lreturn
public InstructionSequenceBuilder lreturn()
-
freturn
public InstructionSequenceBuilder freturn()
-
dreturn
public InstructionSequenceBuilder dreturn()
-
areturn
public InstructionSequenceBuilder areturn()
-
return_
public InstructionSequenceBuilder return_()
-
getstatic
public InstructionSequenceBuilder getstatic(Clazz clazz, Field field)
-
getstatic
public InstructionSequenceBuilder getstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
getstatic
public InstructionSequenceBuilder getstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
-
getstatic
public InstructionSequenceBuilder getstatic(int constantIndex)
-
putstatic
public InstructionSequenceBuilder putstatic(Clazz clazz, Field field)
-
putstatic
public InstructionSequenceBuilder putstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
putstatic
public InstructionSequenceBuilder putstatic(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
-
putstatic
public InstructionSequenceBuilder putstatic(int constantIndex)
-
getfield
public InstructionSequenceBuilder getfield(Clazz clazz, Field field)
-
getfield
public InstructionSequenceBuilder getfield(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
getfield
public InstructionSequenceBuilder getfield(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
-
getfield
public InstructionSequenceBuilder getfield(int constantIndex)
-
putfield
public InstructionSequenceBuilder putfield(Clazz clazz, Field field)
-
putfield
public InstructionSequenceBuilder putfield(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
putfield
public InstructionSequenceBuilder putfield(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Field referencedField)
-
putfield
public InstructionSequenceBuilder putfield(int constantIndex)
-
invokevirtual
public InstructionSequenceBuilder invokevirtual(Clazz clazz, Method method)
-
invokevirtual
public InstructionSequenceBuilder invokevirtual(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
invokevirtual
public InstructionSequenceBuilder invokevirtual(int classIndex, java.lang.String name, java.lang.String descriptor)
-
invokevirtual
public InstructionSequenceBuilder invokevirtual(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
-
invokevirtual
public InstructionSequenceBuilder invokevirtual(int constantIndex)
-
invokespecial
public InstructionSequenceBuilder invokespecial(Clazz clazz, Method method)
-
invokespecial
public InstructionSequenceBuilder invokespecial(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
invokespecial
public InstructionSequenceBuilder invokespecial(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
-
invokespecial_interface
public InstructionSequenceBuilder invokespecial_interface(Clazz clazz, Method method)
-
invokespecial_interface
public InstructionSequenceBuilder invokespecial_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
invokespecial_interface
public InstructionSequenceBuilder invokespecial_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
-
invokespecial
public InstructionSequenceBuilder invokespecial(int constantIndex)
-
invokestatic
public InstructionSequenceBuilder invokestatic(Clazz clazz, Method method)
-
invokestatic
public InstructionSequenceBuilder invokestatic(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
invokestatic
public InstructionSequenceBuilder invokestatic(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
-
invokestatic_interface
public InstructionSequenceBuilder invokestatic_interface(Clazz clazz, Method method)
-
invokestatic_interface
public InstructionSequenceBuilder invokestatic_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
invokestatic_interface
public InstructionSequenceBuilder invokestatic_interface(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
-
invokestatic
public InstructionSequenceBuilder invokestatic(int constantIndex)
-
invokeinterface
public InstructionSequenceBuilder invokeinterface(Clazz clazz, Method method)
-
invokeinterface
public InstructionSequenceBuilder invokeinterface(java.lang.String className, java.lang.String name, java.lang.String descriptor)
-
invokeinterface
public InstructionSequenceBuilder invokeinterface(java.lang.String className, java.lang.String name, java.lang.String descriptor, Clazz referencedClass, Method referencedMethod)
-
invokeinterface
public InstructionSequenceBuilder invokeinterface(int constantIndex, int constant)
-
invokedynamic
public InstructionSequenceBuilder invokedynamic(int bootStrapMethodIndex, java.lang.String name, java.lang.String descriptor)
-
invokedynamic
public InstructionSequenceBuilder invokedynamic(int bootStrapMethodIndex, java.lang.String name, java.lang.String descriptor, Clazz[] referencedClasses)
-
invokedynamic
public InstructionSequenceBuilder invokedynamic(int constantIndex)
-
new_
public InstructionSequenceBuilder new_(Clazz clazz)
-
new_
public InstructionSequenceBuilder new_(java.lang.String className)
-
new_
public InstructionSequenceBuilder new_(java.lang.String className, Clazz referencedClass)
-
new_
public InstructionSequenceBuilder new_(int constantIndex)
-
newarray
public InstructionSequenceBuilder newarray(int constant)
-
anewarray
public InstructionSequenceBuilder anewarray(Clazz elementType)
-
anewarray
public InstructionSequenceBuilder anewarray(java.lang.String elementTypeName, Clazz referencedClass)
-
anewarray
public InstructionSequenceBuilder anewarray(int constantIndex)
-
arraylength
public InstructionSequenceBuilder arraylength()
-
athrow
public InstructionSequenceBuilder athrow()
-
checkcast
public InstructionSequenceBuilder checkcast(Clazz type)
-
checkcast
public InstructionSequenceBuilder checkcast(java.lang.String typeName)
-
checkcast
public InstructionSequenceBuilder checkcast(java.lang.String typeName, Clazz referencedClass)
-
checkcast
public InstructionSequenceBuilder checkcast(int constantIndex)
-
instanceof_
public InstructionSequenceBuilder instanceof_(Clazz type)
-
instanceof_
public InstructionSequenceBuilder instanceof_(java.lang.String typeName, Clazz referencedClass)
-
instanceof_
public InstructionSequenceBuilder instanceof_(int constantIndex)
-
monitorenter
public InstructionSequenceBuilder monitorenter()
-
monitorexit
public InstructionSequenceBuilder monitorexit()
-
wide
public InstructionSequenceBuilder wide()
-
multianewarray
public InstructionSequenceBuilder multianewarray(Clazz type)
-
multianewarray
public InstructionSequenceBuilder multianewarray(java.lang.String typeName)
-
multianewarray
public InstructionSequenceBuilder multianewarray(java.lang.String typeName, Clazz referencedClass)
-
multianewarray
public InstructionSequenceBuilder multianewarray(int constantIndex)
-
ifnull
public InstructionSequenceBuilder ifnull(int branchOffset)
-
ifnonnull
public InstructionSequenceBuilder ifnonnull(int branchOffset)
-
goto_w
public InstructionSequenceBuilder goto_w(int branchOffset)
-
jsr_w
public InstructionSequenceBuilder jsr_w(int branchOffset)
-
pushPrimitive
public InstructionSequenceBuilder pushPrimitive(java.lang.Object value, char type)
Pushes the given primitive value on the stack.Operand stack: ... -> ..., value.
- Parameters:
value
- The primitive value to be pushed - should never be null.type
- The internal type of the primitive ('Z','B','I',...).
-
boxPrimitiveType
public InstructionSequenceBuilder boxPrimitiveType(char sourceType)
Box the primitive value present on the stack.Operand stack: ..., primitive -> ..., boxed_primitive.
- Parameters:
sourceType
- Type of the primitive on the stack.- Returns:
- This.
-
unboxPrimitiveType
public InstructionSequenceBuilder unboxPrimitiveType(java.lang.String sourceType, java.lang.String targetType)
Unbox the object on the stack to a primitive value.Operand stack: ..., boxed_primitive -> ..., primitive.
- Parameters:
sourceType
- Type of the primitive that should be unboxed.targetType
- Resulting type.
-
pushPrimitiveOrString
public InstructionSequenceBuilder pushPrimitiveOrString(java.lang.Object value, java.lang.String type)
Pushes the given string or primitive on the stack.- Parameters:
value
- The primitive value to be pushed - should never be null.type
- The internal type of the primitive ('Z','B','I',...).- Throws:
java.lang.IllegalArgumentException
- if the type is neither primitive orLjava/lang/String;
.
-
pushPrimitiveOrString
public InstructionSequenceBuilder pushPrimitiveOrString(java.lang.Object value, java.lang.String type, boolean allowBoxing)
Pushes the given string or primitive on the stack.- Parameters:
value
- The primitive value to be pushed - should never be null.type
- The internal type of the primitive ('Z','B','I',...).allowBoxing
- If the type is a primitive wrapper class, set allowBoxing = true, to push a boxed primitive.- Throws:
java.lang.IllegalArgumentException
- if the type is neither primitive orLjava/lang/String;
.
-
pushBoxedPrimitive
public InstructionSequenceBuilder pushBoxedPrimitive(java.lang.Object value, java.lang.String type)
Push a primitive on the stack followed by a call to it's boxed valueOf method.- Parameters:
value
- The value.type
- The type, e.g.Ljava/lang/Integer;
.
-
pushInt
public InstructionSequenceBuilder pushInt(int value)
Pushes the given primitive int on the stack in the most efficient way (as an iconst, bipush, sipush, or ldc instruction).- Parameters:
value
- The int value to be pushed.
-
pushFloat
public InstructionSequenceBuilder pushFloat(float value)
Pushes the given primitive float on the stack in the most efficient way (as an fconst or ldc instruction).- Parameters:
value
- The float value to be pushed.
-
pushLong
public InstructionSequenceBuilder pushLong(long value)
Pushes the given primitive long on the stack in the most efficient way (as an lconst or ldc instruction).- Parameters:
value
- The long to be pushed.
-
pushDouble
public InstructionSequenceBuilder pushDouble(double value)
Pushes the given primitive double on the stack in the most efficient way (as a dconst or ldc instruction).- Parameters:
value
- The double value to be pushed.
-
pushNewArray
public InstructionSequenceBuilder pushNewArray(java.lang.String type, int size)
Pushes a new array on the stack.Operand stack: ... -> ..., array.
- Parameters:
type
- The array element type (or class name in case of objects).size
- The size of the array to be created.
-
pushPrimitiveOrStringArray
public InstructionSequenceBuilder pushPrimitiveOrStringArray(java.lang.String type, java.lang.Object[] values)
Pushes a new array with given values onto the stack.For primitives you can specify, for example, either I or Ljava/lang/Integer; to create an object array or a primitive array.
Operand stack: ... -> ..., array.
- Parameters:
type
- The array element type (or class name in case of objects).values
- The array values.
-
pushDefault
public InstructionSequenceBuilder pushDefault(java.lang.String type)
Pushes a default value onto the stack.Either 0 for primitives or null for objects.
- Parameters:
type
- The type.
-
load
public InstructionSequenceBuilder load(int variableIndex, java.lang.String type)
Loads the given variable onto the stack.Operand stack: ... -> ..., value.
- Parameters:
variableIndex
- The index of the variable to be loaded.type
- The type of the variable to be loaded.
-
load
public InstructionSequenceBuilder load(int variableIndex, char type)
Loads the given variable of primitive type onto the stack.Operand stack: ... -> ..., value.
- Parameters:
variableIndex
- The index of the variable to be loaded.type
- The type of the variable to be loaded.
-
store
public InstructionSequenceBuilder store(int variableIndex, java.lang.String type)
Stores the value on top of the stack in the variable with given index.Operand stsack: ..., value -> ...
- Parameters:
variableIndex
- The index of the variable where to store the value.type
- The type of the value to be stored.
-
store
public InstructionSequenceBuilder store(int variableIndex, char type)
Stores the primitve value on top of the stack in the variable with given index.Operand stack: ..., value -> ...
- Parameters:
variableIndex
- The index of the variable where to store the value.type
- The type of the value to be stored.
-
storeToArray
public InstructionSequenceBuilder storeToArray(java.lang.String elementType)
Stores an element to an array.Operand stack: ..., array, index, value -> ...
- Parameters:
elementType
- The type of the value to be stored.
-
loadFromArray
public InstructionSequenceBuilder loadFromArray(java.lang.String elementType)
Loads an element from an array.Operand stack: ..., array, index -> ..., value.
- Parameters:
elementType
- The type of the value to be loaded.
-
main
public static void main(java.lang.String[] args)
Small sample application that illustrates the use of this class.
-
-