public abstract class InstructionHelper extends Object
ASM jvm instruction helper
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
EQ
Constant for the
ifCmp method. |
static int |
GE
Constant for the
ifCmp method. |
static int |
GT
Constant for the
ifCmp method. |
static int |
LE
Constant for the
ifCmp method. |
protected LocalVariables |
locals |
static int |
LT
Constant for the
ifCmp method. |
static int |
NE
Constant for the
ifCmp method. |
| 构造器和说明 |
|---|
InstructionHelper(cn.wensiqun.asmsupport.org.objectweb.asm.MethodVisitor mv,
AMethod method) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
generated the instruction to add top two stack value
|
void |
arrayLength()
Generates the instruction to compute the length of an array.
|
void |
arrayLoad(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to load an element from an array.
|
void |
arrayStore(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to store an element in an array.
|
void |
bitAnd(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
bitOr(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
bitXor(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
box(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instructions to box the top stack value.
|
void |
cast(cn.wensiqun.asmsupport.org.objectweb.asm.Type from,
cn.wensiqun.asmsupport.org.objectweb.asm.Type to)
Generates the instructions to cast a numerical value from one type to
another.
|
void |
checkCast(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to check that the top stack value is of the
given type.
|
void |
commonPutField(ExplicitVariable var) |
void |
declarationVariable(String name,
String desc,
String signature,
cn.wensiqun.asmsupport.org.objectweb.asm.Label start,
cn.wensiqun.asmsupport.org.objectweb.asm.Label end,
int index) |
void |
div(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
generated the instruction to mul top two stack value
|
void |
dup()
Generates a DUP instruction.
|
void |
dup(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
dup2()
Generates a DUP2 instruction.
|
void |
dupX1()
Generates a DUP_X1 instruction.
|
void |
dupX2()
Generates a DUP_X2 instruction.
|
void |
endMethod() |
static cn.wensiqun.asmsupport.org.objectweb.asm.Type |
getBoxedType(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
getField(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to push the value of a non static field on the
stack.
|
AMethod |
getMethod() |
StackLocalMethodVisitor |
getMv() |
int |
getReverseCmp(int opcode) |
void |
getStatic(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to push the value of a static field on the
stack.
|
static cn.wensiqun.asmsupport.org.objectweb.asm.Type |
getUnBoxedType(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
goTo(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
Generates the instruction to jump to the given label.
|
void |
ifCmp(cn.wensiqun.asmsupport.org.objectweb.asm.Type type,
int mode,
cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
Generates the instructions to jump to a label based on the comparison of
the top two stack values.
|
void |
ifNonNull(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
Generates the instruction to jump to the given label if the top stack
value is not null.
|
void |
ifNull(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
Generates the instruction to jump to the given label if the top stack
value is null.
|
void |
ifZCmp(int mode,
cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
Generates the instructions to jump to a label based on the comparison of
the top integer stack value with zero.
|
void |
iinc(int local,
int amount)
Generates the instruction to increment the given local variable.
|
void |
instanceOf(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to test if the top stack value is of the given
type.
|
void |
inverts(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
invokeConstructor(cn.wensiqun.asmsupport.org.objectweb.asm.Type ownerType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] argTypes)
Generates the instruction to invoke a constructor.
|
void |
invokeInterface(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] arguTypes,
boolean itf)
Generates the instruction to invoke an interface method.
|
void |
invokeStatic(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] arguTypes)
Generates the instruction to invoke a static method.
|
void |
invokeSuperMethod(cn.wensiqun.asmsupport.org.objectweb.asm.Type ownerType,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] argTypes)
Call super method
|
void |
invokeVirtual(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] arguTypes)
Generates the instruction to invoke a normal method.
|
void |
leftShift(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
loadInsn(cn.wensiqun.asmsupport.org.objectweb.asm.Type type,
int index)
Generates the instruction to push a local variable on the stack.
|
void |
loadThis()
Generates the instruction to load 'this' on the stack.
|
void |
mark(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
Marks the current code position with the given label.
|
void |
maxs(int stack,
int locals) |
void |
monitorEnter()
Generates the instruction to get the monitor of the top stack value.
|
void |
monitorExit()
Generates the instruction to release the monitor of the top stack value.
|
void |
mul(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
generated the instruction to mul top two stack value
|
void |
multiANewArrayInsn(cn.wensiqun.asmsupport.org.objectweb.asm.Type type,
int dims) |
void |
neg(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
newArray(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to create a new array.
|
void |
newInstance(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to create a new object.
|
void |
nop()
don't do any thing
|
void |
pop() |
void |
pop(int time) |
void |
push(boolean value)
Generates the instruction to push the given value on the stack.
|
void |
push(byte value)
Generates the instruction to push the given value on the stack.
|
void |
push(char value)
Generates the instruction to push the given value on the stack.
|
void |
push(double value)
Generates the instruction to push the given value on the stack.
|
void |
push(float value)
Generates the instruction to push the given value on the stack.
|
void |
push(int value)
Generates the instruction to push the given value on the stack.
|
void |
push(long value)
Generates the instruction to push the given value on the stack.
|
void |
push(short value)
Generates the instruction to push the given value on the stack.
|
void |
push(String value)
Generates the instruction to push the given value on the stack.
|
void |
push(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
push null
|
void |
pushClass(cn.wensiqun.asmsupport.org.objectweb.asm.Type value)
Generates the instruction to push the given value on the stack.
|
void |
putField(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to store the top stack value in a non static
field.
|
void |
putStatic(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instruction to store the top stack value in a static field.
|
void |
rem(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
generated the instruction to rem top two stack value
|
void |
returnInsn() |
void |
returnInsn(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
rightShift(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
setMv(StackLocalMethodVisitor mv) |
void |
storeInsn(LocalVariable var)
Generates the instruction to store the top stack value in a local
variable.
|
void |
sub(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
generated the instruction to sub top two stack value
|
void |
swap()
Generates a SWAP instruction.
|
void |
throwException()
Generates the instruction to throw an exception.
|
void |
tryCatchBlock(cn.wensiqun.asmsupport.org.objectweb.asm.Label tryStart,
cn.wensiqun.asmsupport.org.objectweb.asm.Label tryEnd,
cn.wensiqun.asmsupport.org.objectweb.asm.Label catchStart,
cn.wensiqun.asmsupport.org.objectweb.asm.Type exceptionType) |
void |
unbox(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instructions to unbox the top stack value.
|
void |
unsignedRightShift(cn.wensiqun.asmsupport.org.objectweb.asm.Type type) |
void |
valueOf(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
Generates the instructions to box the top stack value using Java 5's
valueOf() method.
|
protected LocalVariables locals
public InstructionHelper(cn.wensiqun.asmsupport.org.objectweb.asm.MethodVisitor mv,
AMethod method)
public AMethod getMethod()
public StackLocalMethodVisitor getMv()
public void setMv(StackLocalMethodVisitor mv)
public void push(boolean value)
value - the value to be pushed on the stack.public void push(int value)
value - the value to be pushed on the stack.public void push(byte value)
b - public void push(short value)
b - public void push(char value)
b - public void push(long value)
value - the value to be pushed on the stack.public void push(float value)
value - the value to be pushed on the stack.public void push(double value)
value - the value to be pushed on the stack.public void push(String value)
value - the value to be pushed on the stack. May be null.public void push(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void pushClass(cn.wensiqun.asmsupport.org.objectweb.asm.Type value)
value - the value to be pushed on the stack.public void cast(cn.wensiqun.asmsupport.org.objectweb.asm.Type from,
cn.wensiqun.asmsupport.org.objectweb.asm.Type to)
from - the type of the top stack valueto - the type into which this value must be cast.public void checkCast(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - a class or interface type.public static cn.wensiqun.asmsupport.org.objectweb.asm.Type getBoxedType(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public static cn.wensiqun.asmsupport.org.objectweb.asm.Type getUnBoxedType(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void box(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - the type of the top stack value.public void valueOf(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - the type of the top stack value.public void unbox(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - the type of the top stack value.public void mark(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
label - a label.public void nop()
public void loadInsn(cn.wensiqun.asmsupport.org.objectweb.asm.Type type,
int index)
type - the type of the local variable to be loaded.index - an index in the frame's local variables array.public void loadThis()
public void storeInsn(LocalVariable var)
type - the type of the local variable to be stored.index - an index in the frame's local variables array.public void swap()
public void dup()
public void dupX1()
public void dupX2()
public void dup2()
public void dup(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - public void newInstance(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - the class of the object to be created.public void invokeVirtual(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] arguTypes)
owner - name - returnType - arguTypes - public void invokeConstructor(cn.wensiqun.asmsupport.org.objectweb.asm.Type ownerType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] argTypes)
ownerType - the class in which the constructor is defined.method - the constructor to be invoked.public void invokeSuperMethod(cn.wensiqun.asmsupport.org.objectweb.asm.Type ownerType,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] argTypes)
ownerType - name - returnType - argTypes - public void invokeStatic(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] arguTypes)
owner - name - returnType - arguTypes - public void invokeInterface(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type returnType,
cn.wensiqun.asmsupport.org.objectweb.asm.Type[] arguTypes,
boolean itf)
owner - name - returnType - arguTypes - public void getStatic(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
owner - the class in which the field is defined.name - the name of the field.type - the type of the field.public void putStatic(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
owner - the class in which the field is defined.name - the name of the field.type - the type of the field.public void getField(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
owner - the class in which the field is defined.name - the name of the field.type - the type of the field.public void putField(cn.wensiqun.asmsupport.org.objectweb.asm.Type owner,
String name,
cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
owner - the class in which the field is defined.name - the name of the field.type - the type of the field.public void commonPutField(ExplicitVariable var)
gv - public void add(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - which add typepublic void sub(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - which add typepublic void mul(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - which add typepublic void div(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - which add typepublic void rem(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - public void neg(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - public void iinc(int local,
int amount)
local - the local variable to be incremented.amount - the amount by which the local variable must be incremented.public void inverts(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - public void bitAnd(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void bitOr(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void bitXor(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void leftShift(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void rightShift(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void unsignedRightShift(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void newArray(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - the type of the array elements.public void multiANewArrayInsn(cn.wensiqun.asmsupport.org.objectweb.asm.Type type,
int dims)
type - dims - public void arrayLoad(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - the type of the array element to be loaded.public void arrayStore(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - the type of the array element to be stored.public void arrayLength()
public int getReverseCmp(int opcode)
public void ifCmp(cn.wensiqun.asmsupport.org.objectweb.asm.Type type,
int mode,
cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
type - the type of the top two stack values.mode - how these values must be compared. One of EQ, NE, LT, GE, GT,
LE.label - where to jump if the comparison result is true.public void ifZCmp(int mode,
cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
mode - how these values must be compared. One of EQ, NE, LT, GE, GT,
LE.label - where to jump if the comparison result is true.public void ifNull(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
label - where to jump if the condition is true.public void ifNonNull(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
label - where to jump if the condition is true.public void goTo(cn.wensiqun.asmsupport.org.objectweb.asm.Label label)
label - where to jump if the condition is true.public void instanceOf(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
type - a class or interface type.public void tryCatchBlock(cn.wensiqun.asmsupport.org.objectweb.asm.Label tryStart,
cn.wensiqun.asmsupport.org.objectweb.asm.Label tryEnd,
cn.wensiqun.asmsupport.org.objectweb.asm.Label catchStart,
cn.wensiqun.asmsupport.org.objectweb.asm.Type exceptionType)
public void throwException()
public void monitorEnter()
public void monitorExit()
public void pop()
public void pop(int time)
public void returnInsn()
public void returnInsn(cn.wensiqun.asmsupport.org.objectweb.asm.Type type)
public void declarationVariable(String name, String desc, String signature, cn.wensiqun.asmsupport.org.objectweb.asm.Label start, cn.wensiqun.asmsupport.org.objectweb.asm.Label end, int index)
public void maxs(int stack,
int locals)
public void endMethod()
Copyright © 2015. All rights reserved.