summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 5de7adf365..45562c46c1 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1949,6 +1949,7 @@ bool ClassLinker::AddImageSpace(
if (!runtime->IsAotCompiler()) {
ScopedTrace trace("AppImage:UpdateCodeItemAndNterp");
bool can_use_nterp = interpreter::CanRuntimeUseNterp();
+ uint16_t hotness_threshold = runtime->GetJITOptions()->GetWarmupThreshold();
header.VisitPackedArtMethods([&](ArtMethod& method) REQUIRES_SHARED(Locks::mutator_lock_) {
// In the image, the `data` pointer field of the ArtMethod contains the code
// item offset. Change this to the actual pointer to the code item.
@@ -1958,7 +1959,7 @@ bool ClassLinker::AddImageSpace(
method.SetCodeItem(code_item);
// The hotness counter may have changed since we compiled the image, so
// reset it with the runtime value.
- method.ResetCounter();
+ method.ResetCounter(hotness_threshold);
}
// Set image methods' entry point that point to the interpreter bridge to the
// nterp entry point.
@@ -3687,6 +3688,7 @@ void ClassLinker::LoadClass(Thread* self,
uint32_t last_dex_method_index = dex::kDexNoIndex;
size_t last_class_def_method_index = 0;
+ uint16_t hotness_threshold = runtime->GetJITOptions()->GetWarmupThreshold();
// Use the visitor since the ranged based loops are bit slower from seeking. Seeking to the
// methods needs to decode all of the fields.
accessor.VisitFieldsAndMethods([&](
@@ -3720,11 +3722,13 @@ void ClassLinker::LoadClass(Thread* self,
last_dex_method_index = it_method_index;
last_class_def_method_index = class_def_method_index;
}
+ art_method->ResetCounter(hotness_threshold);
++class_def_method_index;
}, [&](const ClassAccessor::Method& method) REQUIRES_SHARED(Locks::mutator_lock_) {
ArtMethod* art_method = klass->GetVirtualMethodUnchecked(
class_def_method_index - accessor.NumDirectMethods(),
image_pointer_size_);
+ art_method->ResetCounter(hotness_threshold);
LoadMethod(dex_file, method, klass, art_method);
LinkCode(this, art_method, oat_class_ptr, class_def_method_index);
++class_def_method_index;