From c3fcd41f15dffbb5f28c9900f421471a3d2dd420 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 25 Sep 2015 16:54:59 -0700 Subject: [PATCH] Address some code comments Change-Id: I0a38a387c4328d45bbc04d095bf3388c27495c12 --- runtime/class_linker.cc | 4 +++- runtime/class_linker.h | 2 +- runtime/jit/jit_instrumentation.cc | 24 +----------------------- runtime/runtime.cc | 3 +++ 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 8e42040c1..dbc5ceca0 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -1500,7 +1500,7 @@ ClassLinker::~ClassLinker() { Thread* const self = Thread::Current(); JavaVMExt* const vm = Runtime::Current()->GetJavaVM(); for (const ClassLoaderData& data : class_loaders_) { - vm->DecodeWeakGlobalDuringShutdown(self, data.weak_root); + vm->DeleteWeakGlobalRef(self, data.weak_root); delete data.allocator; delete data.class_table; } @@ -4186,6 +4186,8 @@ ClassTable* ClassLinker::InsertClassTableForClassLoader(mirror::ClassLoader* cla data.allocator = Runtime::Current()->CreateLinearAlloc(); class_loaders_.push_back(data); // Don't already have a class table, add it to the class loader. + CHECK(class_loader->GetClassTable() == nullptr); + CHECK(class_loader->GetAllocator() == nullptr); class_loader->SetClassTable(data.class_table); class_loader->SetAllocator(data.allocator); } diff --git a/runtime/class_linker.h b/runtime/class_linker.h index f705330b1..739403f6c 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -560,7 +560,7 @@ class ClassLinker { private: struct ClassLoaderData { - jobject weak_root; // Weak root to enable class unloading. + jweak weak_root; // Weak root to enable class unloading. ClassTable* class_table; LinearAlloc* allocator; }; diff --git a/runtime/jit/jit_instrumentation.cc b/runtime/jit/jit_instrumentation.cc index 4f4a97f45..e9c16c1aa 100644 --- a/runtime/jit/jit_instrumentation.cc +++ b/runtime/jit/jit_instrumentation.cc @@ -115,30 +115,8 @@ void JitInstrumentationListener::InvokeVirtualOrInterface(Thread* thread, } } -class WaitForCompilationToFinishTask FINAL : public Task { - public: - WaitForCompilationToFinishTask() : barrier_(0) {} - - void Wait(Thread* self) { - barrier_.Increment(self, 1); - } - - void Run(Thread* self ATTRIBUTE_UNUSED) OVERRIDE {} - - void Finalize() OVERRIDE { - // Do this in Finalize since Finalize is called after Run by the thread pool. - barrier_.Pass(Thread::Current()); - } - - private: - Barrier barrier_; - DISALLOW_COPY_AND_ASSIGN(WaitForCompilationToFinishTask); -}; - void JitInstrumentationCache::WaitForCompilationToFinish(Thread* self) { - std::unique_ptr task(new WaitForCompilationToFinishTask); - thread_pool_->AddTask(self, task.get()); - task->Wait(self); + thread_pool_->Wait(self, false, false); } } // namespace jit diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 8cba1a91d..1f447d076 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1790,6 +1790,9 @@ bool Runtime::IsVerificationSoftFail() const { } LinearAlloc* Runtime::CreateLinearAlloc() { + // For 64 bit compilers, it needs to be in low 4GB in the case where we are cross compiling for a + // 32 bit target. In this case, we have 32 bit pointers in the dex cache arrays which can't hold + // when we have 64 bit ArtMethod pointers. return (IsAotCompiler() && Is64BitInstructionSet(kRuntimeISA)) ? new LinearAlloc(low_4gb_arena_pool_.get()) : new LinearAlloc(arena_pool_.get()); -- 2.11.0