Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

InstructionFactory Class Reference

Inheritance diagram for InstructionFactory:
[legend]
Collaboration diagram for InstructionFactory:
[legend]
List of all members.

Public Methods

 InstructionFactory (ClassGen cg)
Instruction createCast (Type src_type, Type dest_type)
CHECKCAST createCheckCast (ReferenceType t)
GETFIELD createGetField (String class_name, String name, Type t)
GETSTATIC createGetStatic (String class_name, String name, Type t)
InvokeInstruction createInvoke (String class_name, String name, Type ret_type, Type[] arg_types, short kind)
NEW createNew (ObjectType t)
NEW createNew (String s)
AllocationInstruction createNewArray (Type t, short dim)
PUTFIELD createPutField (String class_name, String name, Type t)
PUTSTATIC createPutStatic (String class_name, String name, Type t)
 InstructionFactory (ClassGen cg)
 InstructionFactory (ClassGen cg, ConstantPoolGen cp)
 InstructionFactory (ConstantPoolGen cp)
Instruction createCast (Type src_type, Type dest_type)
CHECKCAST createCheckCast (ReferenceType t)
FieldInstruction createFieldAccess (String class_name, String name, Type type, short kind)
GETFIELD createGetField (String class_name, String name, Type t)
GETSTATIC createGetStatic (String class_name, String name, Type t)
InvokeInstruction createInvoke (String class_name, String name, Type ret_type, Type[] arg_types, short kind)
NEW createNew (ObjectType t)
NEW createNew (String s)
AllocationInstruction createNewArray (Type t, short dim)
PUTFIELD createPutField (String class_name, String name, Type t)
PUTSTATIC createPutStatic (String class_name, String name, Type t)
ClassGen getClassGen ()
ConstantPoolGen getConstantPool ()
void setClassGen (ClassGen c)
void setConstantPool (ConstantPoolGen c)

Static Public Methods

ArrayInstruction createArrayLoad (Type type)
ArrayInstruction createArrayStore (Type type)
ArithmeticInstruction createBinaryOperation (String op, Type type)
StackInstruction createDup (int size)
StackInstruction createDup_1 (int size)
StackInstruction createDup_2 (int size)
LocalVariableInstruction createLoad (Type type, int index)
Instruction createNull (Type type)
StackInstruction createPop (int size)
ReturnInstruction createReturn (Type type)
LocalVariableInstruction createStore (Type type, int index)
Instruction createThis ()
ArrayInstruction createArrayLoad (Type type)
ArrayInstruction createArrayStore (Type type)
ArithmeticInstruction createBinaryOperation (String op, Type type)
BranchInstruction createBranchInstruction (short opcode, InstructionHandle target)
StackInstruction createDup (int size)
StackInstruction createDup_1 (int size)
StackInstruction createDup_2 (int size)
LocalVariableInstruction createLoad (Type type, int index)
Instruction createNull (Type type)
StackInstruction createPop (int size)
ReturnInstruction createReturn (Type type)
LocalVariableInstruction createStore (Type type, int index)
Instruction createThis ()

Protected Attributes

ClassGen cg
ConstantPoolGen cp

Static Private Methods

final ArithmeticInstruction createBinaryDoubleOp (char op)
final ArithmeticInstruction createBinaryFloatOp (char op)
final ArithmeticInstruction createBinaryIntOp (char first, String op)
final ArithmeticInstruction createBinaryLongOp (char first, String op)
final ArithmeticInstruction createBinaryDoubleOp (char op)
final ArithmeticInstruction createBinaryFloatOp (char op)
final ArithmeticInstruction createBinaryIntOp (char first, String op)
final ArithmeticInstruction createBinaryLongOp (char first, String op)

Detailed Description

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.

Version:
Id:
InstructionFactory.java,v 1.1.1.1 2002/01/24 03:44:05 pserver Exp
Author:
M. Dahm

Definition at line 14 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.


Constructor & Destructor Documentation

InstructionFactory::InstructionFactory ClassGen   cg [inline]
 

Need a ClassGen object to obtain a constant pool, e.g.

Definition at line 20 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

InstructionFactory::InstructionFactory ClassGen   cg [inline]
 

Initialize with ClassGen object

Definition at line 20 of file src/de/fub/bytecode/generic/InstructionFactory.java.

InstructionFactory::InstructionFactory ConstantPoolGen   cp [inline]
 

Initialize just with ConstantPoolGen object

Definition at line 29 of file src/de/fub/bytecode/generic/InstructionFactory.java.


Member Function Documentation

ArrayInstruction InstructionFactory::createArrayLoad Type   type [inline, static]
 

Parameters:
type   type of elements of array, i.e., array.getElementType()

Definition at line 35 of file src/de/fub/bytecode/generic/InstructionFactory.java.

ArrayInstruction InstructionFactory::createArrayLoad Type   type [inline, static]
 

Parameters:
type   type of elements of array, i.e. array.getElementType()

Definition at line 27 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

ArrayInstruction InstructionFactory::createArrayStore Type   type [inline, static]
 

Parameters:
type   type of elements of array, i.e., array.getElementType()

Definition at line 53 of file src/de/fub/bytecode/generic/InstructionFactory.java.

ArrayInstruction InstructionFactory::createArrayStore Type   type [inline, static]
 

Parameters:
type   type of elements of array, i.e. array.getElementType()

Definition at line 45 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

ArithmeticInstruction InstructionFactory::createBinaryOperation String   op,
Type   type
[inline, static]
 

Create binary operation for simple basic types, such as int and float.

Parameters:
op   operation, such as "+", "*", "<<", etc.

Definition at line 123 of file src/de/fub/bytecode/generic/InstructionFactory.java.

ArithmeticInstruction InstructionFactory::createBinaryOperation String   op,
Type   type
[inline, static]
 

Create binary operation for simple basic types, such as int and float.

Parameters:
op   operation, such as "+", "*", "<<", etc.

Definition at line 115 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

BranchInstruction InstructionFactory::createBranchInstruction short   opcode,
InstructionHandle   target
[inline, static]
 

Create branch instruction by given opcode, except LOOKUPSWITCH and TABLESWITCH. For those you should use the SWITCH compeund instruction.

Definition at line 140 of file src/de/fub/bytecode/generic/InstructionFactory.java.

Instruction InstructionFactory::createCast Type   src_type,
Type   dest_type
[inline]
 

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.

Definition at line 169 of file src/de/fub/bytecode/generic/InstructionFactory.java.

Instruction InstructionFactory::createCast Type   src_type,
Type   dest_type
[inline]
 

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.

Definition at line 132 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createDup int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 209 of file src/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createDup int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 172 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createDup_1 int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 216 of file src/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createDup_1 int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 179 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createDup_2 int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 223 of file src/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createDup_2 int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 186 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

FieldInstruction InstructionFactory::createFieldAccess String   class_name,
String   name,
Type   type,
short   kind
[inline]
 

Create a field instruction.

Parameters:
class_name   name of the accessed class
name   name of the referenced field
type   type of field
kind   how to access, i.e., GETFIELD, PUTFIELD, GETSTATIC, PUTSTATIC

Definition at line 234 of file src/de/fub/bytecode/generic/InstructionFactory.java.

InvokeInstruction InstructionFactory::createInvoke String   class_name,
String   name,
Type   ret_type,
Type   arg_types[],
short   kind
[inline]
 

Create an invoke instruction.

Parameters:
class_name   name of the called class
name   name of the called method
ret_type   return type of method
arg_types   argument types of method
kind   how to invoke, i.e., INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL, or INVOKESPECIAL

Definition at line 265 of file src/de/fub/bytecode/generic/InstructionFactory.java.

InvokeInstruction InstructionFactory::createInvoke String   class_name,
String   name,
Type   ret_type,
Type   arg_types[],
short   kind
[inline]
 

Create an invoke instruction.

Parameters:
class_name   name of the called class
name   name of the called method
ret_type   return type of method
arg_types   argument types of method
kind   how to invoke, i.e. INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL, or INVOKESPECIAL

Definition at line 205 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

LocalVariableInstruction InstructionFactory::createLoad Type   type,
int   index
[inline, static]
 

Parameters:
index   index of local variable

Definition at line 291 of file src/de/fub/bytecode/generic/InstructionFactory.java.

LocalVariableInstruction InstructionFactory::createLoad Type   type,
int   index
[inline, static]
 

Parameters:
index   index of local variable

Definition at line 231 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

AllocationInstruction InstructionFactory::createNewArray Type   t,
short   dim
[inline]
 

Create new array of given size and type.

Definition at line 314 of file src/de/fub/bytecode/generic/InstructionFactory.java.

AllocationInstruction InstructionFactory::createNewArray Type   t,
short   dim
[inline]
 

Create new array of given size and type.

Definition at line 254 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

Instruction InstructionFactory::createNull Type   type [inline, static]
 

Create "null" value for reference types, 0 for basic types like int

Definition at line 335 of file src/de/fub/bytecode/generic/InstructionFactory.java.

Instruction InstructionFactory::createNull Type   type [inline, static]
 

Create "null" value for reference types, 0 for basic types like int

Definition at line 298 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createPop int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 356 of file src/de/fub/bytecode/generic/InstructionFactory.java.

StackInstruction InstructionFactory::createPop int   size [inline, static]
 

Parameters:
size   size of operand, either 1 (int, e.g.) or 2 (double)

Definition at line 319 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

ReturnInstruction InstructionFactory::createReturn Type   type [inline, static]
 

Create typed return

Definition at line 368 of file src/de/fub/bytecode/generic/InstructionFactory.java.

ReturnInstruction InstructionFactory::createReturn Type   type [inline, static]
 

Create typed return

Definition at line 331 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

LocalVariableInstruction InstructionFactory::createStore Type   type,
int   index
[inline, static]
 

Parameters:
index   index of local variable

Definition at line 389 of file src/de/fub/bytecode/generic/InstructionFactory.java.

LocalVariableInstruction InstructionFactory::createStore Type   type,
int   index
[inline, static]
 

Parameters:
index   index of local variable

Definition at line 352 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.

Instruction InstructionFactory::createThis   [inline, static]
 

Create reference to `this'

Definition at line 406 of file src/de/fub/bytecode/generic/InstructionFactory.java.

Instruction InstructionFactory::createThis   [inline, static]
 

Create reference to `this'

Definition at line 369 of file lib/jpf/de/fub/bytecode/generic/InstructionFactory.java.


The documentation for this class was generated from the following files:
Generated at Thu Feb 7 07:16:42 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001