mirror of
https://github.com/revanced/smali.git
synced 2025-05-20 07:57:06 +02:00
Add some required runReadAction wrappers in SmaliCodeFragmentFactory
This commit is contained in:
parent
e6da8cd564
commit
6649a75532
@ -192,9 +192,13 @@ public class SmaliCodeFragmentFactory extends DefaultCodeFragmentFactory {
|
||||
@Override protected void action() throws Exception {
|
||||
int registerNumber = Integer.parseInt(name.substring(1));
|
||||
if (name.charAt(0) == 'p') {
|
||||
registerNumber += containingMethod.getRegisterCount() -
|
||||
registerNumber += ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
|
||||
@Override public Integer compute() {
|
||||
return containingMethod.getRegisterCount() -
|
||||
containingMethod.getParameterRegisterCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
Value value = evaluateRegister(debuggerContext.createEvaluationContext(),
|
||||
containingMethod,
|
||||
registerNumber,
|
||||
@ -265,15 +269,24 @@ public class SmaliCodeFragmentFactory extends DefaultCodeFragmentFactory {
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
private static int mapRegisterForArt(SmaliMethod smaliMethod, int register) {
|
||||
private static int mapRegisterForArt(final SmaliMethod smaliMethod, final int register) {
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
|
||||
@Override public Integer compute() {
|
||||
|
||||
int totalRegisters = smaliMethod.getRegisterCount();
|
||||
int parameterRegisters = smaliMethod.getParameterRegisterCount();
|
||||
|
||||
if (smaliMethod.getModifierList().hasModifierProperty("static")) {
|
||||
return register;
|
||||
}
|
||||
|
||||
// For ART, the parameter registers are rotated to the front
|
||||
if (register >= (totalRegisters - parameterRegisters)) {
|
||||
return register - (totalRegisters - parameterRegisters);
|
||||
}
|
||||
return register + parameterRegisters;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user