src/share/vm/code/codeCache.cpp

Print this page
rev 4616 : Fixes fill up of code cache: added command line parameter which defines a
threshold (percentage of used code cache) at which the threshold for
C1 recompilation is increased.


 605     if (cb->is_nmethod()) {
 606       nmethod *nm = (nmethod*)cb;
 607       nm->oops_do(&voc);
 608       nm->verify_oop_relocations();
 609     }
 610   }
 611 }
 612 
 613 
 614 address CodeCache::first_address() {
 615   assert_locked_or_safepoint(CodeCache_lock);
 616   return (address)_heap->low_boundary();
 617 }
 618 
 619 
 620 address CodeCache::last_address() {
 621   assert_locked_or_safepoint(CodeCache_lock);
 622   return (address)_heap->high();
 623 }
 624 









 625 
 626 void icache_init();
 627 
 628 void CodeCache::initialize() {
 629   assert(CodeCacheSegmentSize >= (uintx)CodeEntryAlignment, "CodeCacheSegmentSize must be large enough to align entry points");
 630 #ifdef COMPILER2
 631   assert(CodeCacheSegmentSize >= (uintx)OptoLoopAlignment,  "CodeCacheSegmentSize must be large enough to align inner loops");
 632 #endif
 633   assert(CodeCacheSegmentSize >= sizeof(jdouble),    "CodeCacheSegmentSize must be large enough to align constants");
 634   // This was originally just a check of the alignment, causing failure, instead, round
 635   // the code cache to the page size.  In particular, Solaris is moving to a larger
 636   // default page size.
 637   CodeCacheExpansionSize = round_to(CodeCacheExpansionSize, os::vm_page_size());
 638   InitialCodeCacheSize = round_to(InitialCodeCacheSize, os::vm_page_size());
 639   ReservedCodeCacheSize = round_to(ReservedCodeCacheSize, os::vm_page_size());
 640   if (!_heap->reserve(ReservedCodeCacheSize, InitialCodeCacheSize, CodeCacheSegmentSize)) {
 641     vm_exit_during_initialization("Could not reserve enough space for code cache");
 642   }
 643 
 644   MemoryService::add_code_heap_memory_pool(_heap);




 605     if (cb->is_nmethod()) {
 606       nmethod *nm = (nmethod*)cb;
 607       nm->oops_do(&voc);
 608       nm->verify_oop_relocations();
 609     }
 610   }
 611 }
 612 
 613 
 614 address CodeCache::first_address() {
 615   assert_locked_or_safepoint(CodeCache_lock);
 616   return (address)_heap->low_boundary();
 617 }
 618 
 619 
 620 address CodeCache::last_address() {
 621   assert_locked_or_safepoint(CodeCache_lock);
 622   return (address)_heap->high();
 623 }
 624 
 625 /**
 626  * Returns the reverse free ratio. E.g., if 25% (1/4) of the code cache
 627  * is free, reverse_free_ratio() returns 4.
 628  */
 629 double CodeCache::reverse_free_ratio() {
 630   double unallocated_capacity = (double)(CodeCache::unallocated_capacity() - CodeCacheMinimumFreeSpace);
 631   double max_capacity = (double)CodeCache::max_capacity();
 632   return max_capacity / unallocated_capacity;
 633 }
 634 
 635 void icache_init();
 636 
 637 void CodeCache::initialize() {
 638   assert(CodeCacheSegmentSize >= (uintx)CodeEntryAlignment, "CodeCacheSegmentSize must be large enough to align entry points");
 639 #ifdef COMPILER2
 640   assert(CodeCacheSegmentSize >= (uintx)OptoLoopAlignment,  "CodeCacheSegmentSize must be large enough to align inner loops");
 641 #endif
 642   assert(CodeCacheSegmentSize >= sizeof(jdouble),    "CodeCacheSegmentSize must be large enough to align constants");
 643   // This was originally just a check of the alignment, causing failure, instead, round
 644   // the code cache to the page size.  In particular, Solaris is moving to a larger
 645   // default page size.
 646   CodeCacheExpansionSize = round_to(CodeCacheExpansionSize, os::vm_page_size());
 647   InitialCodeCacheSize = round_to(InitialCodeCacheSize, os::vm_page_size());
 648   ReservedCodeCacheSize = round_to(ReservedCodeCacheSize, os::vm_page_size());
 649   if (!_heap->reserve(ReservedCodeCacheSize, InitialCodeCacheSize, CodeCacheSegmentSize)) {
 650     vm_exit_during_initialization("Could not reserve enough space for code cache");
 651   }
 652 
 653   MemoryService::add_code_heap_memory_pool(_heap);