diff options
author | 2020-12-08 16:08:04 +0000 | |
---|---|---|
committer | 2020-12-09 11:50:42 +0000 | |
commit | 1f947b4dd13fe560a371fb5610ac619ef0546306 (patch) | |
tree | 8f65535f2e6a5bcd571c2974c9bccb9107b0eab4 | |
parent | 17491ac89fffc79452c4a88b39a9b74f342508d3 (diff) |
Exclude zygote methods from FreeAllMethodHeaders DCHECK
Zygote method set can change concurrently.
Bug: 175006160
Test: run jit-zygote configuration with the check enabled.
Change-Id: I973ab9303ade65ad7cad706b99e895b9c673ffb4
-rw-r--r-- | runtime/jit/debugger_interface.cc | 3 | ||||
-rw-r--r-- | runtime/jit/debugger_interface.h | 3 | ||||
-rw-r--r-- | runtime/jit/jit_code_cache.cc | 10 |
3 files changed, 11 insertions, 5 deletions
diff --git a/runtime/jit/debugger_interface.cc b/runtime/jit/debugger_interface.cc index 2f929bb919..d2339a0c24 100644 --- a/runtime/jit/debugger_interface.cc +++ b/runtime/jit/debugger_interface.cc @@ -651,7 +651,8 @@ Mutex* GetNativeDebugInfoLock() { void ForEachNativeDebugSymbol(std::function<void(const void*, size_t, const char*)> cb) { MutexLock mu(Thread::Current(), g_jit_debug_lock); using ElfRuntimeTypes = std::conditional<sizeof(void*) == 4, ElfTypes32, ElfTypes64>::type; - for (const JITCodeEntry* it = __jit_debug_descriptor.head_; it != nullptr; it = it->next_) { + const JITCodeEntry* end = __jit_debug_descriptor.zygote_head_entry_; + for (const JITCodeEntry* it = __jit_debug_descriptor.head_; it != end; it = it->next_) { ArrayRef<const uint8_t> buffer(it->symfile_addr_, it->symfile_size_); if (!buffer.empty()) { ElfDebugReader<ElfRuntimeTypes> reader(buffer); diff --git a/runtime/jit/debugger_interface.h b/runtime/jit/debugger_interface.h index d6a8063864..62288de8cf 100644 --- a/runtime/jit/debugger_interface.h +++ b/runtime/jit/debugger_interface.h @@ -72,7 +72,8 @@ size_t GetJitMiniDebugInfoMemUsage() REQUIRES_SHARED(Locks::jit_lock_); // TODO: Unwinding should be race-free. Remove this. Mutex* GetNativeDebugInfoLock(); -// Call given callback for every stored symbol. The callback parameters are (address, size, name). +// Call given callback for every non-zygote symbol. +// The callback parameters are (address, size, name). void ForEachNativeDebugSymbol(std::function<void(const void*, size_t, const char*)> cb); } // namespace art diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index 6a8cf69c26..adfee745bd 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -478,11 +478,14 @@ void JitCodeCache::FreeAllMethodHeaders( RepackNativeDebugInfoForJit(); // Check that the set of compiled methods exactly matches native debug information. - if (kIsDebugBuild) { + // Does not check zygote methods since they can change concurrently. + if (kIsDebugBuild && !Runtime::Current()->IsZygote()) { std::map<const void*, ArtMethod*> compiled_methods; VisitAllMethods([&](const void* addr, ArtMethod* method) { - CHECK(addr != nullptr && method != nullptr); - compiled_methods.emplace(addr, method); + if (!IsInZygoteExecSpace(addr)) { + CHECK(addr != nullptr && method != nullptr); + compiled_methods.emplace(addr, method); + } }); std::set<const void*> debug_info; ForEachNativeDebugSymbol([&](const void* addr, size_t, const char* name) { @@ -494,6 +497,7 @@ void JitCodeCache::FreeAllMethodHeaders( for (auto it : compiled_methods) { CHECK_EQ(debug_info.count(it.first), 1u) << "No debug info: " << it.second->PrettyMethod(); } + CHECK_EQ(compiled_methods.size(), debug_info.size()); } } } |