diff options
Diffstat (limited to 'runtime/jit/jit_code_cache.h')
-rw-r--r-- | runtime/jit/jit_code_cache.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h index 956687af16..8a5c355ba9 100644 --- a/runtime/jit/jit_code_cache.h +++ b/runtime/jit/jit_code_cache.h @@ -185,17 +185,15 @@ class JitCodeCache { // Default initial capacity of the JIT code cache. static size_t GetInitialCapacity() { + // This function is called during static initialization + // when gPageSize might not be available yet. + const size_t page_size = GetPageSizeSlow(); + // Put the default to a very low amount for debug builds to stress the code cache // collection. It should be at least two pages, however, as the storage is split // into data and code sections with sizes that should be aligned to page size each // as that's the unit mspaces use. See also: JitMemoryRegion::Initialize. - return std::max(kIsDebugBuild ? 8 * KB : 64 * KB, 2 * gPageSize); - } - - // Reserved capacity of the JIT code cache. - // By default, do not GC until reaching four times the initial capacity. - static size_t GetReservedCapacity() { - return GetInitialCapacity() * 4; + return std::max(kIsDebugBuild ? 8 * KB : 64 * KB, 2 * page_size); } // Create the code cache with a code + data capacity equal to "capacity", error message is passed @@ -519,6 +517,10 @@ class JitCodeCache { return shared_region_.IsInDataSpace(ptr); } + size_t GetReservedCapacity() { + return reserved_capacity_; + } + bool IsWeakAccessEnabled(Thread* self) const; void WaitUntilInlineCacheAccessible(Thread* self) REQUIRES(!Locks::jit_lock_) @@ -538,6 +540,12 @@ class JitCodeCache { // Condition to wait on for accessing inline caches. ConditionVariable inline_cache_cond_ GUARDED_BY(Locks::jit_lock_); + // Reserved capacity of the JIT code cache. + const size_t reserved_capacity_; + + // By default, do not GC until reaching four times the initial capacity. + static constexpr size_t kReservedCapacityMultiplier = 4; + // -------------- JIT memory regions ------------------------------------- // // Shared region, inherited from the zygote. |