mirror of
https://github.com/revanced/Apktool.git
synced 2024-08-15 03:40:34 +02:00
69 lines
3.1 KiB
Diff
69 lines
3.1 KiB
Diff
|
From 687b92094889a90a70afc4e153ac24659a7e2beb Mon Sep 17 00:00:00 2001
|
||
|
From: Connor Tumbleson <connor.tumbleson@gmail.com>
|
||
|
Date: Wed, 14 Oct 2015 06:08:13 -0500
|
||
|
Subject: baksmali: added DIFFPRE reg info
|
||
|
|
||
|
---
|
||
|
.../Adaptors/PreInstructionRegisterInfoMethodItem.java | 18 ++++++++++++++++++
|
||
|
.../src/main/java/org/jf/baksmali/baksmaliOptions.java | 2 ++
|
||
|
2 files changed, 20 insertions(+)
|
||
|
|
||
|
diff --git a/baksmali/src/main/java/org/jf/baksmali/Adaptors/PreInstructionRegisterInfoMethodItem.java b/baksmali/src/main/java/org/jf/baksmali/Adaptors/PreInstructionRegisterInfoMethodItem.java
|
||
|
index f532938..5699cf0 100644
|
||
|
--- a/baksmali/src/main/java/org/jf/baksmali/Adaptors/PreInstructionRegisterInfoMethodItem.java
|
||
|
+++ b/baksmali/src/main/java/org/jf/baksmali/Adaptors/PreInstructionRegisterInfoMethodItem.java
|
||
|
@@ -40,6 +40,8 @@ import java.io.IOException;
|
||
|
import java.util.BitSet;
|
||
|
|
||
|
public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||
|
+ private static AnalyzedInstruction lastInstruction;
|
||
|
+
|
||
|
private final int registerInfo;
|
||
|
@Nonnull private final MethodAnalyzer methodAnalyzer;
|
||
|
@Nonnull private final RegisterFormatter registerFormatter;
|
||
|
@@ -77,6 +79,9 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||
|
if ((registerInfo & baksmaliOptions.ARGS) != 0) {
|
||
|
addArgsRegs(registers);
|
||
|
}
|
||
|
+ if ((registerInfo & baksmaliOptions.DIFFPRE) != 0) {
|
||
|
+ addDiffRegs(registers);
|
||
|
+ }
|
||
|
if ((registerInfo & baksmaliOptions.MERGE) != 0) {
|
||
|
if (analyzedInstruction.isBeginningInstruction()) {
|
||
|
addParamRegs(registers, registerCount);
|
||
|
@@ -144,6 +149,19 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+ private void addDiffRegs(BitSet registers) {
|
||
|
+ if (! analyzedInstruction.isBeginningInstruction()) {
|
||
|
+ for (int i = 0; i < analyzedInstruction.getRegisterCount(); i++) {
|
||
|
+ if (lastInstruction.getPreInstructionRegisterType(i).category !=
|
||
|
+ analyzedInstruction.getPreInstructionRegisterType(i).category) {
|
||
|
+ registers.set(i);
|
||
|
+ }
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ lastInstruction = analyzedInstruction;
|
||
|
+ }
|
||
|
+
|
||
|
private void addMergeRegs(BitSet registers, int registerCount) {
|
||
|
if (analyzedInstruction.getPredecessorCount() <= 1) {
|
||
|
//in the common case of an instruction that only has a single predecessor which is the previous
|
||
|
diff --git a/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java b/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java
|
||
|
index 5dd060f..fc2ffc5 100644
|
||
|
--- a/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java
|
||
|
+++ b/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java
|
||
|
@@ -53,6 +53,8 @@ public class baksmaliOptions {
|
||
|
public static final int MERGE = 32;
|
||
|
public static final int FULLMERGE = 64;
|
||
|
|
||
|
+ public static final int DIFFPRE = 128;
|
||
|
+
|
||
|
public int apiLevel = 15;
|
||
|
public String outputDirectory = "out";
|
||
|
@Nullable public String dexEntry = null;
|
||
|
--
|
||
|
2.1.4
|