|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ibm.wala.shrikeBT.Decoder
public abstract class Decoder
A Decoder translates a method's Java bytecode into shrikeBT code, i.e. an array of Instruction objects and an array of lists of ExceptionHandlers. This class implements basic decoding functionality. A toolkit for reading class files must specialize this class with particular constant pool reader implementation. Normal usage of this class looks like this:
Decoder d = new MyToolkitDecoder(...);
try {
d.decode();
} catch (Decoder.InvalidBytecodeException ex) {
...
}
Instruction[] myInstructions = d.getInstructions();
ExceptionHandler[][] exnHandlers = d.getHandlers();
| Nested Class Summary | |
|---|---|
static class |
Decoder.InvalidBytecodeException
This exception is thrown when the Decoder detects invalid incoming bytecode (code that would not pass the Java verifier). |
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
protected |
Decoder(byte[] code,
int[] rawHandlers,
ConstantPoolReader cp)
This constructor is only supposed to be used by subclasses. |
| Method Summary | |
|---|---|
void |
decode()
Perform the decoding. |
ConstantPoolReader |
getConstantPool()
|
ExceptionHandler[][] |
getHandlers()
Get the decoded exception handlers. |
Instruction[] |
getInstructions()
Get the decoded instructions. |
int[] |
getInstructionsToBytecodes()
Get the mapping between instructions and input bytecodes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Decoder(byte[] code,
int[] rawHandlers,
ConstantPoolReader cp)
code - the bytecodes for a method as per JVM specrawHandlers - flattened array of (startPC, endPC, targetPC, classIndex) tuples
defined as per the JVM spec| Method Detail |
|---|
public ConstantPoolReader getConstantPool()
public final void decode()
throws Decoder.InvalidBytecodeException
Decoder.InvalidBytecodeException - the incoming code is invalid and would fail Java bytecode
verificationpublic final Instruction[] getInstructions()
public final ExceptionHandler[][] getHandlers()
public final int[] getInstructionsToBytecodes()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||