gnu.jel
Class ClassFile

java.lang.Object
  |
  +--gnu.jel.ClassFile
All Implemented Interfaces:
java.lang.Cloneable

public class ClassFile
extends java.lang.Object
implements java.lang.Cloneable

This class represents a classfile image in JEL.


Field Summary
protected  int currJump
           
protected  LocalMethod currMethod
           
protected  boolean invert_next_jump
           
static java.lang.Class[] specialClasses
           
static java.lang.reflect.Member[] specialMethods
           
protected  gnu.jel.PatchableByteArrayOutputStream textData
           
protected  TypesStack typesStk
           
 
Constructor Summary
ClassFile(int modifiers, java.lang.String name, java.lang.Class superClass, java.lang.Class[] interfaces, LocalField[] fields)
          Starts creation of a new class file.
 
Method Summary
 void branch_end()
          Finishes generation of code for conditional.
 void branch_false()
          Starts generation of code when condition is "true".
 void branch_true()
          Starts generation of code when condition is "true".
 java.lang.Object clone()
          Makes a clone of this object.
 void code(long op)
           
 void codeB(long op)
           
 void codeI(int ind)
           
 void codeLDC(java.lang.Object o, int primitiveID)
           
 void codeM(java.lang.reflect.Member m)
           
protected  void ensure_jump()
           
protected  void ensure_value()
           
 byte[] getImage()
           
 int getIndex(java.lang.Object item, int typeid)
          Used to determine an old CP index or to create a new one for an item.
protected  void labels_block()
           
protected  void labels_unblock_not()
           
protected  void labels_unblock()
           
protected  void logical_end(boolean and)
           
protected  void logical_param(boolean and)
           
 void newMethod(LocalMethod m, java.lang.Class[] vars)
          Starts a new method of this class.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textData

protected gnu.jel.PatchableByteArrayOutputStream textData

currMethod

protected LocalMethod currMethod

typesStk

protected TypesStack typesStk

currJump

protected int currJump

invert_next_jump

protected boolean invert_next_jump

specialClasses

public static final java.lang.Class[] specialClasses

specialMethods

public static final java.lang.reflect.Member[] specialMethods
Constructor Detail

ClassFile

public ClassFile(int modifiers,
                 java.lang.String name,
                 java.lang.Class superClass,
                 java.lang.Class[] interfaces,
                 LocalField[] fields)
Starts creation of a new class file.

Sizes of fAccess, fNames and fTypes arrays must be the same.

Parameters:
modifiers - sum of one or more of PUBLIC, FINAL, INTERFACE, ABSTRACT constants of java.lang.reflect.Modifier
name - is the name of new class (must be in Java historical form, i.e. with dots replaced by slashes '/')
superClass - is the superclass of this class
interfaces - array of interfaces this class implements
fAccess - array of modifiers for each field, each modifier can be a sum of one or more of PUBLIC, PRIVATE, PROTECTED, STATIC, FINAL, VOLATILE, TRANSIENT constants defined in java.lang.reflect.Modifier
fNames - array of names of all fields.
fTypes - array of Classes representing types of all fields.
Method Detail

clone

public java.lang.Object clone()
Makes a clone of this object.
Overrides:
clone in class java.lang.Object
Returns:
a clone of this object

newMethod

public void newMethod(LocalMethod m,
                      java.lang.Class[] vars)
Starts a new method of this class.
Parameters:
m - method descriptor.
vars - types of local variables..

getImage

public byte[] getImage()

labels_block

protected void labels_block()

labels_unblock

protected void labels_unblock()

labels_unblock_not

protected void labels_unblock_not()

ensure_jump

protected final void ensure_jump()

ensure_value

protected final void ensure_value()

branch_true

public void branch_true()
Starts generation of code when condition is "true".

branch_false

public void branch_false()
Starts generation of code when condition is "true".

branch_end

public void branch_end()
Finishes generation of code for conditional.
See Also:
branch_true()

logical_param

protected void logical_param(boolean and)

logical_end

protected void logical_end(boolean and)

codeB

public final void codeB(long op)

codeM

public final void codeM(java.lang.reflect.Member m)

code

public final void code(long op)

codeLDC

public final void codeLDC(java.lang.Object o,
                          int primitiveID)

codeI

public final void codeI(int ind)

getIndex

public int getIndex(java.lang.Object item,
                    int typeid)
Used to determine an old CP index or to create a new one for an item.
Parameters:
item - an item to create or get an index for
typeid - identifies type of argument to avoid linear searches
Returns:
index for an item (negative if it has to be written)