< prev index next >

src/hotspot/share/code/codeCache.cpp

Print this page

 562       ResourceMark rm;
 563       if (_nmethod_heaps->length() >= 1) {
 564         tty->print("%s", heap->name());
 565       } else {
 566         tty->print("CodeCache");
 567       }
 568       tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
 569                     (intptr_t)heap->low_boundary(), (intptr_t)heap->high(),
 570                     (address)heap->high() - (address)heap->low_boundary());
 571     }
 572   }
 573   print_trace("allocation", cb, size);
 574   return cb;
 575 }
 576 
 577 void CodeCache::free(CodeBlob* cb) {
 578   assert_locked_or_safepoint(CodeCache_lock);
 579   CodeHeap* heap = get_code_heap(cb);
 580   print_trace("free", cb);
 581   if (cb->is_nmethod()) {
 582     nmethod* ptr = (nmethod *)cb;
 583     heap->set_nmethod_count(heap->nmethod_count() - 1);
 584     if (ptr->has_dependencies()) {
 585       _number_of_nmethods_with_dependencies--;
 586     }
 587     ptr->free_native_invokers();
 588   }
 589   if (cb->is_adapter_blob()) {
 590     heap->set_adapter_count(heap->adapter_count() - 1);
 591   }
 592 
 593   // Get heap for given CodeBlob and deallocate
 594   get_code_heap(cb)->deallocate(cb);
 595 
 596   assert(heap->blob_count() >= 0, "sanity check");
 597 }
 598 
 599 void CodeCache::free_unused_tail(CodeBlob* cb, size_t used) {
 600   assert_locked_or_safepoint(CodeCache_lock);
 601   guarantee(cb->is_buffer_blob() && strncmp("Interpreter", cb->name(), 11) == 0, "Only possible for interpreter!");
 602   print_trace("free_unused_tail", cb);
 603 
 604   // We also have to account for the extra space (i.e. header) used by the CodeBlob
 605   // which provides the memory (see BufferBlob::create() in codeBlob.cpp).
 606   used += CodeBlob::align_code_offset(cb->header_size());
 607 

 562       ResourceMark rm;
 563       if (_nmethod_heaps->length() >= 1) {
 564         tty->print("%s", heap->name());
 565       } else {
 566         tty->print("CodeCache");
 567       }
 568       tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
 569                     (intptr_t)heap->low_boundary(), (intptr_t)heap->high(),
 570                     (address)heap->high() - (address)heap->low_boundary());
 571     }
 572   }
 573   print_trace("allocation", cb, size);
 574   return cb;
 575 }
 576 
 577 void CodeCache::free(CodeBlob* cb) {
 578   assert_locked_or_safepoint(CodeCache_lock);
 579   CodeHeap* heap = get_code_heap(cb);
 580   print_trace("free", cb);
 581   if (cb->is_nmethod()) {

 582     heap->set_nmethod_count(heap->nmethod_count() - 1);
 583     if (((nmethod *)cb)->has_dependencies()) {
 584       _number_of_nmethods_with_dependencies--;
 585     }

 586   }
 587   if (cb->is_adapter_blob()) {
 588     heap->set_adapter_count(heap->adapter_count() - 1);
 589   }
 590 
 591   // Get heap for given CodeBlob and deallocate
 592   get_code_heap(cb)->deallocate(cb);
 593 
 594   assert(heap->blob_count() >= 0, "sanity check");
 595 }
 596 
 597 void CodeCache::free_unused_tail(CodeBlob* cb, size_t used) {
 598   assert_locked_or_safepoint(CodeCache_lock);
 599   guarantee(cb->is_buffer_blob() && strncmp("Interpreter", cb->name(), 11) == 0, "Only possible for interpreter!");
 600   print_trace("free_unused_tail", cb);
 601 
 602   // We also have to account for the extra space (i.e. header) used by the CodeBlob
 603   // which provides the memory (see BufferBlob::create() in codeBlob.cpp).
 604   used += CodeBlob::align_code_offset(cb->header_size());
 605 
< prev index next >