Address some code comments
Change-Id: I0a38a387c4328d45bbc04d095bf3388c27495c12
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 8e42040..dbc5cec 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1500,7 +1500,7 @@
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 @@
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 f705330..739403f 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -560,7 +560,7 @@
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 4f4a97f..e9c16c1 100644
--- a/runtime/jit/jit_instrumentation.cc
+++ b/runtime/jit/jit_instrumentation.cc
@@ -115,30 +115,8 @@
}
}
-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<WaitForCompilationToFinishTask> 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 8cba1a9..1f447d0 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1790,6 +1790,9 @@
}
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());