hotspot/src/share/vm/code/codeBlob.cpp
changeset 27420 04e6f914cce1
parent 26919 361b4b4c92c0
child 27642 8c9eff693145
equal deleted inserted replaced
27419:a934f24b4dcf 27420:04e6f914cce1
   227   MemoryService::track_code_cache_memory_usage();
   227   MemoryService::track_code_cache_memory_usage();
   228 
   228 
   229   return blob;
   229   return blob;
   230 }
   230 }
   231 
   231 
   232 void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
   232 void* BufferBlob::operator new(size_t s, unsigned size) throw() {
   233   return CodeCache::allocate(size, CodeBlobType::NonNMethod, is_critical);
   233   return CodeCache::allocate(size, CodeBlobType::NonNMethod);
   234 }
   234 }
   235 
   235 
   236 void BufferBlob::free(BufferBlob *blob) {
   236 void BufferBlob::free(BufferBlob *blob) {
   237   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   237   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   238   blob->flush();
   238   blob->flush();
   258 
   258 
   259   AdapterBlob* blob = NULL;
   259   AdapterBlob* blob = NULL;
   260   unsigned int size = allocation_size(cb, sizeof(AdapterBlob));
   260   unsigned int size = allocation_size(cb, sizeof(AdapterBlob));
   261   {
   261   {
   262     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   262     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   263     // The parameter 'true' indicates a critical memory allocation.
   263     blob = new (size) AdapterBlob(size, cb);
   264     // This means that CodeCacheMinimumFreeSpace is used, if necessary
       
   265     const bool is_critical = true;
       
   266     blob = new (size, is_critical) AdapterBlob(size, cb);
       
   267   }
   264   }
   268   // Track memory usage statistic after releasing CodeCache_lock
   265   // Track memory usage statistic after releasing CodeCache_lock
   269   MemoryService::track_code_cache_memory_usage();
   266   MemoryService::track_code_cache_memory_usage();
   270 
   267 
   271   return blob;
   268   return blob;
   283   // align the size to CodeEntryAlignment
   280   // align the size to CodeEntryAlignment
   284   size = align_code_offset(size);
   281   size = align_code_offset(size);
   285   size += round_to(buffer_size, oopSize);
   282   size += round_to(buffer_size, oopSize);
   286   {
   283   {
   287     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   284     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   288     // The parameter 'true' indicates a critical memory allocation.
   285     blob = new (size) MethodHandlesAdapterBlob(size);
   289     // This means that CodeCacheMinimumFreeSpace is used, if necessary
       
   290     const bool is_critical = true;
       
   291     blob = new (size, is_critical) MethodHandlesAdapterBlob(size);
       
   292   }
   286   }
   293   // Track memory usage statistic after releasing CodeCache_lock
   287   // Track memory usage statistic after releasing CodeCache_lock
   294   MemoryService::track_code_cache_memory_usage();
   288   MemoryService::track_code_cache_memory_usage();
   295 
   289 
   296   return blob;
   290   return blob;
   334   return stub;
   328   return stub;
   335 }
   329 }
   336 
   330 
   337 
   331 
   338 void* RuntimeStub::operator new(size_t s, unsigned size) throw() {
   332 void* RuntimeStub::operator new(size_t s, unsigned size) throw() {
   339   void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod, true);
   333   void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod);
   340   if (!p) fatal("Initial size of CodeCache is too small");
   334   if (!p) fatal("Initial size of CodeCache is too small");
   341   return p;
   335   return p;
   342 }
   336 }
   343 
   337 
   344 // operator new shared by all singletons:
   338 // operator new shared by all singletons:
   345 void* SingletonBlob::operator new(size_t s, unsigned size) throw() {
   339 void* SingletonBlob::operator new(size_t s, unsigned size) throw() {
   346   void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod, true);
   340   void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod);
   347   if (!p) fatal("Initial size of CodeCache is too small");
   341   if (!p) fatal("Initial size of CodeCache is too small");
   348   return p;
   342   return p;
   349 }
   343 }
   350 
   344 
   351 
   345