68 |
68 |
69 // Initialization |
69 // Initialization |
70 static void initialize(); |
70 static void initialize(); |
71 |
71 |
72 // Allocation/administration |
72 // Allocation/administration |
73 static CodeBlob* allocate(int size); // allocates a new CodeBlob |
73 static CodeBlob* allocate(int size, bool is_critical = false); // allocates a new CodeBlob |
74 static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled |
74 static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled |
75 static int alignment_unit(); // guaranteed alignment of all CodeBlobs |
75 static int alignment_unit(); // guaranteed alignment of all CodeBlobs |
76 static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header) |
76 static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header) |
77 static void free(CodeBlob* cb); // frees a CodeBlob |
77 static void free(CodeBlob* cb); // frees a CodeBlob |
78 static void flush(); // flushes all CodeBlobs |
78 static void flush(); // flushes all CodeBlobs |
154 |
154 |
155 // The full limits of the codeCache |
155 // The full limits of the codeCache |
156 static address low_bound() { return (address) _heap->low_boundary(); } |
156 static address low_bound() { return (address) _heap->low_boundary(); } |
157 static address high_bound() { return (address) _heap->high_boundary(); } |
157 static address high_bound() { return (address) _heap->high_boundary(); } |
158 |
158 |
159 static bool has_space(int size) { |
|
160 // Always leave some room in the CodeCache for I2C/C2I adapters |
|
161 return largest_free_block() > (CodeCacheMinimumFreeSpace + size); |
|
162 } |
|
163 |
|
164 // Profiling |
159 // Profiling |
165 static address first_address(); // first address used for CodeBlobs |
160 static address first_address(); // first address used for CodeBlobs |
166 static address last_address(); // last address used for CodeBlobs |
161 static address last_address(); // last address used for CodeBlobs |
167 static size_t capacity() { return _heap->capacity(); } |
162 static size_t capacity() { return _heap->capacity(); } |
168 static size_t max_capacity() { return _heap->max_capacity(); } |
163 static size_t max_capacity() { return _heap->max_capacity(); } |
169 static size_t unallocated_capacity() { return _heap->unallocated_capacity(); } |
164 static size_t unallocated_capacity() { return _heap->unallocated_capacity(); } |
170 static size_t largest_free_block(); |
165 static bool needs_flushing() { return unallocated_capacity() < CodeCacheFlushingMinimumFreeSpace; } |
171 static bool needs_flushing() { return largest_free_block() < CodeCacheFlushingMinimumFreeSpace; } |
|
172 |
166 |
173 static bool needs_cache_clean() { return _needs_cache_clean; } |
167 static bool needs_cache_clean() { return _needs_cache_clean; } |
174 static void set_needs_cache_clean(bool v) { _needs_cache_clean = v; } |
168 static void set_needs_cache_clean(bool v) { _needs_cache_clean = v; } |
175 static void clear_inline_caches(); // clear all inline caches |
169 static void clear_inline_caches(); // clear all inline caches |
176 |
170 |