|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.classfile.AbstractInstructionAccessor
org.multijava.util.classfile.Instruction
org.multijava.util.classfile.SwitchInstruction
Some instructions are persnickety enough that its simpler to write them separately instead of smushing them with all the rest. The multiarray instruction is one of them.
| Field Summary | |
private InstructionAccessor |
deflab
|
private int[] |
matches
|
private int |
pad
|
private InstructionAccessor[] |
targets
|
| Fields inherited from class org.multijava.util.classfile.Instruction |
|
| Constructor Summary | |
private |
SwitchInstruction(InstructionAccessor deflab)
Helper constructor |
|
SwitchInstruction(InstructionAccessor deflab,
int[] matches,
InstructionAccessor[] targets)
Constructs a switch instruction |
|
SwitchInstruction(InstructionAccessor deflab,
ArrayList matches,
ArrayList targets)
Constructs a switch instruction |
| Method Summary | |
boolean |
canComplete()
Returns true iff control flow can reach the next instruction in textual order. |
(package private) void |
check(CodeEnv env,
int curStack)
Verifies the enclosed instruction and computes the stack height. |
(package private) void |
computeEndAddress(CodePosition position)
Computes the address of the end of the instruction. |
private int |
computeSize(int start)
Compute the size of this instruction |
int |
getMatch(int position)
Returns the case's value at a position |
int |
getPushedOnStack()
Returns the size of data pushed on the stack by this instruction |
byte |
getReturnType()
Returns the type pushed on the stack |
(package private) int |
getSize()
Returns the number of bytes used by the the instruction in the code array. |
int |
getStack()
Return the amount of stack (positive or negative) used by this instruction |
int |
getSwitchCount()
Gets the number of 'case' |
InstructionAccessor |
getTarget(int position)
Returns the target at a position |
(package private) void |
resolveConstants(ConstantPool cp)
Insert or check location of constant value on constant pool |
void |
selectSwitchType()
Select the appropriate switch type (tableswitch or lookupswitch) |
void |
setTarget(int position,
InstructionAccessor accessor)
Returns the target at a position |
void |
setTarget(InstructionAccessor target,
int position)
Sets the target for this instruction |
private static void |
sort(int[] matches,
InstructionAccessor[] instrs)
Bubble sort an array |
void |
transformAccessors(AccessorTransformer transformer)
Transforms targets (deferences to actual instructions). |
(package private) void |
write(ConstantPool cp,
DataOutput out)
Write this instruction into a file |
| Methods inherited from class org.multijava.util.classfile.Instruction |
dump, getAddress, getLocalVar, getOpcode, getPoppedFromStack, isLiteral, setAddress, setOpcode |
| Methods inherited from class org.multijava.util.classfile.AbstractInstructionAccessor |
transform |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private int pad
private InstructionAccessor deflab
private int[] matches
private InstructionAccessor[] targets
| Constructor Detail |
private SwitchInstruction(InstructionAccessor deflab)
public SwitchInstruction(InstructionAccessor deflab,
int[] matches,
InstructionAccessor[] targets)
deflab - default target for switchmatches - array of match values to compare the key totargets - array of target instructions for each match value
public SwitchInstruction(InstructionAccessor deflab,
ArrayList matches,
ArrayList targets)
deflab - default target for switchmatches - list of match values to compare the key totargets - list of target instructions for each match value| Method Detail |
public boolean canComplete()
public void transformAccessors(AccessorTransformer transformer)
throws BadAccessorException
transformAccessors in interface AccessorContainertransformer - the transformer used to transform accessors
BadAccessorException
public void setTarget(InstructionAccessor target,
int position)
public int getSwitchCount()
public int getMatch(int position)
public InstructionAccessor getTarget(int position)
public void setTarget(int position,
InstructionAccessor accessor)
public void selectSwitchType()
int getSize()
public byte getReturnType()
void check(CodeEnv env,
int curStack)
throws ClassFileFormatException
check in class Instructionenv - the check environmentcurStack - the stack height at the end
of the execution of the instruction
ClassFileFormatException - a problem was detectedvoid computeEndAddress(CodePosition position)
computeEndAddress in class Instructionposition - the minimum and maximum address of the
begin of this instruction. This parameter
is changed to the minimum and maximum
address of the end of this instruction.public int getPushedOnStack()
public int getStack()
void resolveConstants(ConstantPool cp)
cp - the constant pool for this class
void write(ConstantPool cp,
DataOutput out)
throws IOException
cp - the constant pool that contain all dataout - the file where to write this object info
IOException - an io problem has occuredprivate int computeSize(int start)
private static final void sort(int[] matches,
InstructionAccessor[] instrs)
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||