diff options
author | 2024-10-23 17:08:40 +0000 | |
---|---|---|
committer | 2024-10-23 19:34:06 +0000 | |
commit | a5557d9da3e603a0531e566abf4d08579b9b8141 (patch) | |
tree | efb67a8be2482d161f3827d05cef230f82ee195c | |
parent | 3dcb57a05a6317b8a66d3ff8990459fbe6bf79c8 (diff) |
Revert^3 "IsMemorySharedMethod fix for intrinsics"
This reverts commit 398bedca50a44d26edc84e24a1c1b587cefaf8de.
Reason for revert: DroidMonitor: Potential culprit for http://b/375165604 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Change-Id: I31a227205f2a8ac064ab86bac88038954ac4b77b
-rw-r--r-- | runtime/art_method.h | 8 | ||||
-rw-r--r-- | runtime/interpreter/mterp/arm64ng/main.S | 2 | ||||
-rw-r--r-- | runtime/interpreter/mterp/armng/main.S | 3 | ||||
-rw-r--r-- | runtime/interpreter/mterp/nterp.cc | 7 | ||||
-rw-r--r-- | runtime/interpreter/mterp/riscv64/main.S | 5 | ||||
-rw-r--r-- | runtime/interpreter/mterp/x86_64ng/main.S | 3 | ||||
-rw-r--r-- | runtime/interpreter/mterp/x86ng/main.S | 3 | ||||
-rw-r--r-- | runtime/jit/jit-inl.h | 11 | ||||
-rw-r--r-- | runtime/jit/jit.cc | 3 | ||||
-rw-r--r-- | tools/cpp-define-generator/art_method.def | 4 |
10 files changed, 8 insertions, 41 deletions
diff --git a/runtime/art_method.h b/runtime/art_method.h index 51520ddd4c..30dc09f67f 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -356,14 +356,6 @@ class EXPORT ArtMethod final { } static bool IsMemorySharedMethod(uint32_t access_flags) { - // There's an overlap with `kAccMemorySharedMethod` and `kAccIntrinsicBits` but that's OK as - // intrinsics are always in the boot image and therefore memory shared. - static_assert((kAccMemorySharedMethod & kAccIntrinsicBits) != 0, - "kAccMemorySharedMethod deliberately overlaps intrinsic bits"); - if (IsIntrinsic(access_flags)) { - return true; - } - return (access_flags & kAccMemorySharedMethod) != 0; } diff --git a/runtime/interpreter/mterp/arm64ng/main.S b/runtime/interpreter/mterp/arm64ng/main.S index 995ff86f18..7d83edbad1 100644 --- a/runtime/interpreter/mterp/arm64ng/main.S +++ b/runtime/interpreter/mterp/arm64ng/main.S @@ -1541,8 +1541,6 @@ END \name .macro CHECK_AND_UPDATE_SHARED_MEMORY_METHOD if_hot, if_not_hot ldr wip, [x0, #ART_METHOD_ACCESS_FLAGS_OFFSET] tbz wip, #ART_METHOD_IS_MEMORY_SHARED_FLAG_BIT, \if_hot - // Intrinsics are always in the boot image and considered hot. - tbnz wip, #ART_METHOD_IS_INTRINSIC_FLAG_BIT, \if_hot ldr wip, [xSELF, #THREAD_SHARED_METHOD_HOTNESS_OFFSET] cbz wip, \if_hot add wip, wip, #-1 diff --git a/runtime/interpreter/mterp/armng/main.S b/runtime/interpreter/mterp/armng/main.S index 5298840f92..906536654b 100644 --- a/runtime/interpreter/mterp/armng/main.S +++ b/runtime/interpreter/mterp/armng/main.S @@ -1544,9 +1544,6 @@ END \name ldr ip, [r0, #ART_METHOD_ACCESS_FLAGS_OFFSET] tst ip, #ART_METHOD_IS_MEMORY_SHARED_FLAG beq \if_hot - // Intrinsics are always in the boot image and considered hot. - tst ip, #ART_METHOD_IS_INTRINSIC_FLAG - bne \if_hot ldr ip, [rSELF, #THREAD_SHARED_METHOD_HOTNESS_OFFSET] cmp ip, #0 beq \if_hot diff --git a/runtime/interpreter/mterp/nterp.cc b/runtime/interpreter/mterp/nterp.cc index 2fe9c24fa6..a69dd8c4c7 100644 --- a/runtime/interpreter/mterp/nterp.cc +++ b/runtime/interpreter/mterp/nterp.cc @@ -695,11 +695,8 @@ extern "C" jit::OsrData* NterpHotMethod(ArtMethod* method, uint16_t* dex_pc_ptr, ScopedAssertNoThreadSuspension sants("In nterp"); Runtime* runtime = Runtime::Current(); if (method->IsMemorySharedMethod()) { - if (!method->IsIntrinsic()) { - // Intrinsics are special and will be considered hot from the first call. - DCHECK_EQ(Thread::Current()->GetSharedMethodHotness(), 0u); - Thread::Current()->ResetSharedMethodHotness(); - } + DCHECK_EQ(Thread::Current()->GetSharedMethodHotness(), 0u); + Thread::Current()->ResetSharedMethodHotness(); } else { // Move the counter to the initial threshold in case we have to re-JIT it. method->ResetCounter(runtime->GetJITOptions()->GetWarmupThreshold()); diff --git a/runtime/interpreter/mterp/riscv64/main.S b/runtime/interpreter/mterp/riscv64/main.S index 11428646ad..a9b917ad35 100644 --- a/runtime/interpreter/mterp/riscv64/main.S +++ b/runtime/interpreter/mterp/riscv64/main.S @@ -249,12 +249,9 @@ END \name // - xSELF // Clobbers: t0 .macro CHECK_AND_UPDATE_SHARED_MEMORY_METHOD if_hot, if_not_hot - // TODO(solanes): Figure out if there's a way to load t0 only once. lwu t0, ART_METHOD_ACCESS_FLAGS_OFFSET(a0) BRANCH_IF_BIT_CLEAR t0, t0, ART_METHOD_IS_MEMORY_SHARED_FLAG_BIT, \if_hot - lwu t0, ART_METHOD_ACCESS_FLAGS_OFFSET(a0) - // Intrinsics are always in the boot image and considered hot. - BRANCH_IF_BIT_SET t0, t0, ART_METHOD_IS_INTRINSIC_FLAG_BIT, \if_hot + lwu t0, THREAD_SHARED_METHOD_HOTNESS_OFFSET(xSELF) // t0 := hotness beqz t0, \if_hot diff --git a/runtime/interpreter/mterp/x86_64ng/main.S b/runtime/interpreter/mterp/x86_64ng/main.S index 8a66a91b38..f6f48ffcc3 100644 --- a/runtime/interpreter/mterp/x86_64ng/main.S +++ b/runtime/interpreter/mterp/x86_64ng/main.S @@ -1608,11 +1608,8 @@ END_FUNCTION \name .endm .macro CHECK_AND_UPDATE_SHARED_MEMORY_METHOD if_hot, if_not_hot - // Intrinsics are always in the boot image and considered hot. testl $$ART_METHOD_IS_MEMORY_SHARED_FLAG, ART_METHOD_ACCESS_FLAGS_OFFSET(%rdi) jz \if_hot - testl $$ART_METHOD_IS_INTRINSIC_FLAG, ART_METHOD_ACCESS_FLAGS_OFFSET(%rdi) - jnz \if_hot movzwl rSELF:THREAD_SHARED_METHOD_HOTNESS_OFFSET, %esi testl %esi, %esi je \if_hot diff --git a/runtime/interpreter/mterp/x86ng/main.S b/runtime/interpreter/mterp/x86ng/main.S index e39849a885..65a6a75df1 100644 --- a/runtime/interpreter/mterp/x86ng/main.S +++ b/runtime/interpreter/mterp/x86ng/main.S @@ -1685,11 +1685,8 @@ END_FUNCTION \name .endm .macro CHECK_AND_UPDATE_SHARED_MEMORY_METHOD if_hot, if_not_hot - // Intrinsics are always in the boot image and considered hot. testl $$ART_METHOD_IS_MEMORY_SHARED_FLAG, ART_METHOD_ACCESS_FLAGS_OFFSET(%eax) jz \if_hot - testl $$ART_METHOD_IS_INTRINSIC_FLAG, ART_METHOD_ACCESS_FLAGS_OFFSET(%eax) - jnz \if_hot movzwl rSELF:THREAD_SHARED_METHOD_HOTNESS_OFFSET, %ecx testl %ecx, %ecx je \if_hot diff --git a/runtime/jit/jit-inl.h b/runtime/jit/jit-inl.h index e1f331df73..52099c2e1d 100644 --- a/runtime/jit/jit-inl.h +++ b/runtime/jit/jit-inl.h @@ -30,13 +30,10 @@ namespace jit { inline void Jit::AddSamples(Thread* self, ArtMethod* method) { if (method->CounterIsHot()) { if (method->IsMemorySharedMethod()) { - // Intrinsics are special and will be considered hot from the first call. - if (!method->IsIntrinsic()) { - if (self->DecrementSharedMethodHotness() == 0) { - self->ResetSharedMethodHotness(); - } else { - return; - } + if (self->DecrementSharedMethodHotness() == 0) { + self->ResetSharedMethodHotness(); + } else { + return; } } else { method->ResetCounter(Runtime::Current()->GetJITOptions()->GetWarmupThreshold()); diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 5b048ee57a..de19b16e4f 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -1711,8 +1711,7 @@ void Jit::MaybeEnqueueCompilation(ArtMethod* method, Thread* self) { } static constexpr size_t kIndividualSharedMethodHotnessThreshold = 0x3f; - // Intrinsics are always in the boot image and considered hot. - if (method->IsMemorySharedMethod() && !method->IsIntrinsic()) { + if (method->IsMemorySharedMethod()) { MutexLock mu(self, lock_); auto it = shared_method_counters_.find(method); if (it == shared_method_counters_.end()) { diff --git a/tools/cpp-define-generator/art_method.def b/tools/cpp-define-generator/art_method.def index 3c34247ec2..d5ba59998d 100644 --- a/tools/cpp-define-generator/art_method.def +++ b/tools/cpp-define-generator/art_method.def @@ -21,10 +21,6 @@ ASM_DEFINE(ART_METHOD_ACCESS_FLAGS_OFFSET, art::ArtMethod::AccessFlagsOffset().Int32Value()) -ASM_DEFINE(ART_METHOD_IS_INTRINSIC_FLAG, - art::kAccIntrinsic) -ASM_DEFINE(ART_METHOD_IS_INTRINSIC_FLAG_BIT, - art::MostSignificantBit(art::kAccIntrinsic)) ASM_DEFINE(ART_METHOD_IS_MEMORY_SHARED_FLAG, art::kAccMemorySharedMethod) ASM_DEFINE(ART_METHOD_IS_MEMORY_SHARED_FLAG_BIT, |