summaryrefslogtreecommitdiff
path: root/openjdkjvmti
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2020-08-31 15:03:20 +0100
committerNicolas Geoffray <ngeoffray@google.com>2020-09-07 07:29:59 +0000
commit4717175e40a19e79af904dfb7b7dd13f046debd7 (patch)
tree426f040eacf5a8305f8bb8d504bd509824d984c8 /openjdkjvmti
parent1faacf59b9f74e9d2de4e0331ef0cdfcf132225d (diff)
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
Diffstat (limited to 'openjdkjvmti')
-rw-r--r--openjdkjvmti/ti_method.cc9
-rw-r--r--openjdkjvmti/ti_redefine.cc5
2 files changed, 10 insertions, 4 deletions
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index e7f071fac8..f2646c6c45 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -190,7 +190,8 @@ jvmtiError MethodUtil::GetArgumentsSize(jvmtiEnv* env ATTRIBUTE_UNUSED,
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 @@ jvmtiError MethodUtil::GetMaxLocals(jvmtiEnv* env ATTRIBUTE_UNUSED,
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 @@ jvmtiError MethodUtil::GetMethodLocation(jvmtiEnv* env ATTRIBUTE_UNUSED,
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;
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index d442799379..afaea6279d 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -2583,7 +2583,10 @@ void Redefiner::ClassRedefinition::UpdateMethods(art::ObjPtr<art::mirror::Class>
uint32_t dex_method_idx = dex_file_->GetIndexForMethodId(*method_id);
method.SetDexMethodIndex(dex_method_idx);
linker->SetEntryPointsToInterpreter(&method);
- method.SetCodeItemOffset(dex_file_->FindCodeItemOffset(class_def, dex_method_idx));
+ if (method.HasCodeItem()) {
+ method.SetCodeItem(
+ dex_file_->GetCodeItem(dex_file_->FindCodeItemOffset(class_def, dex_method_idx)));
+ }
// Clear all the intrinsics related flags.
method.SetNotIntrinsic();
}