//we search in the map defining the bytecode if whe have the value read
if (mBytecode.containsKey(methodInfo.getBytecodes().get(i))) {
//we clone the object describing the opcode in the map
OpCode myOp = (OpCode) mBytecode.get(methodInfo.getBytecodes().get(i)).clone();
//we add it in our opcodeMap
methodInfo.getOpcodeMap().put((short) (i + byteCodeOffset), myOp);
i++;
//we'll read the argument of the opcode
for (Argument a : myOp.getArguments()) {
a.setValue(new byte[a.getSize()]);
for (int j = 0; j < a.getSize(); j++) {
a.getValue()[j] = methodInfo.getBytecodes().get(i++);
}
}
// specific case management
// we will manage the case of opcode wich have
// a variable number of argument
switch (myOp.getValue()) {
case 0x73: //case of stableswitch
case 0x74: //case of itableswitch
short low = (short) ((myOp.getArguments().get(1).getValue()[0] << 8) | myOp.getArguments().get(1).getValue()[1]);
short high = (short) ((myOp.getArguments().get(2).getValue()[0] << 8) | myOp.getArguments().get(2).getValue()[1]);
//whe should add (high - low) + 1 pairs in the argument array
for (int j = 0; j < (high - low) + 1; j++) {
//we get the value of the pair
byte[] value = new byte[2];
value[0] = methodInfo.getBytecodes().get(i++);
value[1] = methodInfo.getBytecodes().get(i++);
Offset o = new Offset(value, (short) 2, true, Destination.BYTECODE);
myOp.getArguments().add(o);
}
break;
case 0x75: //case of slookupswitch
case 0x76: //case of ilookupswitch
short npair = (short) (myOp.getArguments().get(1).getValue()[0] >> 8 | myOp.getArguments().get(1).getValue()[1]);
for (int j = 0; j < npair; j++) {
//we create the operand describing the matchByte 1 and 2
byte[] value = new byte[2];
value[0] = methodInfo.getBytecodes().get(i++);
value[1] = methodInfo.getBytecodes().get(i++);
Operand op = new Operand(value, (short) 2, true);
myOp.getArguments().add(op);
//we create the offset
value=new byte[2];
value[0] = methodInfo.getBytecodes().get(i++);
value[1] = methodInfo.getBytecodes().get(i++);
Offset off = new Offset(value, (short) 2, true, Destination.BYTECODE);
myOp.getArguments().add(off);
}
break;