src/share/vm/code/codeBlob.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8015774 Sdiff src/share/vm/code

src/share/vm/code/codeBlob.cpp

Print this page




 212 BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb)
 213   : CodeBlob(name, cb, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, 0, NULL)
 214 {}
 215 
 216 BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) {
 217   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 218 
 219   BufferBlob* blob = NULL;
 220   unsigned int size = allocation_size(cb, sizeof(BufferBlob));
 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


 281   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 282 
 283   MethodHandlesAdapterBlob* blob = NULL;
 284   unsigned int size = sizeof(MethodHandlesAdapterBlob);
 285   // align the size to CodeEntryAlignment
 286   size = align_code_offset(size);
 287   size += round_to(buffer_size, oopSize);
 288   {
 289     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 290     // The parameter 'true' indicates a critical memory allocation.
 291     // This means that CodeCacheMinimumFreeSpace is used, if necessary
 292     const bool is_critical = true;
 293     blob = new (size, is_critical) MethodHandlesAdapterBlob(size);
 294   }
 295   // Track memory usage statistic after releasing CodeCache_lock
 296   MemoryService::track_code_cache_memory_usage();
 297 
 298   return blob;
 299 }
 300 
 301 
 302 //----------------------------------------------------------------------------------------------------
 303 // Implementation of RuntimeStub
 304 
 305 RuntimeStub::RuntimeStub(
 306   const char* name,
 307   CodeBuffer* cb,
 308   int         size,
 309   int         frame_complete,
 310   int         frame_size,
 311   OopMapSet*  oop_maps,
 312   bool        caller_must_gc_arguments
 313 )
 314 : CodeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps)
 315 {
 316   _caller_must_gc_arguments = caller_must_gc_arguments;
 317 }
 318 
 319 
 320 RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name,
 321                                            CodeBuffer* cb,
 322                                            int frame_complete,
 323                                            int frame_size,
 324                                            OopMapSet* oop_maps,
 325                                            bool caller_must_gc_arguments)
 326 {
 327   RuntimeStub* stub = NULL;
 328   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 329   {
 330     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 331     unsigned int size = allocation_size(cb, sizeof(RuntimeStub));
 332     stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments);
 333   }
 334 
 335   trace_new_stub(stub, "RuntimeStub - ", stub_name);
 336 
 337   return stub;
 338 }
 339 
 340 
 341 void* RuntimeStub::operator new(size_t s, unsigned size) throw() {
 342   void* p = CodeCache::allocate(size, true);
 343   if (!p) fatal("Initial size of CodeCache is too small");
 344   return p;
 345 }
 346 
 347 // operator new shared by all singletons:
 348 void* SingletonBlob::operator new(size_t s, unsigned size) throw() {
 349   void* p = CodeCache::allocate(size, true);
 350   if (!p) fatal("Initial size of CodeCache is too small");
 351   return p;
 352 }
 353 
 354 
 355 //----------------------------------------------------------------------------------------------------
 356 // Implementation of DeoptimizationBlob
 357 
 358 DeoptimizationBlob::DeoptimizationBlob(
 359   CodeBuffer* cb,
 360   int         size,
 361   OopMapSet*  oop_maps,
 362   int         unpack_offset,
 363   int         unpack_with_exception_offset,
 364   int         unpack_with_reexecution_offset,
 365   int         frame_size
 366 )
 367 : SingletonBlob("DeoptimizationBlob", cb, sizeof(DeoptimizationBlob), size, frame_size, oop_maps)
 368 {
 369   _unpack_offset           = unpack_offset;




 212 BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb)
 213   : CodeBlob(name, cb, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, 0, NULL)
 214 {}
 215 
 216 BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) {
 217   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 218 
 219   BufferBlob* blob = NULL;
 220   unsigned int size = allocation_size(cb, sizeof(BufferBlob));
 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 void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
 233   return CodeCache::allocate(size, CodeBlobType::NonMethod, is_critical);

 234 }
 235 
 236 void BufferBlob::free(BufferBlob *blob) {

 237   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 238   {
 239     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 240     CodeCache::free((CodeBlob*)blob);
 241   }
 242   // Track memory usage statistic after releasing CodeCache_lock
 243   MemoryService::track_code_cache_memory_usage();
 244 }
 245 
 246 
 247 //----------------------------------------------------------------------------------------------------
 248 // Implementation of AdapterBlob
 249 
 250 AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) :
 251   BufferBlob("I2C/C2I adapters", size, cb) {
 252   CodeCache::commit(this);
 253 }
 254 
 255 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
 256   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock


 278   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 279 
 280   MethodHandlesAdapterBlob* blob = NULL;
 281   unsigned int size = sizeof(MethodHandlesAdapterBlob);
 282   // align the size to CodeEntryAlignment
 283   size = align_code_offset(size);
 284   size += round_to(buffer_size, oopSize);
 285   {
 286     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 287     // The parameter 'true' indicates a critical memory allocation.
 288     // This means that CodeCacheMinimumFreeSpace is used, if necessary
 289     const bool is_critical = true;
 290     blob = new (size, is_critical) MethodHandlesAdapterBlob(size);
 291   }
 292   // Track memory usage statistic after releasing CodeCache_lock
 293   MemoryService::track_code_cache_memory_usage();
 294 
 295   return blob;
 296 }
 297 

 298 //----------------------------------------------------------------------------------------------------
 299 // Implementation of RuntimeStub
 300 
 301 RuntimeStub::RuntimeStub(
 302   const char* name,
 303   CodeBuffer* cb,
 304   int         size,
 305   int         frame_complete,
 306   int         frame_size,
 307   OopMapSet*  oop_maps,
 308   bool        caller_must_gc_arguments
 309 )
 310 : CodeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps)
 311 {
 312   _caller_must_gc_arguments = caller_must_gc_arguments;
 313 }
 314 
 315 
 316 RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name,
 317                                            CodeBuffer* cb,
 318                                            int frame_complete,
 319                                            int frame_size,
 320                                            OopMapSet* oop_maps,
 321                                            bool caller_must_gc_arguments)
 322 {
 323   RuntimeStub* stub = NULL;
 324   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
 325   {
 326     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 327     unsigned int size = allocation_size(cb, sizeof(RuntimeStub));
 328     stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments);
 329   }
 330 
 331   trace_new_stub(stub, "RuntimeStub - ", stub_name);
 332 
 333   return stub;
 334 }
 335 
 336 
 337 void* RuntimeStub::operator new(size_t s, unsigned size) throw() {
 338   void* p = CodeCache::allocate(size, CodeBlobType::NonMethod, true);
 339   if (!p) fatal("Initial size of CodeCache is too small");
 340   return p;
 341 }
 342 
 343 // operator new shared by all singletons:
 344 void* SingletonBlob::operator new(size_t s, unsigned size) throw() {
 345   void* p = CodeCache::allocate(size, CodeBlobType::NonMethod, true);
 346   if (!p) fatal("Initial size of CodeCache is too small");
 347   return p;
 348 }
 349 
 350 
 351 //----------------------------------------------------------------------------------------------------
 352 // Implementation of DeoptimizationBlob
 353 
 354 DeoptimizationBlob::DeoptimizationBlob(
 355   CodeBuffer* cb,
 356   int         size,
 357   OopMapSet*  oop_maps,
 358   int         unpack_offset,
 359   int         unpack_with_exception_offset,
 360   int         unpack_with_reexecution_offset,
 361   int         frame_size
 362 )
 363 : SingletonBlob("DeoptimizationBlob", cb, sizeof(DeoptimizationBlob), size, frame_size, oop_maps)
 364 {
 365   _unpack_offset           = unpack_offset;


src/share/vm/code/codeBlob.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File