src/share/vm/code/codeCache.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6951083 Sdiff src/share/vm/code

src/share/vm/code/codeCache.cpp

Print this page




  57 
  58   void print(const char* title) {
  59     tty->print_cr(" #%d %s = %dK (hdr %d%%,  loc %d%%, code %d%%, stub %d%%, [oops %d%%, data %d%%, pcs %d%%])",
  60                   count,
  61                   title,
  62                   total() / K,
  63                   header_size             * 100 / total_size,
  64                   relocation_size         * 100 / total_size,
  65                   code_size               * 100 / total_size,
  66                   stub_size               * 100 / total_size,
  67                   scopes_oop_size         * 100 / total_size,
  68                   scopes_data_size        * 100 / total_size,
  69                   scopes_pcs_size         * 100 / total_size);
  70   }
  71 
  72   void add(CodeBlob* cb) {
  73     count++;
  74     total_size       += cb->size();
  75     header_size      += cb->header_size();
  76     relocation_size  += cb->relocation_size();
  77     scopes_oop_size  += cb->oops_size();
  78     if (cb->is_nmethod()) {
  79       nmethod *nm = (nmethod*)cb;
  80       code_size        += nm->code_size();
  81       stub_size        += nm->stub_size();
  82 

  83       scopes_data_size += nm->scopes_data_size();
  84       scopes_pcs_size  += nm->scopes_pcs_size();
  85     } else {
  86       code_size        += cb->instructions_size();
  87     }
  88   }
  89 };
  90 
  91 
  92 // CodeCache implementation
  93 
  94 CodeHeap * CodeCache::_heap = new CodeHeap();
  95 int CodeCache::_number_of_blobs = 0;
  96 int CodeCache::_number_of_nmethods_with_dependencies = 0;
  97 bool CodeCache::_needs_cache_clean = false;
  98 nmethod* CodeCache::_scavenge_root_nmethods = NULL;
  99 nmethod* CodeCache::_saved_nmethods = NULL;
 100 
 101 
 102 CodeBlob* CodeCache::first() {


 474   }
 475   nm->method()->clear_code();
 476   nm->set_speculatively_disconnected(true);
 477 }
 478 
 479 
 480 void CodeCache::gc_prologue() {
 481   assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_epilogue must be called");
 482 }
 483 
 484 
 485 void CodeCache::gc_epilogue() {
 486   assert_locked_or_safepoint(CodeCache_lock);
 487   FOR_ALL_ALIVE_BLOBS(cb) {
 488     if (cb->is_nmethod()) {
 489       nmethod *nm = (nmethod*)cb;
 490       assert(!nm->is_unloaded(), "Tautology");
 491       if (needs_cache_clean()) {
 492         nm->cleanup_inline_caches();
 493       }
 494       debug_only(nm->verify();)

 495     }
 496     cb->fix_oop_relocations();
 497   }
 498   set_needs_cache_clean(false);
 499   prune_scavenge_root_nmethods();
 500   assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called");
 501 }
 502 
 503 
 504 address CodeCache::first_address() {
 505   assert_locked_or_safepoint(CodeCache_lock);
 506   return (address)_heap->begin();
 507 }
 508 
 509 
 510 address CodeCache::last_address() {
 511   assert_locked_or_safepoint(CodeCache_lock);
 512   return (address)_heap->end();
 513 }
 514 
 515 
 516 void icache_init();




  57 
  58   void print(const char* title) {
  59     tty->print_cr(" #%d %s = %dK (hdr %d%%,  loc %d%%, code %d%%, stub %d%%, [oops %d%%, data %d%%, pcs %d%%])",
  60                   count,
  61                   title,
  62                   total() / K,
  63                   header_size             * 100 / total_size,
  64                   relocation_size         * 100 / total_size,
  65                   code_size               * 100 / total_size,
  66                   stub_size               * 100 / total_size,
  67                   scopes_oop_size         * 100 / total_size,
  68                   scopes_data_size        * 100 / total_size,
  69                   scopes_pcs_size         * 100 / total_size);
  70   }
  71 
  72   void add(CodeBlob* cb) {
  73     count++;
  74     total_size       += cb->size();
  75     header_size      += cb->header_size();
  76     relocation_size  += cb->relocation_size();

  77     if (cb->is_nmethod()) {
  78       nmethod* nm = cb->as_nmethod_or_null();
  79       code_size        += nm->code_size();
  80       stub_size        += nm->stub_size();
  81 
  82       scopes_oop_size  += nm->oops_size();
  83       scopes_data_size += nm->scopes_data_size();
  84       scopes_pcs_size  += nm->scopes_pcs_size();
  85     } else {
  86       code_size        += cb->instructions_size();
  87     }
  88   }
  89 };
  90 
  91 
  92 // CodeCache implementation
  93 
  94 CodeHeap * CodeCache::_heap = new CodeHeap();
  95 int CodeCache::_number_of_blobs = 0;
  96 int CodeCache::_number_of_nmethods_with_dependencies = 0;
  97 bool CodeCache::_needs_cache_clean = false;
  98 nmethod* CodeCache::_scavenge_root_nmethods = NULL;
  99 nmethod* CodeCache::_saved_nmethods = NULL;
 100 
 101 
 102 CodeBlob* CodeCache::first() {


 474   }
 475   nm->method()->clear_code();
 476   nm->set_speculatively_disconnected(true);
 477 }
 478 
 479 
 480 void CodeCache::gc_prologue() {
 481   assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_epilogue must be called");
 482 }
 483 
 484 
 485 void CodeCache::gc_epilogue() {
 486   assert_locked_or_safepoint(CodeCache_lock);
 487   FOR_ALL_ALIVE_BLOBS(cb) {
 488     if (cb->is_nmethod()) {
 489       nmethod *nm = (nmethod*)cb;
 490       assert(!nm->is_unloaded(), "Tautology");
 491       if (needs_cache_clean()) {
 492         nm->cleanup_inline_caches();
 493       }
 494       DEBUG_ONLY(nm->verify());
 495       nm->fix_oop_relocations();
 496     }

 497   }
 498   set_needs_cache_clean(false);
 499   prune_scavenge_root_nmethods();
 500   assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called");
 501 }
 502 
 503 
 504 address CodeCache::first_address() {
 505   assert_locked_or_safepoint(CodeCache_lock);
 506   return (address)_heap->begin();
 507 }
 508 
 509 
 510 address CodeCache::last_address() {
 511   assert_locked_or_safepoint(CodeCache_lock);
 512   return (address)_heap->end();
 513 }
 514 
 515 
 516 void icache_init();


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