aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Zerny <zerny@users.noreply.github.com>2023-02-15 11:13:12 +0100
committerGitHub <noreply@github.com>2023-02-15 11:13:12 +0100
commitd4b8e72ea672d1c2ab04b416019a541f9bad13f8 (patch)
tree281776667b77df2dfdd18756f76eb99ae999ed8a
parent4e6c503bfaf7962061a63b0f8960adfd0185173b (diff)
downloadgoogle-smali-d4b8e72ea672d1c2ab04b416019a541f9bad13f8.tar.gz
Don't include debug info in method size. (#7)
* Don't include debug info in method size. The debug info items can be shared across methods so don't count them as part of private method size.
-rw-r--r--dexlib2/src/main/java/com/android/tools/smali/dexlib2/dexbacked/DexBackedMethodImplementation.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/dexlib2/src/main/java/com/android/tools/smali/dexlib2/dexbacked/DexBackedMethodImplementation.java b/dexlib2/src/main/java/com/android/tools/smali/dexlib2/dexbacked/DexBackedMethodImplementation.java
index e8b974b8..02d3ab03 100644
--- a/dexlib2/src/main/java/com/android/tools/smali/dexlib2/dexbacked/DexBackedMethodImplementation.java
+++ b/dexlib2/src/main/java/com/android/tools/smali/dexlib2/dexbacked/DexBackedMethodImplementation.java
@@ -171,13 +171,14 @@ public class DexBackedMethodImplementation implements MethodImplementation {
/**
* Calculate and return the private size of a method implementation.
*
- * Calculated as: debug info size + instructions size + try-catch size
+ * Calculated as: instructions size + try-catch size
+ *
+ * <p>Note: debug info can be shared among multiple methods so it is not
+ * included in the method size.
*
* @return size in bytes
*/
public int getSize() {
- int debugSize = getDebugInfo().getSize();
-
//set last offset just before bytecode instructions (after insns_size)
int lastOffset = getInstructionsStartOffset();
@@ -194,7 +195,7 @@ public class DexBackedMethodImplementation implements MethodImplementation {
lastOffset = ((VariableSizeListIterator)tryHandlerIter).getReaderOffset();
}
- //method impl size = debug block size + code_item size
- return debugSize + (lastOffset - codeOffset);
+ //method impl size = code_item size
+ return lastOffset - codeOffset;
}
}