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

src/share/vm/code/codeCache.cpp

Print this page


   1 /*
   2  * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


 267 #endif //ASSERT
 268   }
 269 }
 270 
 271 // Walk the list of methods which might contain non-perm oops.
 272 void CodeCache::scavenge_root_nmethods_do(CodeBlobClosure* f) {
 273   assert_locked_or_safepoint(CodeCache_lock);
 274   debug_only(mark_scavenge_root_nmethods());
 275 
 276   for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
 277     debug_only(cur->clear_scavenge_root_marked());
 278     assert(cur->scavenge_root_not_marked(), "");
 279     assert(cur->on_scavenge_root_list(), "else shouldn't be on this list");
 280 
 281     bool is_live = (!cur->is_zombie() && !cur->is_unloaded());
 282 #ifndef PRODUCT
 283     if (TraceScavenge) {
 284       cur->print_on(tty, is_live ? "scavenge root" : "dead scavenge root"); tty->cr();
 285     }
 286 #endif //PRODUCT
 287     if (is_live)
 288       // Perform cur->oops_do(f), maybe just once per nmethod.
 289       f->do_code_blob(cur);


 290   }
 291 
 292   // Check for stray marks.
 293   debug_only(verify_perm_nmethods(NULL));
 294 }
 295 
 296 void CodeCache::add_scavenge_root_nmethod(nmethod* nm) {
 297   assert_locked_or_safepoint(CodeCache_lock);
 298   nm->set_on_scavenge_root_list();
 299   nm->set_scavenge_root_link(_scavenge_root_nmethods);
 300   set_scavenge_root_nmethods(nm);
 301   print_trace("add_scavenge_root", nm);
 302 }
 303 
 304 void CodeCache::drop_scavenge_root_nmethod(nmethod* nm) {
 305   assert_locked_or_safepoint(CodeCache_lock);
 306   print_trace("drop_scavenge_root", nm);
 307   nmethod* last = NULL;
 308   nmethod* cur = scavenge_root_nmethods();
 309   while (cur != NULL) {


   1 /*
   2  * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


 267 #endif //ASSERT
 268   }
 269 }
 270 
 271 // Walk the list of methods which might contain non-perm oops.
 272 void CodeCache::scavenge_root_nmethods_do(CodeBlobClosure* f) {
 273   assert_locked_or_safepoint(CodeCache_lock);
 274   debug_only(mark_scavenge_root_nmethods());
 275 
 276   for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
 277     debug_only(cur->clear_scavenge_root_marked());
 278     assert(cur->scavenge_root_not_marked(), "");
 279     assert(cur->on_scavenge_root_list(), "else shouldn't be on this list");
 280 
 281     bool is_live = (!cur->is_zombie() && !cur->is_unloaded());
 282 #ifndef PRODUCT
 283     if (TraceScavenge) {
 284       cur->print_on(tty, is_live ? "scavenge root" : "dead scavenge root"); tty->cr();
 285     }
 286 #endif //PRODUCT
 287     if (is_live) {
 288       // Perform cur->oops_do(f), maybe just once per nmethod.
 289       f->do_code_blob(cur);
 290       cur->fix_oop_relocations();
 291     }
 292   }
 293 
 294   // Check for stray marks.
 295   debug_only(verify_perm_nmethods(NULL));
 296 }
 297 
 298 void CodeCache::add_scavenge_root_nmethod(nmethod* nm) {
 299   assert_locked_or_safepoint(CodeCache_lock);
 300   nm->set_on_scavenge_root_list();
 301   nm->set_scavenge_root_link(_scavenge_root_nmethods);
 302   set_scavenge_root_nmethods(nm);
 303   print_trace("add_scavenge_root", nm);
 304 }
 305 
 306 void CodeCache::drop_scavenge_root_nmethod(nmethod* nm) {
 307   assert_locked_or_safepoint(CodeCache_lock);
 308   print_trace("drop_scavenge_root", nm);
 309   nmethod* last = NULL;
 310   nmethod* cur = scavenge_root_nmethods();
 311   while (cur != NULL) {


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