Refactor RemoveNativeDebugInfoForJit.
This is partial revert of CL/1099280 (Remove global maps).
It somewhat resurrects the lazy method removal.
The original goal was to only remove methods from the GC,
and do all of them in bulk for simplicity and efficiency.
However, this is proving infeasible since we have several
corner cases which remove methods outside the GC code path.
The behaviour for the GC code path is preserved by this CL.
Instead of passing method array, the methods are individually
marked for removal and then repacking is immediately forced.
The only difference is that coroner cases are done lazily.
Test: ./art/test.py -b -r --host --jit --64
Change-Id: I42729545d6b51df788d92f9cf149a6e065b90c68
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index d8216d2..f46dc75 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -276,6 +276,9 @@
void Free(Thread* self, JitMemoryRegion* region, const uint8_t* code, const uint8_t* data)
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::jit_lock_);
+ void FreeLocked(JitMemoryRegion* region, const uint8_t* code, const uint8_t* data)
+ REQUIRES_SHARED(Locks::mutator_lock_)
+ REQUIRES(Locks::jit_lock_);
// Perform a collection on the code cache.
void GarbageCollectCache(Thread* self)
@@ -422,6 +425,7 @@
// Remove CHA dependents and underlying allocations for entries in `method_headers`.
void FreeAllMethodHeaders(const std::unordered_set<OatQuickMethodHeader*>& method_headers)
+ REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::jit_lock_)
REQUIRES(!Locks::cha_lock_);
@@ -432,8 +436,9 @@
REQUIRES(Locks::mutator_lock_);
// Free code and data allocations for `code_ptr`.
- void FreeCodeAndData(const void* code_ptr, bool free_debug_info = true)
- REQUIRES(Locks::jit_lock_);
+ void FreeCodeAndData(const void* code_ptr)
+ REQUIRES(Locks::jit_lock_)
+ REQUIRES_SHARED(Locks::mutator_lock_);
// Number of bytes allocated in the code cache.
size_t CodeCacheSize() REQUIRES(!Locks::jit_lock_);