summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2024-12-17 13:36:18 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2024-12-18 02:36:34 -0800
commitf8a57338dce3af596799eb44daa60333cc3894a3 (patch)
tree3ff9256de0dd2466d21beb0e547cb99e24b24cdb
parent37ec22b569fceb88b0f6ffa6ff2acc027dae904c (diff)
Use jit_mutator_lock in JitCodeCache::VisitRootTables.
method_code_map_reversed_ is protected by jit_mutator_lock_. Also remove the no thread safety analysis from the method. Test: build and test.py Bug: 384182628 Change-Id: I2780d10e7792f0f3502a05f354b9de9488998437
-rw-r--r--runtime/jit/jit_code_cache-inl.h2
-rw-r--r--runtime/jit/jit_code_cache.h6
2 files changed, 5 insertions, 3 deletions
diff --git a/runtime/jit/jit_code_cache-inl.h b/runtime/jit/jit_code_cache-inl.h
index fab2073e55..b4553a1ec3 100644
--- a/runtime/jit/jit_code_cache-inl.h
+++ b/runtime/jit/jit_code_cache-inl.h
@@ -38,7 +38,7 @@ EXPORT void JitCodeCache::VisitRootTables(ArtMethod* method, RootVisitorType& vi
Thread* self = Thread::Current();
ScopedDebugDisallowReadBarriers sddrb(self);
- MutexLock mu(self, *Locks::jit_lock_);
+ ReaderMutexLock mu(self, *Locks::jit_mutator_lock_);
auto code_ptrs_it = method_code_map_reversed_.find(method);
if (code_ptrs_it == method_code_map_reversed_.end()) {
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index 2d2f841360..84b56f1247 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -359,8 +359,10 @@ class JitCodeCache {
// Visit GC roots (except j.l.Class and j.l.String) held by JIT-ed code.
template<typename RootVisitorType>
- EXPORT void VisitRootTables(ArtMethod* method,
- RootVisitorType& visitor) NO_THREAD_SAFETY_ANALYSIS;
+ EXPORT void VisitRootTables(ArtMethod* method, RootVisitorType& visitor)
+ REQUIRES(Locks::heap_bitmap_lock_)
+ REQUIRES(!Locks::jit_mutator_lock_)
+ REQUIRES_SHARED(Locks::mutator_lock_);
void SweepRootTables(IsMarkedVisitor* visitor)
REQUIRES(!Locks::jit_lock_)