src/hotspot/share/code/nmethod.cpp
changeset 54150 5529640c5f67
parent 54122 4b1426ed1c44
child 54311 3fedbfdb25b6
equal deleted inserted replaced
54149:c61f09122d3b 54150:5529640c5f67
  1497   // event is enabled at the time the nmethod is made a zombie.
  1497   // event is enabled at the time the nmethod is made a zombie.
  1498   set_unload_reported();
  1498   set_unload_reported();
  1499 }
  1499 }
  1500 
  1500 
  1501 // Iterate over metadata calling this function.   Used by RedefineClasses
  1501 // Iterate over metadata calling this function.   Used by RedefineClasses
  1502 void nmethod::metadata_do(void f(Metadata*)) {
  1502 void nmethod::metadata_do(MetadataClosure* f) {
  1503   {
  1503   {
  1504     // Visit all immediate references that are embedded in the instruction stream.
  1504     // Visit all immediate references that are embedded in the instruction stream.
  1505     RelocIterator iter(this, oops_reloc_begin());
  1505     RelocIterator iter(this, oops_reloc_begin());
  1506     while (iter.next()) {
  1506     while (iter.next()) {
  1507       if (iter.type() == relocInfo::metadata_type ) {
  1507       if (iter.type() == relocInfo::metadata_type ) {
  1512         assert(1 == (r->metadata_is_immediate()) +
  1512         assert(1 == (r->metadata_is_immediate()) +
  1513                (r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()),
  1513                (r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()),
  1514                "metadata must be found in exactly one place");
  1514                "metadata must be found in exactly one place");
  1515         if (r->metadata_is_immediate() && r->metadata_value() != NULL) {
  1515         if (r->metadata_is_immediate() && r->metadata_value() != NULL) {
  1516           Metadata* md = r->metadata_value();
  1516           Metadata* md = r->metadata_value();
  1517           if (md != _method) f(md);
  1517           if (md != _method) f->do_metadata(md);
  1518         }
  1518         }
  1519       } else if (iter.type() == relocInfo::virtual_call_type) {
  1519       } else if (iter.type() == relocInfo::virtual_call_type) {
  1520         // Check compiledIC holders associated with this nmethod
  1520         // Check compiledIC holders associated with this nmethod
  1521         ResourceMark rm;
  1521         ResourceMark rm;
  1522         CompiledIC *ic = CompiledIC_at(&iter);
  1522         CompiledIC *ic = CompiledIC_at(&iter);
  1523         if (ic->is_icholder_call()) {
  1523         if (ic->is_icholder_call()) {
  1524           CompiledICHolder* cichk = ic->cached_icholder();
  1524           CompiledICHolder* cichk = ic->cached_icholder();
  1525           f(cichk->holder_metadata());
  1525           f->do_metadata(cichk->holder_metadata());
  1526           f(cichk->holder_klass());
  1526           f->do_metadata(cichk->holder_klass());
  1527         } else {
  1527         } else {
  1528           Metadata* ic_oop = ic->cached_metadata();
  1528           Metadata* ic_oop = ic->cached_metadata();
  1529           if (ic_oop != NULL) {
  1529           if (ic_oop != NULL) {
  1530             f(ic_oop);
  1530             f->do_metadata(ic_oop);
  1531           }
  1531           }
  1532         }
  1532         }
  1533       }
  1533       }
  1534     }
  1534     }
  1535   }
  1535   }
  1536 
  1536 
  1537   // Visit the metadata section
  1537   // Visit the metadata section
  1538   for (Metadata** p = metadata_begin(); p < metadata_end(); p++) {
  1538   for (Metadata** p = metadata_begin(); p < metadata_end(); p++) {
  1539     if (*p == Universe::non_oop_word() || *p == NULL)  continue;  // skip non-oops
  1539     if (*p == Universe::non_oop_word() || *p == NULL)  continue;  // skip non-oops
  1540     Metadata* md = *p;
  1540     Metadata* md = *p;
  1541     f(md);
  1541     f->do_metadata(md);
  1542   }
  1542   }
  1543 
  1543 
  1544   // Visit metadata not embedded in the other places.
  1544   // Visit metadata not embedded in the other places.
  1545   if (_method != NULL) f(_method);
  1545   if (_method != NULL) f->do_metadata(_method);
  1546 }
  1546 }
  1547 
  1547 
  1548 // The _is_unloading_state encodes a tuple comprising the unloading cycle
  1548 // The _is_unloading_state encodes a tuple comprising the unloading cycle
  1549 // and the result of IsUnloadingBehaviour::is_unloading() fpr that cycle.
  1549 // and the result of IsUnloadingBehaviour::is_unloading() fpr that cycle.
  1550 // This is the bit layout of the _is_unloading_state byte: 00000CCU
  1550 // This is the bit layout of the _is_unloading_state byte: 00000CCU