|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.jel.ClassFile
This class represents a classfile image in JEL.
Field Summary | |
protected int |
currJump
|
protected LocalMethod |
currMethod
|
protected boolean |
invert_next_jump
|
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. |
protected void |
code(int op)
|
protected void |
codeI(int ind)
|
protected void |
codeLDC(java.lang.Object o,
int primitiveID)
|
protected void |
ensure_jump()
|
protected void |
ensure_value()
|
byte[] |
getImage()
|
protected int |
getIndex(java.lang.Object item,
int typeid)
Used to determine an old CP index or to create a new one for an item. |
static java.lang.String |
getSignature(java.lang.Class cls)
Computes the signature of the given class. |
static java.lang.String |
getSignature(Member m)
Computes signature of the given member. |
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)
|
static void |
main(java.lang.String[] args)
Performs unitary test of the code generator. |
void |
newMethod(LocalMethod m,
java.lang.Class[] vars)
Starts a new method of this class. |
static void |
test(Tester t)
Performs unitary test of the code generator. |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected gnu.jel.PatchableByteArrayOutputStream textData
protected LocalMethod currMethod
protected TypesStack typesStk
protected int currJump
protected boolean invert_next_jump
Constructor Detail |
public ClassFile(int modifiers, java.lang.String name, java.lang.Class superClass, java.lang.Class[] interfaces, LocalField[] fields)
Sizes of fAccess, fNames and fTypes arrays must be the same.
modifiers
- sum of one or more of PUBLIC, FINAL,
INTERFACE, ABSTRACT
constants of java.lang.reflect.Modifiername
- is the name of new class (can be null to denote that the
unique name should be automatically generated and belong to
gnu.jel.generated package)superClass
- is the superclass of this classinterfaces
- array of interfaces this class implementsfAccess
- 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.ModifierfNames
- array of names of all fields.fTypes
- array of Classes representing types of all fields.Method Detail |
public java.lang.Object clone()
public void newMethod(LocalMethod m, java.lang.Class[] vars)
m
- method descriptor.vars
- types of local variables..public byte[] getImage()
protected void labels_block()
protected void labels_unblock()
protected void labels_unblock_not()
protected final void ensure_jump()
protected final void ensure_value()
public void branch_true()
public void branch_false()
public void branch_end()
branch_true()
protected void logical_param(boolean and)
protected void logical_end(boolean and)
protected final void code(int op)
protected final void codeLDC(java.lang.Object o, int primitiveID)
protected final void codeI(int ind)
protected int getIndex(java.lang.Object item, int typeid)
item
- an item to create or get an index fortypeid
- identifies type of argument to avoid linear searchespublic static java.lang.String getSignature(Member m)
m
- the member to compute the sugnature of.public static java.lang.String getSignature(java.lang.Class cls)
The signature of the class (Field descriptor) is the string and it's format is described in the paragraph 4.3.2 of the Java VM specification (ISBN 0-201-63451-1).
The same can be done using java.lang.Class.getName() by converting it's result into the "historical form".
This utility method can be used outside of the JEL package it does not involve any JEL specific assumptions and should follow JVM Specification precisely.
cls
- is the class to compute the signature of. Can be primitive or
array type.public static void main(java.lang.String[] args)
args
- ignored.public static void test(Tester t)
Used if all package is being tested and not just codegen.
t
- Tester to report test results.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |