|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcn.wensiqun.asmsupport.asm.InstructionHelper
public abstract class InstructionHelper
字节码操作的帮助类。 这里只需要操作栈。而本地变量的操作已经由LcoalVariables和ScopeLogicVariable封装完成了。
| 字段摘要 | |
|---|---|
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(org.objectweb.asm.MethodVisitor mv,
Method method)
|
|
| 方法摘要 | |
|---|---|
void |
add(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(org.objectweb.asm.Type type)
Generates the instruction to load an element from an array. |
void |
arrayStore(org.objectweb.asm.Type type)
Generates the instruction to store an element in an array. |
void |
bitAnd(org.objectweb.asm.Type type)
|
void |
bitOr(org.objectweb.asm.Type type)
|
void |
bitXor(org.objectweb.asm.Type type)
|
void |
box(org.objectweb.asm.Type type)
Generates the instructions to box the top stack value. |
void |
cast(org.objectweb.asm.Type from,
org.objectweb.asm.Type to)
Generates the instructions to cast a numerical value from one type to another. |
void |
checkCast(org.objectweb.asm.Type type)
Generates the instruction to check that the top stack value is of the given type. |
void |
declarationVariable(String name,
String desc,
String signature,
org.objectweb.asm.Label start,
org.objectweb.asm.Label end,
int index)
|
void |
div(org.objectweb.asm.Type type)
generated the instruction to mul top two stack value |
void |
dup()
Generates a DUP instruction. |
void |
dupX1()
Generates a DUP_X1 instruction. |
void |
dupX2()
Generates a DUP_X2 instruction. |
void |
endMethod()
|
static org.objectweb.asm.Type |
getBoxedType(org.objectweb.asm.Type type)
|
void |
getField(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
Generates the instruction to push the value of a non static field on the stack. |
Method |
getMethod()
|
StackLocalMethodVisitor |
getMv()
|
void |
getStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
Generates the instruction to push the value of a static field on the stack. |
static org.objectweb.asm.Type |
getUnBoxedType(org.objectweb.asm.Type type)
|
void |
goTo(org.objectweb.asm.Label label)
Generates the instruction to jump to the given label. |
void |
ifCmp(org.objectweb.asm.Type type,
int mode,
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(org.objectweb.asm.Label label)
Generates the instruction to jump to the given label if the top stack value is not null. |
void |
ifNull(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,
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(org.objectweb.asm.Type type)
Generates the instruction to test if the top stack value is of the given type. |
void |
inverts(org.objectweb.asm.Type type)
|
void |
invokeConstructor(org.objectweb.asm.Type ownerType,
org.objectweb.asm.Type[] argTypes)
Generates the instruction to invoke a constructor. |
void |
invokeInterface(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] arguTypes)
Generates the instruction to invoke an interface method. |
void |
invokeStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] arguTypes)
Generates the instruction to invoke a static method. |
void |
invokeSuperMethod(org.objectweb.asm.Type ownerType,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] argTypes)
调用父类方法 |
void |
invokeVirtual(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] arguTypes)
Generates the instruction to invoke a normal method. |
void |
leftShift(org.objectweb.asm.Type type)
|
void |
loadInsn(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(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(org.objectweb.asm.Type type)
generated the instruction to mul top two stack value |
void |
multiANewArrayInsn(org.objectweb.asm.Type type,
int dims)
|
void |
neg(org.objectweb.asm.Type type)
|
void |
newArray(org.objectweb.asm.Type type)
Generates the instruction to create a new array. |
void |
newInstance(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(org.objectweb.asm.Type type)
push null |
void |
pushClass(org.objectweb.asm.Type value)
Generates the instruction to push the given value on the stack. |
void |
putField(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
Generates the instruction to store the top stack value in a non static field. |
void |
putStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
Generates the instruction to store the top stack value in a static field. |
void |
rem(org.objectweb.asm.Type type)
generated the instruction to rem top two stack value |
void |
returnInsn()
|
void |
returnInsn(org.objectweb.asm.Type type)
|
void |
rightShift(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(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(org.objectweb.asm.Label tryStart,
org.objectweb.asm.Label tryEnd,
org.objectweb.asm.Label catchStart,
org.objectweb.asm.Type exceptionType)
|
void |
unbox(org.objectweb.asm.Type type)
Generates the instructions to unbox the top stack value. |
void |
unsignedRightShift(org.objectweb.asm.Type type)
|
void |
valueOf(org.objectweb.asm.Type type)
Generates the instructions to box the top stack value using Java 5's valueOf() method. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected LocalVariables locals
public static final int EQ
ifCmp method.
public static final int NE
ifCmp method.
public static final int LT
ifCmp method.
public static final int GE
ifCmp method.
public static final int GT
ifCmp method.
public static final int LE
ifCmp method.
| 构造方法详细信息 |
|---|
public InstructionHelper(org.objectweb.asm.MethodVisitor mv,
Method method)
| 方法详细信息 |
|---|
public Method 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(org.objectweb.asm.Type type)
public void pushClass(org.objectweb.asm.Type value)
value - the value to be pushed on the stack.
public void cast(org.objectweb.asm.Type from,
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(org.objectweb.asm.Type type)
type - a class or interface type.public static org.objectweb.asm.Type getBoxedType(org.objectweb.asm.Type type)
public static org.objectweb.asm.Type getUnBoxedType(org.objectweb.asm.Type type)
public void box(org.objectweb.asm.Type type)
type - the type of the top stack value.public void valueOf(org.objectweb.asm.Type type)
type - the type of the top stack value.public void unbox(org.objectweb.asm.Type type)
type - the type of the top stack value.public void mark(org.objectweb.asm.Label label)
label - a label.public void nop()
public void loadInsn(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 newInstance(org.objectweb.asm.Type type)
type - the class of the object to be created.
public void invokeVirtual(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] arguTypes)
owner - name - returnType - arguTypes -
public void invokeConstructor(org.objectweb.asm.Type ownerType,
org.objectweb.asm.Type[] argTypes)
ownerType - the class in which the constructor is defined.method - the constructor to be invoked.
public void invokeSuperMethod(org.objectweb.asm.Type ownerType,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] argTypes)
ownerType - name - returnType - argTypes -
public void invokeStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] arguTypes)
owner - name - returnType - arguTypes -
public void invokeInterface(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type[] arguTypes)
owner - name - returnType - arguTypes -
public void getStatic(org.objectweb.asm.Type owner,
String name,
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(org.objectweb.asm.Type owner,
String name,
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(org.objectweb.asm.Type owner,
String name,
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(org.objectweb.asm.Type owner,
String name,
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 add(org.objectweb.asm.Type type)
type - which add typepublic void sub(org.objectweb.asm.Type type)
type - which add typepublic void mul(org.objectweb.asm.Type type)
type - which add typepublic void div(org.objectweb.asm.Type type)
type - which add typepublic void rem(org.objectweb.asm.Type type)
type - public void neg(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(org.objectweb.asm.Type type)
type - public void bitAnd(org.objectweb.asm.Type type)
public void bitOr(org.objectweb.asm.Type type)
public void bitXor(org.objectweb.asm.Type type)
public void leftShift(org.objectweb.asm.Type type)
public void rightShift(org.objectweb.asm.Type type)
public void unsignedRightShift(org.objectweb.asm.Type type)
public void newArray(org.objectweb.asm.Type type)
type - the type of the array elements.
public void multiANewArrayInsn(org.objectweb.asm.Type type,
int dims)
type - dims - public void arrayLoad(org.objectweb.asm.Type type)
type - the type of the array element to be loaded.public void arrayStore(org.objectweb.asm.Type type)
type - the type of the array element to be stored.public void arrayLength()
public void ifCmp(org.objectweb.asm.Type type,
int mode,
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,
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(org.objectweb.asm.Label label)
label - where to jump if the condition is true.public void ifNonNull(org.objectweb.asm.Label label)
label - where to jump if the condition is true.public void goTo(org.objectweb.asm.Label label)
label - where to jump if the condition is true.public void instanceOf(org.objectweb.asm.Type type)
type - a class or interface type.
public void tryCatchBlock(org.objectweb.asm.Label tryStart,
org.objectweb.asm.Label tryEnd,
org.objectweb.asm.Label catchStart,
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(org.objectweb.asm.Type type)
public void declarationVariable(String name,
String desc,
String signature,
org.objectweb.asm.Label start,
org.objectweb.asm.Label end,
int index)
public void maxs(int stack,
int locals)
public void endMethod()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||