Disassembler d
) throws IOException {
int npads = 3 - (instructionOffset % 4);
for (int i = 0; i < npads; ++i) {
if (dis.readByte() != (byte) 0) {
throw new JaninoRuntimeException("Non-zero pad byte in \"tableswitch\"");
}
}
d.print("default => " + (instructionOffset + dis.readInt()));
int low = dis.readInt();
int high = dis.readInt();
for (int i = low; i <= high; ++i) {
int offset = dis.readInt();
d.print(", " + i + " => " + (instructionOffset + offset));
}
}
};
} else
if (s.equals("lookupswitch")) {
operand = new Operand() {
public void disasm(
DataInputStream dis,
int instructionOffset,
LocalVariableTableAttribute localVariableTableAttribute,
Disassembler d
) throws IOException {
int npads = 3 - (instructionOffset % 4);
for (int i = 0; i < npads; ++i) {
byte b = dis.readByte();
if (b != (byte) 0) d.print("Padding byte #" + i + " is " + (b & 0xff));
}
d.print("default => " + (instructionOffset + dis.readInt()));
int npairs = dis.readInt();
for (int i = 0; i < npairs; ++i) {
int match = dis.readInt();
int offset = dis.readInt();
d.print(", " + match + " => " + (instructionOffset + offset));
}
}
};
} else
if (s.equals("wide")) {
operand = new Operand() {
public void disasm(
DataInputStream dis,
int instructionOffset,
LocalVariableTableAttribute localVariableTableAttribute,
Disassembler d
) throws IOException {
int subopcode = 0xff & dis.readByte();
Instruction wideInstruction = opcodeToWideInstruction[subopcode];
if (wideInstruction == null) {
throw new JaninoRuntimeException(
"Invalid opcode "
+ subopcode
+ " after opcode WIDE"
);
}
d.disasmInstruction(
wideInstruction,
dis,
instructionOffset,
localVariableTableAttribute
);
}
};
} else
{
throw new JaninoRuntimeException("Unknown operand \"" + s + "\"");
}
l.add(operand);
}
operands = (Operand[]) l.toArray(new Operand[l.size()]);
}