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