Refactor jit debugger interface and its ELF creation.
Make it possible to store more then one method per entry,
and ref-count the number of live methods per entry.
Test: m test-art-host-gtest
Change-Id: I45d69185e85e47fbee88a8d1f549ede9875a3c0a
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 659c55a..e41667a 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -549,7 +549,11 @@
uintptr_t allocation = FromCodeToAllocation(code_ptr);
// Notify native debugger that we are about to remove the code.
// It does nothing if we are not using native debugger.
- DeleteJITCodeEntryForAddress(reinterpret_cast<uintptr_t>(code_ptr));
+ MutexLock mu(Thread::Current(), g_jit_debug_mutex);
+ JITCodeEntry* entry = GetJITCodeEntry(reinterpret_cast<uintptr_t>(code_ptr));
+ if (entry != nullptr) {
+ DecrementJITCodeEntryRefcount(entry, reinterpret_cast<uintptr_t>(code_ptr));
+ }
if (OatQuickMethodHeader::FromCodePointer(code_ptr)->IsOptimized()) {
FreeData(GetRootTable(code_ptr));
} // else this is a JNI stub without any data.