summaryrefslogtreecommitdiff
path: root/runtime/interpreter/interpreter_cache-inl.h
diff options
context:
space:
mode:
author Lokesh Gidra <lokeshgidra@google.com> 2022-09-13 14:46:52 -0700
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-09-15 08:10:50 +0000
commit508648d1b25132ede6d2622d9f8355b8aaa8ebb7 (patch)
tree99b6d4acaba6cf3e6134f7f32a0ff0092bfbc629 /runtime/interpreter/interpreter_cache-inl.h
parent17a8be6ce9d2bbe5b4c75296e3ae30885819f4ee (diff)
Sweep interpreter caches using checkpoint during GC
Interpreter caches are mutator thread-local caches. Currently, the way GC sweeps these caches breaks that invariant and requires synchronization for correct behavior. In this CL we take a different approach of sweeping the caches during GC using checkpoint (or in a stop-the-world pause), eliminating the need for synchronization. Bug: 235988901 Test: art/test/testrunner/testrunner.py --host --debug --interpreter Change-Id: I8e8bbfc2d424bdce9c1c8c662782febe18678193
Diffstat (limited to 'runtime/interpreter/interpreter_cache-inl.h')
-rw-r--r--runtime/interpreter/interpreter_cache-inl.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/runtime/interpreter/interpreter_cache-inl.h b/runtime/interpreter/interpreter_cache-inl.h
index 269f5fa9ab..804d382877 100644
--- a/runtime/interpreter/interpreter_cache-inl.h
+++ b/runtime/interpreter/interpreter_cache-inl.h
@@ -35,13 +35,9 @@ inline bool InterpreterCache::Get(Thread* self, const void* key, /* out */ size_
inline void InterpreterCache::Set(Thread* self, const void* key, size_t value) {
DCHECK(self->GetInterpreterCache() == this) << "Must be called from owning thread";
-
- // For simplicity, only update the cache if weak ref accesses are enabled. If
- // they are disabled, this means the CC GC could be processing the cache, and
- // reading it concurrently.
- if (!gUseReadBarrier || self->GetWeakRefAccessEnabled()) {
- data_[IndexOf(key)] = Entry{key, value};
- }
+ // Simple store works here as the cache is always read/written by the owning
+ // thread only (or in a stop-the-world pause).
+ data_[IndexOf(key)] = Entry{key, value};
}
} // namespace art