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.
This commit is contained in:
Ian Zerny 2022-02-04 12:18:27 +01:00
parent 6187d13f14
commit 4f4df9d54e

View File

@ -172,13 +172,11 @@ public class DexBackedMethodImplementation implements MethodImplementation {
/** /**
* Calculate and return the private size of a method implementation. * 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
* *
* @return size in bytes * @return size in bytes
*/ */
public int getSize() { public int getSize() {
int debugSize = getDebugInfo().getSize();
//set last offset just before bytecode instructions (after insns_size) //set last offset just before bytecode instructions (after insns_size)
int lastOffset = getInstructionsStartOffset(); int lastOffset = getInstructionsStartOffset();
@ -195,7 +193,7 @@ public class DexBackedMethodImplementation implements MethodImplementation {
lastOffset = ((VariableSizeListIterator)tryHandlerIter).getReaderOffset(); lastOffset = ((VariableSizeListIterator)tryHandlerIter).getReaderOffset();
} }
//method impl size = debug block size + code_item size //method impl size = code_item size
return debugSize + (lastOffset - codeOffset); return lastOffset - codeOffset;
} }
} }