mirror of
https://github.com/revanced/smali.git
synced 2025-05-04 08:34:25 +02:00
Add support for blank register ranges
This commit is contained in:
parent
de5b35dbb6
commit
8d323b3c48
@ -603,7 +603,7 @@ register_list
|
||||
| ->^(I_REGISTER_LIST[$start, "I_REGISTER_LIST"]);
|
||||
|
||||
register_range
|
||||
: REGISTER (DOTDOT REGISTER)? -> ^(I_REGISTER_RANGE[$start, "I_REGISTER_RANGE"] REGISTER REGISTER?);
|
||||
: (startreg=REGISTER (DOTDOT endreg=REGISTER)?)? -> ^(I_REGISTER_RANGE[$start, "I_REGISTER_RANGE"] $startreg? $endreg?);
|
||||
|
||||
verification_error_reference
|
||||
: CLASS_DESCRIPTOR | fully_qualified_field | fully_qualified_method;
|
||||
|
@ -895,22 +895,24 @@ register_list[int totalMethodRegisters, int methodParameterRegisters] returns[by
|
||||
})*);
|
||||
|
||||
register_range[int totalMethodRegisters, int methodParameterRegisters] returns[int startRegister, int endRegister]
|
||||
: ^(I_REGISTER_RANGE startReg=REGISTER endReg=REGISTER?)
|
||||
: ^(I_REGISTER_RANGE (startReg=REGISTER endReg=REGISTER?)?)
|
||||
{
|
||||
$startRegister = parseRegister_short($startReg.text, $totalMethodRegisters, $methodParameterRegisters);
|
||||
if ($endReg == null) {
|
||||
$endRegister = $startRegister;
|
||||
} else {
|
||||
$endRegister = parseRegister_short($endReg.text, $totalMethodRegisters, $methodParameterRegisters);
|
||||
}
|
||||
if ($startReg == null) {
|
||||
$startRegister = 0;
|
||||
$endRegister = -1;
|
||||
} else {
|
||||
$startRegister = parseRegister_short($startReg.text, $totalMethodRegisters, $methodParameterRegisters);
|
||||
if ($endReg == null) {
|
||||
$endRegister = $startRegister;
|
||||
} else {
|
||||
$endRegister = parseRegister_short($endReg.text, $totalMethodRegisters, $methodParameterRegisters);
|
||||
}
|
||||
|
||||
int registerCount = $endRegister-$startRegister+1;
|
||||
if (registerCount > 256) {
|
||||
throw new SemanticException(input, $I_REGISTER_RANGE, "A register range can span a maximum of 256 registers");
|
||||
}
|
||||
if (registerCount < 1) {
|
||||
throw new SemanticException(input, $I_REGISTER_RANGE, "A register range must have the lower register listed first");
|
||||
}
|
||||
int registerCount = $endRegister-$startRegister+1;
|
||||
if (registerCount < 1) {
|
||||
throw new SemanticException(input, $I_REGISTER_RANGE, "A register range must have the lower register listed first");
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user