hotspot/src/share/vm/code/nmethod.cpp
changeset 3913 e049e6b81e11
parent 3912 3aaaaad1ccb0
child 4479 5686407cde7a
equal deleted inserted replaced
3912:3aaaaad1ccb0 3913:e049e6b81e11
  1556 // This method is called twice during GC -- once while
  1556 // This method is called twice during GC -- once while
  1557 // tracing the "active" nmethods on thread stacks during
  1557 // tracing the "active" nmethods on thread stacks during
  1558 // the (strong) marking phase, and then again when walking
  1558 // the (strong) marking phase, and then again when walking
  1559 // the code cache contents during the weak roots processing
  1559 // the code cache contents during the weak roots processing
  1560 // phase. The two uses are distinguished by means of the
  1560 // phase. The two uses are distinguished by means of the
  1561 // do_nmethods() method in the closure "f" below -- which
  1561 // 'do_strong_roots_only' flag, which is true in the first
  1562 // answers "yes" in the first case, and "no" in the second
       
  1563 // case. We want to walk the weak roots in the nmethod
  1562 // case. We want to walk the weak roots in the nmethod
  1564 // only in the second case. The weak roots in the nmethod
  1563 // only in the second case. The weak roots in the nmethod
  1565 // are the oops in the ExceptionCache and the InlineCache
  1564 // are the oops in the ExceptionCache and the InlineCache
  1566 // oops.
  1565 // oops.
  1567 void nmethod::oops_do(OopClosure* f) {
  1566 void nmethod::oops_do(OopClosure* f, bool do_strong_roots_only) {
  1568   // make sure the oops ready to receive visitors
  1567   // make sure the oops ready to receive visitors
  1569   assert(!is_zombie() && !is_unloaded(),
  1568   assert(!is_zombie() && !is_unloaded(),
  1570          "should not call follow on zombie or unloaded nmethod");
  1569          "should not call follow on zombie or unloaded nmethod");
  1571 
  1570 
  1572   // If the method is not entrant or zombie then a JMP is plastered over the
  1571   // If the method is not entrant or zombie then a JMP is plastered over the
  1580     // (See comment above.)
  1579     // (See comment above.)
  1581   }
  1580   }
  1582 
  1581 
  1583   // Compiled code
  1582   // Compiled code
  1584   f->do_oop((oop*) &_method);
  1583   f->do_oop((oop*) &_method);
  1585   if (!f->do_nmethods()) {
  1584   if (!do_strong_roots_only) {
  1586     // weak roots processing phase -- update ExceptionCache oops
  1585     // weak roots processing phase -- update ExceptionCache oops
  1587     ExceptionCache* ec = exception_cache();
  1586     ExceptionCache* ec = exception_cache();
  1588     while(ec != NULL) {
  1587     while(ec != NULL) {
  1589       f->do_oop((oop*)ec->exception_type_addr());
  1588       f->do_oop((oop*)ec->exception_type_addr());
  1590       ec = ec->next();
  1589       ec = ec->next();