mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 20:20:12 +02:00
Fix an issue with instance-of type inference
We should only infer the register type after an if-eqz/nez if it has a single predecessor that is the instance-of instruction.
This commit is contained in:
parent
9ec379a561
commit
26a4f1e603
@ -368,7 +368,8 @@ public class AnalyzedInstruction implements Comparable<AnalyzedInstruction> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instruction.getOpcode() == Opcode.IF_EQZ || instruction.getOpcode() == Opcode.IF_NEZ) {
|
if (getPredecessorCount() == 1 && (instruction.getOpcode() == Opcode.IF_EQZ ||
|
||||||
|
instruction.getOpcode() == Opcode.IF_NEZ)) {
|
||||||
AnalyzedInstruction previousInstruction = getPreviousInstruction();
|
AnalyzedInstruction previousInstruction = getPreviousInstruction();
|
||||||
if (previousInstruction != null &&
|
if (previousInstruction != null &&
|
||||||
previousInstruction.instruction.getOpcode() == Opcode.INSTANCE_OF &&
|
previousInstruction.instruction.getOpcode() == Opcode.INSTANCE_OF &&
|
||||||
|
@ -1206,7 +1206,10 @@ public class MethodAnalyzer {
|
|||||||
private void analyzeIfEqzNez(@Nonnull AnalyzedInstruction analyzedInstruction) {
|
private void analyzeIfEqzNez(@Nonnull AnalyzedInstruction analyzedInstruction) {
|
||||||
int instructionIndex = analyzedInstruction.getInstructionIndex();
|
int instructionIndex = analyzedInstruction.getInstructionIndex();
|
||||||
if (instructionIndex > 0) {
|
if (instructionIndex > 0) {
|
||||||
AnalyzedInstruction prevAnalyzedInstruction = analyzedInstructions.valueAt(instructionIndex - 1);
|
if (analyzedInstruction.getPredecessorCount() != 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AnalyzedInstruction prevAnalyzedInstruction = analyzedInstruction.getPredecessors().first();
|
||||||
if (prevAnalyzedInstruction.instruction.getOpcode() == Opcode.INSTANCE_OF) {
|
if (prevAnalyzedInstruction.instruction.getOpcode() == Opcode.INSTANCE_OF) {
|
||||||
if (canNarrowAfterInstanceOf(prevAnalyzedInstruction, analyzedInstruction, classPath)) {
|
if (canNarrowAfterInstanceOf(prevAnalyzedInstruction, analyzedInstruction, classPath)) {
|
||||||
List<Integer> narrowingRegisters = Lists.newArrayList();
|
List<Integer> narrowingRegisters = Lists.newArrayList();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user