221 assert(name != NULL, "must provide a name");
222 {
223 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
224 blob = new (size) BufferBlob(name, size, cb);
225 }
226 // Track memory usage statistic after releasing CodeCache_lock
227 MemoryService::track_code_cache_memory_usage();
228
229 return blob;
230 }
231
232
233 void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
234 void* p = CodeCache::allocate(size, is_critical);
235 return p;
236 }
237
238
239 void BufferBlob::free( BufferBlob *blob ) {
240 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
241 {
242 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
243 CodeCache::free((CodeBlob*)blob);
244 }
245 // Track memory usage statistic after releasing CodeCache_lock
246 MemoryService::track_code_cache_memory_usage();
247 }
248
249
250 //----------------------------------------------------------------------------------------------------
251 // Implementation of AdapterBlob
252
253 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) :
254 BufferBlob("I2C/C2I adapters", size, cb) {
255 CodeCache::commit(this);
256 }
257
258 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
259 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
260
|
221 assert(name != NULL, "must provide a name");
222 {
223 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
224 blob = new (size) BufferBlob(name, size, cb);
225 }
226 // Track memory usage statistic after releasing CodeCache_lock
227 MemoryService::track_code_cache_memory_usage();
228
229 return blob;
230 }
231
232
233 void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
234 void* p = CodeCache::allocate(size, is_critical);
235 return p;
236 }
237
238
239 void BufferBlob::free( BufferBlob *blob ) {
240 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
241 blob->flush();
242 {
243 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
244 CodeCache::free((CodeBlob*)blob);
245 }
246 // Track memory usage statistic after releasing CodeCache_lock
247 MemoryService::track_code_cache_memory_usage();
248 }
249
250
251 //----------------------------------------------------------------------------------------------------
252 // Implementation of AdapterBlob
253
254 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) :
255 BufferBlob("I2C/C2I adapters", size, cb) {
256 CodeCache::commit(this);
257 }
258
259 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
260 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
261
|