diff options
| -rw-r--r-- | runtime/jit/jit_code_cache.cc | 20 | ||||
| -rw-r--r-- | runtime/jit/jit_code_cache.h | 25 |
2 files changed, 18 insertions, 27 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index 359f97e705..1701ca8a78 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -1274,10 +1274,10 @@ size_t JitCodeCache::ReserveData(Thread* self, class MarkCodeVisitor final : public StackVisitor { public: - MarkCodeVisitor(Thread* thread_in, JitCodeCache* code_cache_in) + MarkCodeVisitor(Thread* thread_in, JitCodeCache* code_cache_in, CodeCacheBitmap* bitmap) : StackVisitor(thread_in, nullptr, StackVisitor::StackWalkKind::kSkipInlinedFrames), code_cache_(code_cache_in), - bitmap_(code_cache_->GetLiveBitmap()) {} + bitmap_(bitmap) {} bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) { const OatQuickMethodHeader* method_header = GetCurrentOatQuickMethodHeader(); @@ -1299,13 +1299,13 @@ class MarkCodeVisitor final : public StackVisitor { class MarkCodeClosure final : public Closure { public: - MarkCodeClosure(JitCodeCache* code_cache, Barrier* barrier) - : code_cache_(code_cache), barrier_(barrier) {} + MarkCodeClosure(JitCodeCache* code_cache, CodeCacheBitmap* bitmap, Barrier* barrier) + : code_cache_(code_cache), bitmap_(bitmap), barrier_(barrier) {} void Run(Thread* thread) override REQUIRES_SHARED(Locks::mutator_lock_) { ScopedTrace trace(__PRETTY_FUNCTION__); DCHECK(thread == Thread::Current() || thread->IsSuspended()); - MarkCodeVisitor visitor(thread, code_cache_); + MarkCodeVisitor visitor(thread, code_cache_, bitmap_); visitor.WalkStack(); if (kIsDebugBuild) { // The stack walking code queries the side instrumentation stack if it @@ -1320,7 +1320,7 @@ class MarkCodeClosure final : public Closure { code_cache_->LookupMethodHeader(frame.return_pc_, /* method= */ nullptr); if (method_header != nullptr) { const void* code = method_header->GetCode(); - CHECK(code_cache_->GetLiveBitmap()->Test(FromCodeToAllocation(code))); + CHECK(bitmap_->Test(FromCodeToAllocation(code))); } } } @@ -1329,6 +1329,7 @@ class MarkCodeClosure final : public Closure { private: JitCodeCache* const code_cache_; + CodeCacheBitmap* const bitmap_; Barrier* const barrier_; }; @@ -1374,7 +1375,7 @@ bool JitCodeCache::IncreaseCodeCacheCapacity() { void JitCodeCache::MarkCompiledCodeOnThreadStacks(Thread* self) { Barrier barrier(0); size_t threads_running_checkpoint = 0; - MarkCodeClosure closure(this, &barrier); + MarkCodeClosure closure(this, GetLiveBitmap(), &barrier); threads_running_checkpoint = Runtime::Current()->GetThreadList()->RunCheckpoint(&closure); // Now that we have run our checkpoint, move to a suspended state and wait // for other threads to run the checkpoint. @@ -1987,11 +1988,6 @@ void JitCodeCache::DoneCompiling(ArtMethod* method, Thread* self, bool osr) { } } -size_t JitCodeCache::GetMemorySizeOfCodePointer(const void* ptr) { - MutexLock mu(Thread::Current(), lock_); - return mspace_usable_size(reinterpret_cast<const void*>(FromCodeToAllocation(ptr))); -} - void JitCodeCache::InvalidateCompiledCodeFor(ArtMethod* method, const OatQuickMethodHeader* header) { DCHECK(!method->IsNative()); diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h index 126fd441db..a5075638f2 100644 --- a/runtime/jit/jit_code_cache.h +++ b/runtime/jit/jit_code_cache.h @@ -71,7 +71,6 @@ template<class T> class ObjectArray; namespace jit { -class JitInstrumentationCache; class ScopedCodeCacheWrite; // Alignment in bits that will suit all architectures. @@ -97,12 +96,6 @@ class JitCodeCache { std::string* error_msg); ~JitCodeCache(); - // Number of bytes allocated in the code cache. - size_t CodeCacheSize() REQUIRES(!lock_); - - // Number of bytes allocated in the data cache. - size_t DataCacheSize() REQUIRES(!lock_); - bool NotifyCompilationOf(ArtMethod* method, Thread* self, bool osr) REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!lock_); @@ -177,10 +170,6 @@ class JitCodeCache { REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!lock_); - CodeCacheBitmap* GetLiveBitmap() const { - return live_bitmap_.get(); - } - // Perform a collection on the code cache. void GarbageCollectCache(Thread* self) REQUIRES(!lock_) @@ -234,10 +223,6 @@ class JitCodeCache { REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); - uint64_t GetLastUpdateTimeNs() const; - - size_t GetMemorySizeOfCodePointer(const void* ptr) REQUIRES(!lock_); - void InvalidateCompiledCodeFor(ArtMethod* method, const OatQuickMethodHeader* code) REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); @@ -339,6 +324,12 @@ class JitCodeCache { void FreeCodeAndData(const void* code_ptr) REQUIRES(lock_); // Number of bytes allocated in the code cache. + size_t CodeCacheSize() REQUIRES(!lock_); + + // Number of bytes allocated in the data cache. + size_t DataCacheSize() REQUIRES(!lock_); + + // Number of bytes allocated in the code cache. size_t CodeCacheSizeLocked() REQUIRES(lock_); // Number of bytes allocated in the data cache. @@ -375,6 +366,10 @@ class JitCodeCache { REQUIRES(lock_) REQUIRES_SHARED(Locks::mutator_lock_); + CodeCacheBitmap* GetLiveBitmap() const { + return live_bitmap_.get(); + } + uint8_t* AllocateCode(size_t code_size) REQUIRES(lock_); void FreeCode(uint8_t* code) REQUIRES(lock_); uint8_t* AllocateData(size_t data_size) REQUIRES(lock_); |