< 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 
 276 //----------------------------------------------------------------------------------------------------
 277 // Implementation of AdapterBlob
 278 
 279 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) :
 280   BufferBlob("I2C/C2I adapters", size, cb) {
 281   CodeCache::commit(this);
 282 }
 283 
 284 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
 285   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 286 
 287   AdapterBlob* blob = NULL;
 288   unsigned int size = CodeBlob::allocation_size(cb, sizeof(AdapterBlob));
 289   {
 290     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 291     blob = new (size) AdapterBlob(size, cb);
 292   }
 293   // Track memory usage statistic after releasing CodeCache_lock
 294   MemoryService::track_code_cache_memory_usage();
 295 
 296   return blob;
 297 }
 298 
 299 VtableBlob::VtableBlob(const char* name, int size) :
 300   BufferBlob(name, size) {
 301 }
 302 
 303 VtableBlob* VtableBlob::create(const char* name, int buffer_size) {
 304   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 305 
 306   VtableBlob* blob = NULL;
 307   unsigned int size = sizeof(VtableBlob);
 308   // align the size to CodeEntryAlignment
 309   size = align_code_offset(size);
 310   size += align_up(buffer_size, oopSize);
 311   assert(name != NULL, "must provide a name");


 319   return blob;
 320 }
 321 
 322 //----------------------------------------------------------------------------------------------------
 323 // Implementation of MethodHandlesAdapterBlob
 324 
 325 MethodHandlesAdapterBlob* MethodHandlesAdapterBlob::create(int buffer_size) {
 326   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 327 
 328   MethodHandlesAdapterBlob* blob = NULL;
 329   unsigned int size = sizeof(MethodHandlesAdapterBlob);
 330   // align the size to CodeEntryAlignment
 331   size = CodeBlob::align_code_offset(size);
 332   size += align_up(buffer_size, oopSize);
 333   {
 334     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 335     blob = new (size) MethodHandlesAdapterBlob(size);
 336     if (blob == NULL) {
 337       vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "CodeCache: no room for method handle adapter blob");
 338     }
























 339   }
 340   // Track memory usage statistic after releasing CodeCache_lock
 341   MemoryService::track_code_cache_memory_usage();
 342 
 343   return blob;
 344 }
 345 
 346 //----------------------------------------------------------------------------------------------------
 347 // Implementation of RuntimeStub
 348 
 349 RuntimeStub::RuntimeStub(
 350   const char* name,
 351   CodeBuffer* cb,
 352   int         size,
 353   int         frame_complete,
 354   int         frame_size,
 355   OopMapSet*  oop_maps,
 356   bool        caller_must_gc_arguments
 357 )
 358 : RuntimeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments)




 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");


 323   return blob;
 324 }
 325 
 326 //----------------------------------------------------------------------------------------------------
 327 // Implementation of MethodHandlesAdapterBlob
 328 
 329 MethodHandlesAdapterBlob* MethodHandlesAdapterBlob::create(int buffer_size) {
 330   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 331 
 332   MethodHandlesAdapterBlob* blob = NULL;
 333   unsigned int size = sizeof(MethodHandlesAdapterBlob);
 334   // align the size to CodeEntryAlignment
 335   size = CodeBlob::align_code_offset(size);
 336   size += align_up(buffer_size, oopSize);
 337   {
 338     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 339     blob = new (size) MethodHandlesAdapterBlob(size);
 340     if (blob == NULL) {
 341       vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "CodeCache: no room for method handle adapter blob");
 342     }
 343   }
 344   // Track memory usage statistic after releasing CodeCache_lock
 345   MemoryService::track_code_cache_memory_usage();
 346 
 347   return blob;
 348 }
 349 
 350 //----------------------------------------------------------------------------------------------------
 351 // Implementation of BufferedValueTypeBlob
 352 BufferedValueTypeBlob::BufferedValueTypeBlob(int size, CodeBuffer* cb, int pack_fields_off, int unpack_fields_off) :
 353   BufferBlob("buffered value type", size, cb),
 354   _pack_fields_off(pack_fields_off),
 355   _unpack_fields_off(unpack_fields_off) {
 356   CodeCache::commit(this);
 357 }
 358 
 359 BufferedValueTypeBlob* BufferedValueTypeBlob::create(CodeBuffer* cb, int pack_fields_off, int unpack_fields_off) {
 360   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 361 
 362   BufferedValueTypeBlob* blob = NULL;
 363   unsigned int size = CodeBlob::allocation_size(cb, sizeof(BufferedValueTypeBlob));
 364   {
 365     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 366     blob = new (size) BufferedValueTypeBlob(size, cb, pack_fields_off, unpack_fields_off);
 367   }
 368   // Track memory usage statistic after releasing CodeCache_lock
 369   MemoryService::track_code_cache_memory_usage();
 370 
 371   return blob;
 372 }
 373 
 374 //----------------------------------------------------------------------------------------------------
 375 // Implementation of RuntimeStub
 376 
 377 RuntimeStub::RuntimeStub(
 378   const char* name,
 379   CodeBuffer* cb,
 380   int         size,
 381   int         frame_complete,
 382   int         frame_size,
 383   OopMapSet*  oop_maps,
 384   bool        caller_must_gc_arguments
 385 )
 386 : RuntimeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments)


< prev index next >