mirror of
https://github.com/revanced/smali.git
synced 2025-04-30 14:44:26 +02:00
added support for 45cc and METHOD_PROTO
This commit is contained in:
parent
3fb538f202
commit
c70b71709f
@ -657,6 +657,9 @@ public class MutableMethodImplementation implements MethodImplementation {
|
|||||||
case Format3rms:
|
case Format3rms:
|
||||||
setInstruction(location, newBuilderInstruction3rms((Instruction3rms)instruction));
|
setInstruction(location, newBuilderInstruction3rms((Instruction3rms)instruction));
|
||||||
return;
|
return;
|
||||||
|
case Format45cc:
|
||||||
|
setInstruction(location, newBuilderInstruction45cc((Instruction45cc) instruction));
|
||||||
|
return;
|
||||||
case Format51l:
|
case Format51l:
|
||||||
setInstruction(location, newBuilderInstruction51l((Instruction51l)instruction));
|
setInstruction(location, newBuilderInstruction51l((Instruction51l)instruction));
|
||||||
return;
|
return;
|
||||||
@ -948,6 +951,21 @@ public class MutableMethodImplementation implements MethodImplementation {
|
|||||||
instruction.getVtableIndex());
|
instruction.getVtableIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private BuilderInstruction45cc newBuilderInstruction45cc(@Nonnull Instruction45cc instruction) {
|
||||||
|
return new BuilderInstruction45cc(
|
||||||
|
instruction.getOpcode(),
|
||||||
|
instruction.getRegisterCount(),
|
||||||
|
instruction.getRegisterC(),
|
||||||
|
instruction.getRegisterD(),
|
||||||
|
instruction.getRegisterE(),
|
||||||
|
instruction.getRegisterF(),
|
||||||
|
instruction.getRegisterG(),
|
||||||
|
instruction.getReference(),
|
||||||
|
instruction.getReference2()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private BuilderInstruction51l newBuilderInstruction51l(@Nonnull Instruction51l instruction) {
|
private BuilderInstruction51l newBuilderInstruction51l(@Nonnull Instruction51l instruction) {
|
||||||
return new BuilderInstruction51l(
|
return new BuilderInstruction51l(
|
||||||
|
@ -65,6 +65,8 @@ public class InstructionRewriter implements Rewriter<Instruction> {
|
|||||||
return new RewrittenInstruction35c((Instruction35c)instruction);
|
return new RewrittenInstruction35c((Instruction35c)instruction);
|
||||||
case Format3rc:
|
case Format3rc:
|
||||||
return new RewrittenInstruction3rc((Instruction3rc)instruction);
|
return new RewrittenInstruction3rc((Instruction3rc)instruction);
|
||||||
|
case Format45cc:
|
||||||
|
return new RewrittenInstruction45cc((Instruction45cc) instruction);
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
@ -202,4 +204,57 @@ public class InstructionRewriter implements Rewriter<Instruction> {
|
|||||||
return instruction.getRegisterCount();
|
return instruction.getRegisterCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected class RewrittenInstruction45cc extends BaseRewrittenReferenceInstruction<Instruction45cc>
|
||||||
|
implements Instruction45cc {
|
||||||
|
public RewrittenInstruction45cc(@Nonnull Instruction45cc instruction) {
|
||||||
|
super(instruction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull public Reference getReference2() {
|
||||||
|
switch (instruction.getReferenceType2()) {
|
||||||
|
case ReferenceType.TYPE:
|
||||||
|
return RewriterUtils.rewriteTypeReference(rewriters.getTypeRewriter(),
|
||||||
|
(TypeReference)instruction.getReference2());
|
||||||
|
case ReferenceType.FIELD:
|
||||||
|
return rewriters.getFieldReferenceRewriter().rewrite((FieldReference)instruction.getReference2());
|
||||||
|
case ReferenceType.METHOD:
|
||||||
|
return rewriters.getMethodReferenceRewriter().rewrite((MethodReference)instruction.getReference2());
|
||||||
|
case ReferenceType.STRING:
|
||||||
|
return instruction.getReference2();
|
||||||
|
case ReferenceType.METHOD_PROTO:
|
||||||
|
return instruction.getReference2();
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getReferenceType2() {
|
||||||
|
return instruction.getReferenceType2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRegisterC() {
|
||||||
|
return instruction.getRegisterC();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRegisterE() {
|
||||||
|
return instruction.getRegisterE();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRegisterG() {
|
||||||
|
return instruction.getRegisterG();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRegisterCount() {
|
||||||
|
return instruction.getRegisterCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRegisterD() {
|
||||||
|
return instruction.getRegisterD();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRegisterF() {
|
||||||
|
return instruction.getRegisterF();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ public class ClassPool extends BasePool<String, PoolClassDef> implements ClassSe
|
|||||||
internReference(refInst.getReference(), refInst.getReferenceType());
|
internReference(refInst.getReference(), refInst.getReferenceType());
|
||||||
}
|
}
|
||||||
if (instruction instanceof DualReferenceInstruction) {
|
if (instruction instanceof DualReferenceInstruction) {
|
||||||
DualReferenceInstruction dualRefInst = (DualReferenceInstruction)instruction;
|
DualReferenceInstruction dualRefInst = (DualReferenceInstruction) instruction;
|
||||||
internReference(dualRefInst.getReference2(), dualRefInst.getReferenceType2());
|
internReference(dualRefInst.getReference2(), dualRefInst.getReferenceType2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user