|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.aspectj.apache.bcel.generic.InstructionFactory
public class InstructionFactory
Instances of this class may be used, e.g., to generate typed versions of instructions. Its main purpose is to be used as the byte code generating backend of a compiler. You can subclass it to add your own create methods.
Constants
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.aspectj.apache.bcel.generic.InstructionConstants |
---|
InstructionConstants.Clinit |
Field Summary | |
---|---|
protected ClassGen |
cg
|
protected ConstantPool |
cp
|
Constructor Summary | |
---|---|
InstructionFactory(ClassGen cg)
|
|
InstructionFactory(ClassGen cg,
ConstantPool cp)
|
|
InstructionFactory(ConstantPool cp)
|
Method Summary | |
---|---|
static Instruction |
createALOAD(int n)
|
static Instruction |
createArrayLoad(Type type)
|
static Instruction |
createArrayStore(Type type)
|
static Instruction |
createASTORE(int n)
|
static InstructionBranch |
createBranchInstruction(short opcode,
InstructionHandle target)
Create branch instruction by given opcode, except LOOKUPSWITCH and TABLESWITCH. |
Instruction |
createCast(Type src_type,
Type dest_type)
Create conversion operation for two stack operands, this may be an I2C, instruction, e.g., if the operands are basic types and CHECKCAST if they are reference types. |
Instruction |
createCheckCast(ReferenceType t)
|
Instruction |
createConstant(java.lang.Object value)
Uses PUSH to push a constant value onto the stack. |
static Instruction |
createDup_1(int size)
|
static Instruction |
createDup_2(int size)
|
static Instruction |
createDup(int size)
|
FieldInstruction |
createFieldAccess(java.lang.String class_name,
java.lang.String name,
Type type,
short kind)
Create a field instruction. |
FieldInstruction |
createGetField(java.lang.String class_name,
java.lang.String name,
Type t)
|
FieldInstruction |
createGetStatic(java.lang.String class_name,
java.lang.String name,
Type t)
|
Instruction |
createInstanceOf(ReferenceType t)
|
InvokeInstruction |
createInvoke(java.lang.String class_name,
java.lang.String name,
java.lang.String signature,
short kind)
|
InvokeInstruction |
createInvoke(java.lang.String class_name,
java.lang.String name,
Type ret_type,
Type[] arg_types,
short kind)
Create an invoke instruction. |
static InstructionLV |
createLoad(Type type,
int index)
|
Instruction |
createNew(ObjectType t)
|
Instruction |
createNew(java.lang.String s)
|
Instruction |
createNewArray(Type t,
short dim)
Create new array of given size and type. |
static Instruction |
createNull(Type type)
Create "null" value for reference types, 0 for basic types like int |
static Instruction |
createPop(int size)
|
FieldInstruction |
createPutField(java.lang.String class_name,
java.lang.String name,
Type t)
|
FieldInstruction |
createPutStatic(java.lang.String class_name,
java.lang.String name,
Type t)
|
static Instruction |
createReturn(Type type)
Create typed return |
static InstructionLV |
createStore(Type type,
int index)
|
static Instruction |
createThis()
Create reference to `this' |
ClassGen |
getClassGen()
|
ConstantPool |
getConstantPool()
|
static Instruction |
PUSH(ConstantPool cp,
boolean value)
|
static Instruction |
PUSH(ConstantPool cp,
java.lang.Boolean value)
|
static Instruction |
PUSH(ConstantPool cp,
java.lang.Character value)
|
static Instruction |
PUSH(ConstantPool cp,
double value)
|
static Instruction |
PUSH(ConstantPool cp,
float value)
|
static Instruction |
PUSH(ConstantPool cp,
int value)
Returns the right instruction for putting whatever you want onto the stack |
static Instruction |
PUSH(ConstantPool cp,
long value)
|
static Instruction |
PUSH(ConstantPool cp,
java.lang.Number value)
|
static Instruction |
PUSH(ConstantPool cp,
ObjectType t)
|
static Instruction |
PUSH(ConstantPool cp,
java.lang.String value)
|
InstructionList |
PUSHCLASS(ConstantPool cp,
java.lang.String className)
Return a list that will load the Class object - on 1.5 or later use the class variant of ldc, whilst on earlier JVMs use the regular Class.forName. |
void |
setClassGen(ClassGen c)
|
void |
setConstantPool(ConstantPool c)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ClassGen cg
protected ConstantPool cp
Constructor Detail |
---|
public InstructionFactory(ClassGen cg, ConstantPool cp)
public InstructionFactory(ClassGen cg)
public InstructionFactory(ConstantPool cp)
Method Detail |
---|
public InvokeInstruction createInvoke(java.lang.String class_name, java.lang.String name, Type ret_type, Type[] arg_types, short kind)
class_name
- name of the called classname
- name of the called methodret_type
- return type of methodarg_types
- argument types of methodkind
- how to invoke, i.e., INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL, or INVOKESPECIALConstants
public InvokeInstruction createInvoke(java.lang.String class_name, java.lang.String name, java.lang.String signature, short kind)
public static Instruction createALOAD(int n)
public static Instruction createASTORE(int n)
public Instruction createConstant(java.lang.Object value)
value
- must be of type Number, Boolean, Character or Stringpublic FieldInstruction createFieldAccess(java.lang.String class_name, java.lang.String name, Type type, short kind)
class_name
- name of the accessed classname
- name of the referenced fieldtype
- type of fieldkind
- how to access, i.e., GETFIELD, PUTFIELD, GETSTATIC, PUTSTATICConstants
public static Instruction createThis()
public static Instruction createReturn(Type type)
public static Instruction createPop(int size)
size
- size of operand, either 1 (int, e.g.) or 2 (double)public static Instruction createDup(int size)
size
- size of operand, either 1 (int, e.g.) or 2 (double)public static Instruction createDup_2(int size)
size
- size of operand, either 1 (int, e.g.) or 2 (double)public static Instruction createDup_1(int size)
size
- size of operand, either 1 (int, e.g.) or 2 (double)public static InstructionLV createStore(Type type, int index)
index
- index of local variablepublic static InstructionLV createLoad(Type type, int index)
index
- index of local variablepublic static Instruction createArrayLoad(Type type)
type
- type of elements of array, i.e., array.getElementType()public static Instruction createArrayStore(Type type)
type
- type of elements of array, i.e., array.getElementType()public Instruction createCast(Type src_type, Type dest_type)
public FieldInstruction createGetField(java.lang.String class_name, java.lang.String name, Type t)
public FieldInstruction createGetStatic(java.lang.String class_name, java.lang.String name, Type t)
public FieldInstruction createPutField(java.lang.String class_name, java.lang.String name, Type t)
public FieldInstruction createPutStatic(java.lang.String class_name, java.lang.String name, Type t)
public Instruction createCheckCast(ReferenceType t)
public Instruction createInstanceOf(ReferenceType t)
public Instruction createNew(ObjectType t)
public Instruction createNew(java.lang.String s)
public Instruction createNewArray(Type t, short dim)
public static Instruction createNull(Type type)
public static InstructionBranch createBranchInstruction(short opcode, InstructionHandle target)
public void setClassGen(ClassGen c)
public ClassGen getClassGen()
public void setConstantPool(ConstantPool c)
public ConstantPool getConstantPool()
public static Instruction PUSH(ConstantPool cp, int value)
public static Instruction PUSH(ConstantPool cp, ObjectType t)
public static Instruction PUSH(ConstantPool cp, boolean value)
public static Instruction PUSH(ConstantPool cp, float value)
public static Instruction PUSH(ConstantPool cp, long value)
public static Instruction PUSH(ConstantPool cp, double value)
public static Instruction PUSH(ConstantPool cp, java.lang.String value)
public static Instruction PUSH(ConstantPool cp, java.lang.Number value)
public static Instruction PUSH(ConstantPool cp, java.lang.Character value)
public static Instruction PUSH(ConstantPool cp, java.lang.Boolean value)
public InstructionList PUSHCLASS(ConstantPool cp, java.lang.String className)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |