diff options
| author | 2017-07-21 11:17:57 -0700 | |
|---|---|---|
| committer | 2017-07-24 20:00:57 -0700 | |
| commit | cf79cf51feeea395a965c8dc452f86be60c00aab (patch) | |
| tree | 59cb7c7b75a8dd2dfd74cb3002601e032e008892 /runtime/class_linker.cc | |
| parent | acae6dbe80d07a26a973587b6f838198e13e66c3 (diff) | |
Remove CHA dependencies for class unloading when JIT is disabled
When a linear alloc is unloaded, remove the corresponding CHA
dependencies to prevent any dangling pointers to ArtMethods.
Bug: 63905544
Bug: 63467744
Test: test-art-host
Change-Id: I6f54c6e774daef1a64c6a02a17eb5f5ab98841fd
Diffstat (limited to 'runtime/class_linker.cc')
| -rw-r--r-- | runtime/class_linker.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index c5e11f134e..74c04d19b6 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2315,11 +2315,16 @@ void ClassLinker::DeleteClassLoader(Thread* self, const ClassLoaderData& data) { JavaVMExt* const vm = runtime->GetJavaVM(); vm->DeleteWeakGlobalRef(self, data.weak_root); // Notify the JIT that we need to remove the methods and/or profiling info. + ClassHierarchyAnalysis* const cha = runtime->GetClassHierarchyAnalysis(); if (runtime->GetJit() != nullptr) { jit::JitCodeCache* code_cache = runtime->GetJit()->GetCodeCache(); if (code_cache != nullptr) { + // For the JIT case, RemoveMethodsIn removes the CHA dependencies. code_cache->RemoveMethodsIn(self, *data.allocator); } + } else { + // If we don't have a JIT, we need to manually remove the CHA dependencies manually. + cha->RemoveDependenciesForLinearAlloc(data.allocator); } delete data.allocator; delete data.class_table; |