diff options
Diffstat (limited to 'runtime/interpreter/interpreter_cache.cc')
-rw-r--r-- | runtime/interpreter/interpreter_cache.cc | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/runtime/interpreter/interpreter_cache.cc b/runtime/interpreter/interpreter_cache.cc index 1a35c038e9..e43fe318cc 100644 --- a/runtime/interpreter/interpreter_cache.cc +++ b/runtime/interpreter/interpreter_cache.cc @@ -19,30 +19,14 @@ namespace art { -std::array<std::atomic<InterpreterCache::Entry>, - InterpreterCache::kSharedSize> InterpreterCache::shared_array_; - -InterpreterCache::InterpreterCache() { - // We can not use the ClearThreadLocal method since the constructor will not - // be called from the owning thread. - thread_local_array_.fill(Entry{}); -} - -void InterpreterCache::ClearThreadLocal(Thread* owning_thread) { - // Must be called from the owning thread or when the owning thread is suspended. +void InterpreterCache::Clear(Thread* owning_thread) { DCHECK(owning_thread->GetInterpreterCache() == this); DCHECK(owning_thread == Thread::Current() || owning_thread->IsSuspended()); - - thread_local_array_.fill(Entry{}); + data_.fill(Entry{}); } -void InterpreterCache::ClearShared() { - // Can be called from any thread since the writes are atomic. - // The static shared cache isn't bound to specific thread in the first place. - - for (std::atomic<Entry>& entry : shared_array_) { - AtomicPairStoreRelease(&entry, Entry{}); - } +bool InterpreterCache::IsCalledFromOwningThread() { + return Thread::Current()->GetInterpreterCache() == this; } } // namespace art |