Introduce partial code cache collection.
It will collect code that is known unused (because it deoptimized),
and osr code.
bug:26846185
Change-Id: Ic27dfeb944efb2ca464039007ba365c1e0d4a040
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index 74ce7b5..e5b8e6c 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -234,6 +234,18 @@
// Set the footprint limit of the code cache.
void SetFootprintLimit(size_t new_footprint) REQUIRES(lock_);
+ void DoFullCollection(Thread* self)
+ REQUIRES(!lock_)
+ SHARED_REQUIRES(Locks::mutator_lock_);
+
+ void RemoveUnusedCode(Thread* self)
+ REQUIRES(!lock_)
+ SHARED_REQUIRES(Locks::mutator_lock_);
+
+ void MarkCompiledCodeOnThreadStacks(Thread* self)
+ REQUIRES(!lock_)
+ SHARED_REQUIRES(Locks::mutator_lock_);
+
// Lock for guarding allocations, collections, and the method_code_map_.
Mutex lock_;
// Condition to wait on during collection.
@@ -269,8 +281,8 @@
// The current footprint in bytes of the data portion of the code cache.
size_t data_end_ GUARDED_BY(lock_);
- // Whether a collection has already been done on the current capacity.
- bool has_done_one_collection_ GUARDED_BY(lock_);
+ // Whether a full collection has already been done on the current capacity.
+ bool has_done_full_collection_ GUARDED_BY(lock_);
// Last time the the code_cache was updated.
// It is atomic to avoid locking when reading it.