summaryrefslogtreecommitdiff
path: root/runtime/art_method-inl.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2021-11-15 14:02:07 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2021-11-24 14:04:12 +0000
commit58f916cd6ce9eaeba7b4dbb96c3c77d636f64be5 (patch)
tree7186d7b3da40f110f487abcb9574a2f848336b36 /runtime/art_method-inl.h
parent24d589eae75239486b512a8e624aee83bba0c315 (diff)
Replace the nterp threshold with the warmup threshold.
Replace a hardcoded value with one that can be changed at the command line. Test: test.py Change-Id: I638da5b5cc2e56aa0857d2bf0862a2f8c2020949
Diffstat (limited to 'runtime/art_method-inl.h')
-rw-r--r--runtime/art_method-inl.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index 69eaef90df..29886ab42a 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -33,6 +33,7 @@
#include "gc_root-inl.h"
#include "imtable-inl.h"
#include "intrinsics_enum.h"
+#include "jit/jit.h"
#include "jit/profiling_info.h"
#include "mirror/class-inl.h"
#include "mirror/dex_cache-inl.h"
@@ -423,16 +424,20 @@ inline CodeItemDebugInfoAccessor ArtMethod::DexInstructionDebugInfo() {
return CodeItemDebugInfoAccessor(*GetDexFile(), GetCodeItem(), GetDexMethodIndex());
}
-inline bool ArtMethod::CounterHasChanged() {
+inline bool ArtMethod::CounterHasChanged(uint16_t threshold) {
DCHECK(!IsAbstract());
- return hotness_count_ != interpreter::kNterpHotnessMask;
+ DCHECK_EQ(threshold, Runtime::Current()->GetJITOptions()->GetWarmupThreshold());
+ return hotness_count_ != threshold;
}
-inline void ArtMethod::ResetCounter() {
- DCHECK(!IsAbstract());
+inline void ArtMethod::ResetCounter(uint16_t new_value) {
+ if (IsAbstract()) {
+ return;
+ }
+ DCHECK_EQ(new_value, Runtime::Current()->GetJITOptions()->GetWarmupThreshold());
// Avoid dirtying the value if possible.
- if (hotness_count_ != interpreter::kNterpHotnessMask) {
- hotness_count_ = interpreter::kNterpHotnessMask;
+ if (hotness_count_ != new_value) {
+ hotness_count_ = new_value;
}
}
@@ -461,10 +466,11 @@ inline bool ArtMethod::CounterIsHot() {
return hotness_count_ == 0;
}
-inline bool ArtMethod::CounterHasReached(uint16_t samples) {
+inline bool ArtMethod::CounterHasReached(uint16_t samples, uint16_t threshold) {
DCHECK(!IsAbstract());
- DCHECK_LE(samples, interpreter::kNterpHotnessMask);
- return hotness_count_ <= (interpreter::kNterpHotnessMask - samples);
+ DCHECK_EQ(threshold, Runtime::Current()->GetJITOptions()->GetWarmupThreshold());
+ DCHECK_LE(samples, threshold);
+ return hotness_count_ <= (threshold - samples);
}
inline uint16_t ArtMethod::GetCounter() {