|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--edu.wisc.cs.java.Bytecode
|
+--edu.wisc.cs.java.Switch
This is the superclass for instructions which imlement multiway branch statements.
| Field Summary | |
protected CodeLabel |
default_offset
The byte offset of the first instruction in the default case. |
protected int |
pad
The padding between the opcode and the table from the classfile. |
protected CodeLabel[] |
targets
The array of offsets for this jump table. |
| Fields inherited from class edu.wisc.cs.java.Bytecode |
opcode,
params,
wide |
| Constructor Summary | |
protected |
Switch(int pad)
Constructs a new Switch object. |
| Method Summary | |
void |
adjustPad(int pc)
Given a program counter value for this instruction, adjust the size of the pad accordingly. |
CodeLabel |
getDefault()
Returns the label corresponding to the default target of this switch. |
int |
getNBytes()
Returns the number of bytes needed to represent this instruction. |
int |
getNTargets()
Returns the number of entries in the jump table. |
int |
getPad()
Returns the number of pad bytes between the opcode and the table. |
abstract int |
getParamBytes()
Abstract method which should be implemented to return the number of bytes required to encode the parameters for this instruction. |
CodeLabel |
getTarget(int i)
Returns a label corresponding to a case in the jump table. |
abstract void |
writeTo(java.io.DataOutputStream out,
java.util.HashMap labels,
int pc)
Writes a switch instruction to a stream in the specified format. |
| Methods inherited from class edu.wisc.cs.java.Bytecode |
getConstantIndex,
getOpcode,
isWide,
toString,
writeTo |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected CodeLabel default_offset
protected CodeLabel[] targets
protected int pad
| Constructor Detail |
protected Switch(int pad)
pad - the number of bytes of padding between the opcode and the table.| Method Detail |
public abstract int getParamBytes()
public abstract void writeTo(java.io.DataOutputStream out,
java.util.HashMap labels,
int pc)
throws java.io.IOException
out - a stream to which to write the data for this instruction.labels - a map comtaining the labels in the method and their pc's.pc - the program counter for this instruction.public CodeLabel getDefault()
public void adjustPad(int pc)
pc - the program counter value for this instruction.public int getPad()
public int getNTargets()
public CodeLabel getTarget(int i)
i - the index into the jump table of the desired label.public int getNBytes()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||