< prev index next >

src/hotspot/share/code/codeBlob.cpp

Print this page




 255   MemoryService::track_code_cache_memory_usage();
 256 
 257   return blob;
 258 }
 259 
 260 void* BufferBlob::operator new(size_t s, unsigned size) throw() {
 261   return CodeCache::allocate(size, CodeBlobType::NonNMethod);
 262 }
 263 
 264 void BufferBlob::free(BufferBlob *blob) {
 265   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 266   blob->flush();
 267   {
 268     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 269     CodeCache::free((RuntimeBlob*)blob);
 270   }
 271   // Track memory usage statistic after releasing CodeCache_lock
 272   MemoryService::track_code_cache_memory_usage();
 273 }
 274 
 275 BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps)
 276   : RuntimeBlob(name, cb, sizeof(BufferBlob), size, frame_complete, frame_size, oop_maps)
 277 {}
 278 
 279 
 280 //----------------------------------------------------------------------------------------------------
 281 // Implementation of AdapterBlob
 282 
 283 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps) :
 284   BufferBlob("I2C/C2I adapters", size, cb, frame_complete, frame_size, oop_maps) {
 285   CodeCache::commit(this);
 286 }
 287 
 288 AdapterBlob* AdapterBlob::create(CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps) {
 289   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 290 
 291   AdapterBlob* blob = NULL;
 292   unsigned int size = CodeBlob::allocation_size(cb, sizeof(AdapterBlob));
 293   {
 294     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 295     blob = new (size) AdapterBlob(size, cb, frame_complete, frame_size, oop_maps);
 296   }
 297   // Track memory usage statistic after releasing CodeCache_lock
 298   MemoryService::track_code_cache_memory_usage();
 299 
 300   return blob;
 301 }
 302 
 303 VtableBlob::VtableBlob(const char* name, int size) :
 304   BufferBlob(name, size) {
 305 }
 306 
 307 VtableBlob* VtableBlob::create(const char* name, int buffer_size) {
 308   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 309 
 310   VtableBlob* blob = NULL;
 311   unsigned int size = sizeof(VtableBlob);
 312   // align the size to CodeEntryAlignment
 313   size = align_code_offset(size);
 314   size += align_up(buffer_size, oopSize);
 315   assert(name != NULL, "must provide a name");




 255   MemoryService::track_code_cache_memory_usage();
 256 
 257   return blob;
 258 }
 259 
 260 void* BufferBlob::operator new(size_t s, unsigned size) throw() {
 261   return CodeCache::allocate(size, CodeBlobType::NonNMethod);
 262 }
 263 
 264 void BufferBlob::free(BufferBlob *blob) {
 265   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 266   blob->flush();
 267   {
 268     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 269     CodeCache::free((RuntimeBlob*)blob);
 270   }
 271   // Track memory usage statistic after releasing CodeCache_lock
 272   MemoryService::track_code_cache_memory_usage();
 273 }
 274 
 275 BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments)
 276   : RuntimeBlob(name, cb, sizeof(BufferBlob), size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments)
 277 {}
 278 
 279 
 280 //----------------------------------------------------------------------------------------------------
 281 // Implementation of AdapterBlob
 282 
 283 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments) :
 284   BufferBlob("I2C/C2I adapters", size, cb, frame_complete, frame_size, oop_maps, caller_must_gc_arguments) {
 285   CodeCache::commit(this);
 286 }
 287 
 288 AdapterBlob* AdapterBlob::create(CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments) {
 289   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 290 
 291   AdapterBlob* blob = NULL;
 292   unsigned int size = CodeBlob::allocation_size(cb, sizeof(AdapterBlob));
 293   {
 294     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 295     blob = new (size) AdapterBlob(size, cb, frame_complete, frame_size, oop_maps, caller_must_gc_arguments);
 296   }
 297   // Track memory usage statistic after releasing CodeCache_lock
 298   MemoryService::track_code_cache_memory_usage();
 299 
 300   return blob;
 301 }
 302 
 303 VtableBlob::VtableBlob(const char* name, int size) :
 304   BufferBlob(name, size) {
 305 }
 306 
 307 VtableBlob* VtableBlob::create(const char* name, int buffer_size) {
 308   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 309 
 310   VtableBlob* blob = NULL;
 311   unsigned int size = sizeof(VtableBlob);
 312   // align the size to CodeEntryAlignment
 313   size = align_code_offset(size);
 314   size += align_up(buffer_size, oopSize);
 315   assert(name != NULL, "must provide a name");


< prev index next >