Top Description Fields Constructors Methods
javassist.bytecode.analysis

public Class Executor

extends Object
implements Opcode
Class Inheritance
All Implemented Interfaces
javassist.bytecode.Opcode
Imports
javassist.ClassPool, .CtClass, .NotFoundException, javassist.bytecode.BadBytecode, .CodeIterator, .ConstPool, .Descriptor, .MethodInfo, .Opcode

Executor is responsible for modeling the effects of a JVM instruction on a frame.
Author
Jason T. Greene

Field Summary

Modifier and TypeField and Description
private final Type
private final ClassPool
private final ConstPool
private int
private final Type
private final Type

Constructor Summary

AccessConstructor and Description
public
Executor(ClassPool classPool, ConstPool constPool)

Method Summary

Modifier and TypeMethod and Description
private void
access(int index, Type type, Subroutine subroutine)

private void
evalArrayLoad(Type expectedComponent, Frame frame)

private void
evalArrayStore(Type expectedComponent, Frame frame)

private void
evalBinaryMath(Type expected, Frame frame)

private void
evalGetField(int opcode, int index, Frame frame)

private void
evalInvokeDynamic(int opcode, int index, Frame frame)

private void
evalInvokeIntfMethod(int opcode, int index, Frame frame)

private void
evalInvokeMethod(int opcode, int index, Frame frame)

private void
evalLDC(int index, Frame frame)

private void
evalLoad(Type expected, int index, Frame frame, Subroutine subroutine)

private void
evalNewArray(int pos, CodeIterator iter, Frame frame)

private void
evalNewObjectArray(int pos, CodeIterator iter, Frame frame)

private void
evalPutField(int opcode, int index, Frame frame)

private void
evalShift(Type expected, Frame frame)

private void
evalStore(Type expected, int index, Frame frame, Subroutine subroutine)

private void
evalWide(int pos, CodeIterator iter, Frame frame, Subroutine subroutine)

public void
execute(MethodInfo
the method containing the instruction
method
,
int
the position of the instruction in the method
pos
,
CodeIterator
the code iterator used to find the instruction
iter
,
Frame
the frame to modify to represent the result of the instruction
frame
,
Subroutine
the optional subroutine this instruction belongs to.
subroutine
)

Execute the instruction, modeling the effects on the specified frame and subroutine.

private Type
private Type[]
private Type
private Type
private Type
private Type
private void
simplePush(Type type, Frame frame)

private void
simpleSetLocal(int index, Type type, Frame frame)

private Type
private void
verifyAssignable(Type expected, Type type)

private Type
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLASS_TYPEback to summary
private final Type CLASS_TYPE
classPoolback to summary
private final ClassPool classPool
constPoolback to summary
private final ConstPool constPool
lastPosback to summary
private int lastPos
STRING_TYPEback to summary
private final Type STRING_TYPE
THROWABLE_TYPEback to summary
private final Type THROWABLE_TYPE

Constructor Detail

Executorback to summary
public Executor(ClassPool classPool, ConstPool constPool)

Method Detail

accessback to summary
private void access(int index, Type type, Subroutine subroutine)
evalArrayLoadback to summary
private void evalArrayLoad(Type expectedComponent, Frame frame) throws BadBytecode
evalArrayStoreback to summary
private void evalArrayStore(Type expectedComponent, Frame frame) throws BadBytecode
evalBinaryMathback to summary
private void evalBinaryMath(Type expected, Frame frame) throws BadBytecode
evalGetFieldback to summary
private void evalGetField(int opcode, int index, Frame frame) throws BadBytecode
evalInvokeDynamicback to summary
private void evalInvokeDynamic(int opcode, int index, Frame frame) throws BadBytecode
evalInvokeIntfMethodback to summary
private void evalInvokeIntfMethod(int opcode, int index, Frame frame) throws BadBytecode
evalInvokeMethodback to summary
private void evalInvokeMethod(int opcode, int index, Frame frame) throws BadBytecode
evalLDCback to summary
private void evalLDC(int index, Frame frame) throws BadBytecode
evalLoadback to summary
private void evalLoad(Type expected, int index, Frame frame, Subroutine subroutine) throws BadBytecode
evalNewArrayback to summary
private void evalNewArray(int pos, CodeIterator iter, Frame frame) throws BadBytecode
evalNewObjectArrayback to summary
private void evalNewObjectArray(int pos, CodeIterator iter, Frame frame) throws BadBytecode
evalPutFieldback to summary
private void evalPutField(int opcode, int index, Frame frame) throws BadBytecode
evalShiftback to summary
private void evalShift(Type expected, Frame frame) throws BadBytecode
evalStoreback to summary
private void evalStore(Type expected, int index, Frame frame, Subroutine subroutine) throws BadBytecode
evalWideback to summary
private void evalWide(int pos, CodeIterator iter, Frame frame, Subroutine subroutine) throws BadBytecode
executeback to summary
public void execute(MethodInfo method, int pos, CodeIterator iter, Frame frame, Subroutine subroutine) throws BadBytecode

Execute the instruction, modeling the effects on the specified frame and subroutine. If a subroutine is passed, the access flags will be modified if this instruction accesses the local variable table.

Parameters
method:MethodInfo

the method containing the instruction

pos:int

the position of the instruction in the method

iter:CodeIterator

the code iterator used to find the instruction

frame:Frame

the frame to modify to represent the result of the instruction

subroutine:Subroutine

the optional subroutine this instruction belongs to.

Exceptions
BadBytecode:
if the bytecode violates the jvm spec
getTypeback to summary
private Type getType(String name) throws BadBytecode
paramTypesFromDescback to summary
private Type[] paramTypesFromDesc(String desc) throws BadBytecode
resolveClassInfoback to summary
private Type resolveClassInfo(String info) throws BadBytecode
returnTypeFromDescback to summary
private Type returnTypeFromDesc(String desc) throws BadBytecode
simplePeekback to summary
private Type simplePeek(Frame frame)
simplePopback to summary
private Type simplePop(Frame frame)
simplePushback to summary
private void simplePush(Type type, Frame frame)
simpleSetLocalback to summary
private void simpleSetLocal(int index, Type type, Frame frame)
typeFromDescback to summary
private Type typeFromDesc(String desc) throws BadBytecode
verifyAssignableback to summary
private void verifyAssignable(Type expected, Type type) throws BadBytecode
zeroExtendback to summary
private Type zeroExtend(Type type)