mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 12:34:32 +02:00
7025742: Can not use CodeCache::unallocated_capacity() with fragmented CodeCache
Use largest_free_block() instead of unallocated_capacity(). Reviewed-by: iveresov, never, ysr
This commit is contained in:
parent
84ef74286f
commit
fd6487f201
7 changed files with 28 additions and 15 deletions
|
@ -939,9 +939,16 @@ void CodeCache::print_bounds(outputStream* st) {
|
|||
_heap->high(),
|
||||
_heap->high_boundary());
|
||||
st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
|
||||
" adapters=" UINT32_FORMAT " free_code_cache=" SIZE_FORMAT
|
||||
" adapters=" UINT32_FORMAT " free_code_cache=" SIZE_FORMAT "Kb"
|
||||
" largest_free_block=" SIZE_FORMAT,
|
||||
CodeCache::nof_blobs(), CodeCache::nof_nmethods(),
|
||||
CodeCache::nof_adapters(), CodeCache::unallocated_capacity(),
|
||||
CodeCache::largest_free_block());
|
||||
nof_blobs(), nof_nmethods(), nof_adapters(),
|
||||
unallocated_capacity()/K, largest_free_block());
|
||||
}
|
||||
|
||||
void CodeCache::log_state(outputStream* st) {
|
||||
st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
|
||||
" adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'"
|
||||
" largest_free_block='" SIZE_FORMAT "'",
|
||||
nof_blobs(), nof_nmethods(), nof_adapters(),
|
||||
unallocated_capacity(), largest_free_block());
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ class CodeCache : AllStatic {
|
|||
static void verify(); // verifies the code cache
|
||||
static void print_trace(const char* event, CodeBlob* cb, int size = 0) PRODUCT_RETURN;
|
||||
static void print_bounds(outputStream* st); // Prints a summary of the bounds of the code cache
|
||||
static void log_state(outputStream* st);
|
||||
|
||||
// The full limits of the codeCache
|
||||
static address low_bound() { return (address) _heap->low_boundary(); }
|
||||
|
@ -159,7 +160,7 @@ class CodeCache : AllStatic {
|
|||
static size_t max_capacity() { return _heap->max_capacity(); }
|
||||
static size_t unallocated_capacity() { return _heap->unallocated_capacity(); }
|
||||
static size_t largest_free_block() { return _heap->largest_free_block(); }
|
||||
static bool needs_flushing() { return unallocated_capacity() < CodeCacheFlushingMinimumFreeSpace; }
|
||||
static bool needs_flushing() { return largest_free_block() < CodeCacheFlushingMinimumFreeSpace; }
|
||||
|
||||
static bool needs_cache_clean() { return _needs_cache_clean; }
|
||||
static void set_needs_cache_clean(bool v) { _needs_cache_clean = v; }
|
||||
|
|
|
@ -762,7 +762,7 @@ nmethod::nmethod(
|
|||
|
||||
void* nmethod::operator new(size_t size, int nmethod_size) {
|
||||
// Always leave some room in the CodeCache for I2C/C2I adapters
|
||||
if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) return NULL;
|
||||
if (CodeCache::largest_free_block() < CodeCacheMinimumFreeSpace) return NULL;
|
||||
return CodeCache::allocate(nmethod_size);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue