hotspot/src/share/vm/code/codeCache.cpp
changeset 5686 5435e77aa3df
parent 5533 e8d9ff82ec62
child 5702 201c5cde25bb
equal deleted inserted replaced
5539:261ecc5bb65e 5686:5435e77aa3df
    72   void add(CodeBlob* cb) {
    72   void add(CodeBlob* cb) {
    73     count++;
    73     count++;
    74     total_size       += cb->size();
    74     total_size       += cb->size();
    75     header_size      += cb->header_size();
    75     header_size      += cb->header_size();
    76     relocation_size  += cb->relocation_size();
    76     relocation_size  += cb->relocation_size();
    77     scopes_oop_size  += cb->oops_size();
       
    78     if (cb->is_nmethod()) {
    77     if (cb->is_nmethod()) {
    79       nmethod *nm = (nmethod*)cb;
    78       nmethod* nm = cb->as_nmethod_or_null();
    80       code_size        += nm->code_size();
    79       code_size        += nm->code_size();
    81       stub_size        += nm->stub_size();
    80       stub_size        += nm->stub_size();
    82 
    81 
       
    82       scopes_oop_size  += nm->oops_size();
    83       scopes_data_size += nm->scopes_data_size();
    83       scopes_data_size += nm->scopes_data_size();
    84       scopes_pcs_size  += nm->scopes_pcs_size();
    84       scopes_pcs_size  += nm->scopes_pcs_size();
    85     } else {
    85     } else {
    86       code_size        += cb->instructions_size();
    86       code_size        += cb->instructions_size();
    87     }
    87     }
   260 int CodeCache::alignment_offset() {
   260 int CodeCache::alignment_offset() {
   261   return (int)_heap->alignment_offset();
   261   return (int)_heap->alignment_offset();
   262 }
   262 }
   263 
   263 
   264 
   264 
   265 // Mark code blobs for unloading if they contain otherwise
   265 // Mark nmethods for unloading if they contain otherwise unreachable
   266 // unreachable oops.
   266 // oops.
   267 void CodeCache::do_unloading(BoolObjectClosure* is_alive,
   267 void CodeCache::do_unloading(BoolObjectClosure* is_alive,
   268                              OopClosure* keep_alive,
   268                              OopClosure* keep_alive,
   269                              bool unloading_occurred) {
   269                              bool unloading_occurred) {
   270   assert_locked_or_safepoint(CodeCache_lock);
   270   assert_locked_or_safepoint(CodeCache_lock);
   271   FOR_ALL_ALIVE_BLOBS(cb) {
   271   FOR_ALL_ALIVE_NMETHODS(nm) {
   272     cb->do_unloading(is_alive, keep_alive, unloading_occurred);
   272     nm->do_unloading(is_alive, keep_alive, unloading_occurred);
   273   }
   273   }
   274 }
   274 }
   275 
   275 
   276 void CodeCache::blobs_do(CodeBlobClosure* f) {
   276 void CodeCache::blobs_do(CodeBlobClosure* f) {
   277   assert_locked_or_safepoint(CodeCache_lock);
   277   assert_locked_or_safepoint(CodeCache_lock);
   507       nmethod *nm = (nmethod*)cb;
   507       nmethod *nm = (nmethod*)cb;
   508       assert(!nm->is_unloaded(), "Tautology");
   508       assert(!nm->is_unloaded(), "Tautology");
   509       if (needs_cache_clean()) {
   509       if (needs_cache_clean()) {
   510         nm->cleanup_inline_caches();
   510         nm->cleanup_inline_caches();
   511       }
   511       }
   512       debug_only(nm->verify();)
   512       DEBUG_ONLY(nm->verify());
   513     }
   513       nm->fix_oop_relocations();
   514     cb->fix_oop_relocations();
   514     }
   515   }
   515   }
   516   set_needs_cache_clean(false);
   516   set_needs_cache_clean(false);
   517   prune_scavenge_root_nmethods();
   517   prune_scavenge_root_nmethods();
   518   assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called");
   518   assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called");
   519 }
   519 }