Move code item to the data pointer and remove code_item_offset.
This saves 4 bytes on 32bit and 8 bytes on 64bit on ArtMethod.
Also update nterp to directly fetch the code item from the data pointer.
Test: test.py
Bug: 112676029
Change-Id: Ic01f43c7ccf2cbce1ec517478e81362232d36371
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index e7f071f..f2646c6 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -190,7 +190,8 @@
return ERR(NONE);
}
- DCHECK_NE(art_method->GetCodeItemOffset(), 0u);
+ DCHECK(art_method->HasCodeItem());
+ DCHECK_NE(art_method->GetCodeItem(), nullptr);
*size_ptr = art_method->DexInstructionData().InsSize();
return ERR(NONE);
@@ -306,7 +307,8 @@
return ERR(NONE);
}
- DCHECK_NE(art_method->GetCodeItemOffset(), 0u);
+ DCHECK(art_method->HasCodeItem());
+ DCHECK_NE(art_method->GetCodeItem(), nullptr);
*max_ptr = art_method->DexInstructionData().RegistersSize();
return ERR(NONE);
@@ -420,7 +422,8 @@
return ERR(NONE);
}
- DCHECK_NE(art_method->GetCodeItemOffset(), 0u);
+ DCHECK(art_method->HasCodeItem());
+ DCHECK_NE(art_method->GetCodeItem(), nullptr);
*start_location_ptr = 0;
*end_location_ptr = art_method->DexInstructions().InsnsSizeInCodeUnits() - 1;