diff options
-rw-r--r-- | runtime/monitor_pool.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/runtime/monitor_pool.h b/runtime/monitor_pool.h index e07aa9735f..133cde094d 100644 --- a/runtime/monitor_pool.h +++ b/runtime/monitor_pool.h @@ -189,12 +189,12 @@ class MonitorPool { // Size of a monitor, rounded up to a multiple of alignment. static constexpr size_t kAlignedMonitorSize = (sizeof(Monitor) + kMonitorAlignment - 1) & -kMonitorAlignment; - // As close to a page as we can get seems a good start. - static constexpr size_t kChunkCapacity = kPageSize / kAlignedMonitorSize; - // Chunk size that is referenced in the id. We can collapse this to the actually used storage - // in a chunk, i.e., kChunkCapacity * kAlignedMonitorSize, but this will mean proper divisions. - static constexpr size_t kChunkSize = kPageSize; + // Size of the chunks holding the actual monitors. The bottom bits of the monitor id are the + // index into such a chunk. We can collapse this to the actually used storage + // in a chunk, i.e., kChunkCapacity * kAlignedMonitorSize, but this would mean proper divisions. + static constexpr size_t kChunkSize = 4096; static_assert(IsPowerOfTwo(kChunkSize), "kChunkSize must be power of 2"); + static constexpr size_t kChunkCapacity = kChunkSize / kAlignedMonitorSize; // The number of chunks of storage that can be referenced by the initial chunk list. // The total number of usable monitor chunks is typically 255 times this number, so it // should be large enough that we don't run out. We run out of address bits if it's > 512. @@ -215,7 +215,7 @@ class MonitorPool { // Array of pointers to lists (again arrays) of pointers to chunks containing monitors. // Zeroth entry points to a list (array) of kInitialChunkStorage pointers to chunks. // Each subsequent list as twice as large as the preceding one. - // Monitor Ids are interpreted as follows: + // Monitor Ids are effectively interpreted as follows: // Top 3 bits (of 28): index into monitor_chunks_. // Next 16 bits: index into the chunk list, i.e. monitor_chunks_[i]. // Last 9 bits: offset within chunk, expressed as multiple of kMonitorAlignment. |