|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> services >> [ bytecode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.services.bytecode
Class CodeChunk

java.lang.Objectorg.apache.derby.impl.services.bytecode.CodeChunk
- class CodeChunk
- extends java.lang.Object
This class represents a chunk of code in a CodeAttribute. Typically, a CodeAttribute represents the code in a method. If there is a try/catch block, each catch block will get its own code chunk. This allows the catch blocks to all be put at the end of the generated code for a method, which eliminates the need to generate a jump around each catch block, which would be a forward reference.
| Field Summary | |
(package private) static short[] |
ARRAY_ACCESS
|
(package private) static short[] |
ARRAY_STORE
|
(package private) static short[][][] |
CAST_CONVERSION_INFO
|
private int |
codeOffset
|
private org.apache.derby.iapi.services.classfile.ClassFormatOutput |
cout
|
(package private) static short[] |
LOAD_VARIABLE
|
(package private) static short[] |
LOAD_VARIABLE_FAST
|
(package private) static short[] |
RETURN_OPCODE
|
(package private) static short[] |
STORE_VARIABLE
|
(package private) static short[] |
STORE_VARIABLE_FAST
|
| Constructor Summary | |
(package private) |
CodeChunk(boolean main)
|
| Method Summary | |
(package private) void |
addChunk(CodeChunk other)
Add an arbitrary array of bytes |
(package private) void |
addInstr(short opcode)
Add an instruction that has no opcodes. |
(package private) void |
addInstrCPE(short opcode,
int cpeNum)
This takes an instruction that has a narrow and a wide form for CPE access, and generates accordingly the right one. |
(package private) void |
addInstrU1(short opcode,
int operand)
|
(package private) void |
addInstrU2(short opcode,
int operand)
|
(package private) void |
addInstrU2U1U1(short opcode,
int operand1,
short operand2,
short operand3)
For adding an instruction with 3 operands, a U2 and two U1's. |
(package private) void |
addInstrWide(short opcode,
int varNum)
This takes an instruction that can be wrapped in a wide for large variable #s and does so. |
(package private) void |
complete(org.apache.derby.iapi.services.classfile.ClassHolder ch,
org.apache.derby.iapi.services.classfile.ClassMember method,
int maxStack,
int maxLocals)
wrap up the entry and stuff it in the class, now that it holds all of the instructions and the exception table. |
(package private) void |
fixLengths(int maxStack,
int maxLocals,
int codeLength)
now that we have codeBytes, fix the lengths fields in it to reflect what was stored. |
(package private) org.apache.derby.iapi.services.classfile.ClassFormatOutput |
getCout()
Get the ClassFormatOutput |
int |
getRelativePC()
Get the current PC |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
LOAD_VARIABLE
static final short[] LOAD_VARIABLE
LOAD_VARIABLE_FAST
static final short[] LOAD_VARIABLE_FAST
STORE_VARIABLE
static final short[] STORE_VARIABLE
STORE_VARIABLE_FAST
static final short[] STORE_VARIABLE_FAST
ARRAY_ACCESS
static final short[] ARRAY_ACCESS
ARRAY_STORE
static final short[] ARRAY_STORE
RETURN_OPCODE
static final short[] RETURN_OPCODE
CAST_CONVERSION_INFO
static final short[][][] CAST_CONVERSION_INFO
codeOffset
private int codeOffset
cout
private final org.apache.derby.iapi.services.classfile.ClassFormatOutput cout
| Constructor Detail |
CodeChunk
CodeChunk(boolean main)
| Method Detail |
addInstr
void addInstr(short opcode)
- Add an instruction that has no opcodes.
All instructions are 1 byte large.
addInstrU2
void addInstrU2(short opcode,
int operand)
addInstrU1
void addInstrU1(short opcode,
int operand)
addInstrCPE
void addInstrCPE(short opcode,
int cpeNum)
- This takes an instruction that has a narrow
and a wide form for CPE access, and
generates accordingly the right one.
We assume the narrow instruction is what
we were given, and that the wide form is
the next possible instruction.
addInstrWide
void addInstrWide(short opcode,
int varNum)
- This takes an instruction that can be wrapped in
a wide for large variable #s and does so.
REVISIT: could hide this in addInstrU2?
addInstrU2U1U1
void addInstrU2U1U1(short opcode,
int operand1,
short operand2,
short operand3)
- For adding an instruction with 3 operands, a U2 and two U1's.
So far, this is used by VMOpcode.INVOKEINTERFACE.
addChunk
void addChunk(CodeChunk other)
- Add an arbitrary array of bytes
getCout
org.apache.derby.iapi.services.classfile.ClassFormatOutput getCout()
- Get the ClassFormatOutput
getRelativePC
public int getRelativePC()
- Get the current PC
fixLengths
void fixLengths(int maxStack,
int maxLocals,
int codeLength)
- now that we have codeBytes, fix the lengths fields in it
to reflect what was stored.
complete
void complete(org.apache.derby.iapi.services.classfile.ClassHolder ch, org.apache.derby.iapi.services.classfile.ClassMember method, int maxStack, int maxLocals)
- wrap up the entry and stuff it in the class,
now that it holds all of the instructions and
the exception table.
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> services >> [ bytecode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.impl.services.bytecode.CodeChunk