236 assert(name != NULL, "must provide a name");
237 {
238 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
239 blob = new (size) BufferBlob(name, size, cb);
240 }
241 // Track memory usage statistic after releasing CodeCache_lock
242 MemoryService::track_code_cache_memory_usage();
243
244 return blob;
245 }
246
247
248 void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
249 void* p = CodeCache::allocate(size, is_critical);
250 return p;
251 }
252
253
254 void BufferBlob::free( BufferBlob *blob ) {
255 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
256 {
257 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
258 CodeCache::free((CodeBlob*)blob);
259 }
260 // Track memory usage statistic after releasing CodeCache_lock
261 MemoryService::track_code_cache_memory_usage();
262 }
263
264
265 //----------------------------------------------------------------------------------------------------
266 // Implementation of AdapterBlob
267
268 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) :
269 BufferBlob("I2C/C2I adapters", size, cb) {
270 CodeCache::commit(this);
271 }
272
273 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
274 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
275
|
236 assert(name != NULL, "must provide a name");
237 {
238 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
239 blob = new (size) BufferBlob(name, size, cb);
240 }
241 // Track memory usage statistic after releasing CodeCache_lock
242 MemoryService::track_code_cache_memory_usage();
243
244 return blob;
245 }
246
247
248 void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
249 void* p = CodeCache::allocate(size, is_critical);
250 return p;
251 }
252
253
254 void BufferBlob::free( BufferBlob *blob ) {
255 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
256 blob->flush();
257 {
258 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
259 CodeCache::free((CodeBlob*)blob);
260 }
261 // Track memory usage statistic after releasing CodeCache_lock
262 MemoryService::track_code_cache_memory_usage();
263 }
264
265
266 //----------------------------------------------------------------------------------------------------
267 // Implementation of AdapterBlob
268
269 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) :
270 BufferBlob("I2C/C2I adapters", size, cb) {
271 CodeCache::commit(this);
272 }
273
274 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
275 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
276
|