mirror of
https://github.com/revanced/smali.git
synced 2025-06-13 12:37:37 +02:00
Add "support" for odexed instructions using Format3rms
Also, change the name of the invoke-*-range-quick opcodes to invoke-*-quick/range, to be consistent with the naming scheme of non-odexed opcodes git-svn-id: https://smali.googlecode.com/svn/trunk@542 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
@ -53,8 +53,8 @@ public class UnresolvedNullReferenceMethodItem extends InstructionFormatMethodIt
|
||||
template.setAttribute("Register", formatRegister(instruction.ObjectRegisterNum));
|
||||
switch (instruction.OriginalInstruction.opcode)
|
||||
{
|
||||
case INVOKE_VIRTUAL_RANGE_QUICK:
|
||||
case INVOKE_SUPER_RANGE_QUICK:
|
||||
case INVOKE_VIRTUAL_QUICK_RANGE:
|
||||
case INVOKE_SUPER_QUICK_RANGE:
|
||||
template.setAttribute("UseInvokeRange", 1);
|
||||
if (isLastInstruction) {
|
||||
template.setAttribute("AddGoto", 1);
|
||||
|
@ -263,10 +263,9 @@ public enum Opcode
|
||||
IPUT_WIDE_QUICK((byte)0xf6, "iput-wide-quick", ReferenceType.none, Format.Format22cs, true),
|
||||
IPUT_OBJECT_QUICK((byte)0xf7, "iput-object-quick", ReferenceType.none, Format.Format22cs, true),
|
||||
INVOKE_VIRTUAL_QUICK((byte)0xf8, "invoke-virtual-quick", ReferenceType.none, Format.Format35ms, true),
|
||||
INVOKE_VIRTUAL_RANGE_QUICK((byte)0xf9, "invoke-virtual-range-quick", ReferenceType.none, Format.Format3rms, true),
|
||||
INVOKE_VIRTUAL_QUICK_RANGE((byte)0xf9, "invoke-virtual-quick/range", ReferenceType.none, Format.Format3rms, true),
|
||||
INVOKE_SUPER_QUICK((byte)0xfa, "invoke-super-quick", ReferenceType.none, Format.Format35ms, true),
|
||||
INVOKE_SUPER_RANGE_QUICK((byte)0xfb, "invoke-super-range-quick", ReferenceType.none, Format.Format3rms, true);
|
||||
|
||||
INVOKE_SUPER_QUICK_RANGE((byte)0xfb, "invoke-super-quick/range", ReferenceType.none, Format.Format3rms, true);
|
||||
|
||||
|
||||
private static Opcode[] opcodesByValue;
|
||||
|
@ -126,9 +126,9 @@ public class DeodexUtil {
|
||||
instructionThrowTable.set(Opcode.IPUT_WIDE_QUICK.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.IPUT_OBJECT_QUICK.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.INVOKE_VIRTUAL_QUICK.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.INVOKE_VIRTUAL_RANGE_QUICK.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.INVOKE_VIRTUAL_QUICK_RANGE.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.INVOKE_SUPER_QUICK.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.INVOKE_SUPER_RANGE_QUICK.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.INVOKE_SUPER_QUICK_RANGE.value & 0xFF);
|
||||
instructionThrowTable.set(Opcode.INVOKE_DIRECT_EMPTY.value & 0xFF);
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ public class DeodexUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case INVOKE_VIRTUAL_RANGE_QUICK:
|
||||
case INVOKE_VIRTUAL_QUICK_RANGE:
|
||||
{
|
||||
Instruction3rms ins = ((Instruction3rms)i.instruction);
|
||||
int registerNum = ins.getStartRegister();
|
||||
@ -716,7 +716,7 @@ public class DeodexUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case INVOKE_SUPER_RANGE_QUICK:
|
||||
case INVOKE_SUPER_QUICK_RANGE:
|
||||
{
|
||||
Instruction3rms ins = ((Instruction3rms)i.instruction);
|
||||
int registerNum = ins.getStartRegister();
|
||||
@ -909,8 +909,8 @@ public class DeodexUtil {
|
||||
case INVOKE_SUPER_QUICK:
|
||||
objectRegisterNum = ((Instruction35ms)instruction).getRegisterD();
|
||||
break;
|
||||
case INVOKE_VIRTUAL_RANGE_QUICK:
|
||||
case INVOKE_SUPER_RANGE_QUICK:
|
||||
case INVOKE_VIRTUAL_QUICK_RANGE:
|
||||
case INVOKE_SUPER_QUICK_RANGE:
|
||||
objectRegisterNum = ((Instruction3rms)instruction).getStartRegister();
|
||||
break;
|
||||
default:
|
||||
|
@ -451,6 +451,13 @@ INSTRUCTION_FORMAT3rc_TYPE_PHRASE
|
||||
WS? COMMA_EMIT WS?
|
||||
NONVOID_TYPE_DESCRIPTOR_EMITCHILD;
|
||||
|
||||
INSTRUCTION_FORMAT3rms_METHOD_PHRASE
|
||||
: INSTRUCTION_FORMAT3rms_METHOD_EMIT
|
||||
WS
|
||||
REGISTER_RANGE_EMITCHILDREN
|
||||
WS? COMMA_EMIT WS?
|
||||
VTABLE_OFFSET_EMIT;
|
||||
|
||||
INSTRUCTION_FORMAT51l_PHRASE
|
||||
: INSTRUCTION_FORMAT51l_EMIT
|
||||
WS
|
||||
@ -1494,6 +1501,13 @@ fragment INSTRUCTION_FORMAT3rc_TYPE_EMIT
|
||||
fragment INSTRUCTION_FORMAT3rc_TYPE
|
||||
: 'filled-new-array/range';
|
||||
|
||||
fragment INSTRUCTION_FORMAT3rms_METHOD_EMIT
|
||||
: INSTRUCTION_FORMAT3rms_METHOD {emit($INSTRUCTION_FORMAT3rms_METHOD, INSTRUCTION_FORMAT3rms_METHOD);};
|
||||
fragment INSTRUCTION_FORMAT3rms_METHOD
|
||||
: 'invoke-virtual-quick/range'
|
||||
| 'invoke-super-quick/range'
|
||||
;
|
||||
|
||||
fragment INSTRUCTION_FORMAT51l_EMIT
|
||||
: INSTRUCTION_FORMAT51l {emit($INSTRUCTION_FORMAT51l, INSTRUCTION_FORMAT51l);};
|
||||
INSTRUCTION_FORMAT51l
|
||||
|
@ -459,6 +459,11 @@ instruction returns [int size]
|
||||
| //e.g. filled-new-array/range {v0..v6} I
|
||||
INSTRUCTION_FORMAT3rc_TYPE OPEN_BRACE register_range CLOSE_BRACE nonvoid_type_descriptor {$size = Format.Format3rc.size;}
|
||||
-> ^(I_STATEMENT_FORMAT3rc_TYPE[$start, "I_STATEMENT_FORMAT3rc_TYPE"] INSTRUCTION_FORMAT3rc_TYPE register_range nonvoid_type_descriptor)
|
||||
| //e.g. invoke-virtual-quick/range {v0 .. v10}, vtable@0x14
|
||||
INSTRUCTION_FORMAT3rms_METHOD OPEN_BRACE register_range CLOSE_BRACE VTABLE_OFFSET
|
||||
{
|
||||
throw new OdexedInstructionException(input, $INSTRUCTION_FORMAT3rms_METHOD.text);
|
||||
}
|
||||
| //e.g. const-wide v0, 5000000000L
|
||||
INSTRUCTION_FORMAT51l REGISTER fixed_literal {$size = Format.Format51l.size;}
|
||||
-> ^(I_STATEMENT_FORMAT51l[$start, "I_STATEMENT_FORMAT51l"] INSTRUCTION_FORMAT51l REGISTER fixed_literal)
|
||||
|
Reference in New Issue
Block a user