diff options
author | 2023-07-14 22:00:13 +0100 | |
---|---|---|
committer | 2023-11-30 00:02:56 +0000 | |
commit | 565b3b67de4b3b781b1c97aa86164c1bd604cd3d (patch) | |
tree | 407f971da5092e79c50846834e7f7e8b7355a88d /runtime/jit/jit_code_cache.h | |
parent | b2ad46534494bc8abd22c85c001e39bbf8d9118a (diff) |
Make kPageSize-derived values non-constexpr
This patch is part of the chain preparing for making kPageSize
non-constexpr in a future patch.
Since kPageSize is going to be a non-constexpr value, it can't be
used to initialize constexpr values anymore. Remove constexpr specifier
and replace it with const type qualifier for the derived values.
However, for configuration with page size agnosticism switched off,
effects on performance are expected to be negligible as the values
are still effectively constant so compiler should be able to easily
deduce that and propagate the constants.
Test: Same as for I5430741a8494b340ed7fd2d8692c41a59ad9c530.
The whole patches chain was tested as a whole.
Change-Id: I901d6b0504355ed290c76569c4472aed7414956c
Diffstat (limited to 'runtime/jit/jit_code_cache.h')
-rw-r--r-- | runtime/jit/jit_code_cache.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h index 8f408b8d91..96db8aeba8 100644 --- a/runtime/jit/jit_code_cache.h +++ b/runtime/jit/jit_code_cache.h @@ -181,15 +181,21 @@ class ZygoteMap { class JitCodeCache { public: static constexpr size_t kMaxCapacity = 64 * MB; - // 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. - static constexpr size_t kInitialCapacity = std::max(kIsDebugBuild ? 8 * KB : 64 * KB, - 2 * kPageSize); + // Default initial capacity of the JIT code cache. + static size_t GetInitialCapacity() { + // 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 * kPageSize); + } + + // Reserved capacity of the JIT code cache. // By default, do not GC until reaching four times the initial capacity. - static constexpr size_t kReservedCapacity = kInitialCapacity * 4; + static size_t GetReservedCapacity() { + return GetInitialCapacity() * 4; + } // Create the code cache with a code + data capacity equal to "capacity", error message is passed // in the out arg error_msg. |