harpoon.IR.Bytecode
Class InSwitch
java.lang.Object
harpoon.IR.Bytecode.Instr
harpoon.IR.Bytecode.InCti
harpoon.IR.Bytecode.InSwitch
- All Implemented Interfaces:
- HCodeElement, CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>, Graph.Node<Instr,harpoon.IR.Bytecode.InstrEdge>, Comparable<Instr>
public class InSwitch
- extends InCti
InSwitch is used for the tableswitch and
lookupswitch java bytecode instructions.
It is a control-transfer instruction. It should have exactly
one predecessor. The first successor will be the default
target; each subsequent successor corresponds to a case
of the switch statement; the match key can be looked up using the
key method.
- Version:
- $Id: InSwitch.java,v 1.3 2002/02/25 21:04:17 cananian Exp $
- Author:
- C. Scott Ananian <cananian@alumni.princeton.edu>
- See Also:
Instr
|
Constructor Summary |
InSwitch(String sourcefile,
int linenumber,
byte[] code,
int pc)
Constructor. |
|
Method Summary |
int |
key(int index)
Returns the case key corresponding to the given branch target index. |
String |
toString()
Return human-readable instruction string. |
| Methods inherited from class harpoon.IR.Bytecode.Instr |
compareTo, edgeC, edges, equals, getID, getLineNumber, getSourceFile, hashCode, isPred, isSucc, newEdge, next, next, pred, predC, prev, prev, succ, succC |
InSwitch
public InSwitch(String sourcefile,
int linenumber,
byte[] code,
int pc)
- Constructor. Creates an
InSwitch from a chunk of
bytecode starting at the given pc.
- Throws:
Error - if the opcode at code[pc] doesn't
correspond to a tableswitch or
lookupswitch.
key
public int key(int index)
- Returns the case key corresponding to the given branch target index.
InSwitch.key(n) corresponds to
InSwitch.next()[n] for
0.
- Throws:
Error - if the default target or
an instruction not corresponding to a target is given.
toString
public String toString()
- Return human-readable instruction string.
- Overrides:
toString in class InCti