1523 // Iterate over metadata calling this function. Used by RedefineClasses
1524 void nmethod::metadata_do(void f(Metadata*)) {
1525 {
1526 // Visit all immediate references that are embedded in the instruction stream.
1527 RelocIterator iter(this, oops_reloc_begin());
1528 while (iter.next()) {
1529 if (iter.type() == relocInfo::metadata_type ) {
1530 metadata_Relocation* r = iter.metadata_reloc();
1531 // In this metadata, we must only follow those metadatas directly embedded in
1532 // the code. Other metadatas (oop_index>0) are seen as part of
1533 // the metadata section below.
1534 assert(1 == (r->metadata_is_immediate()) +
1535 (r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()),
1536 "metadata must be found in exactly one place");
1537 if (r->metadata_is_immediate() && r->metadata_value() != NULL) {
1538 Metadata* md = r->metadata_value();
1539 if (md != _method) f(md);
1540 }
1541 } else if (iter.type() == relocInfo::virtual_call_type) {
1542 // Check compiledIC holders associated with this nmethod
1543 CompiledIC *ic = CompiledIC_at(&iter);
1544 if (ic->is_icholder_call()) {
1545 CompiledICHolder* cichk = ic->cached_icholder();
1546 f(cichk->holder_metadata());
1547 f(cichk->holder_klass());
1548 } else {
1549 Metadata* ic_oop = ic->cached_metadata();
1550 if (ic_oop != NULL) {
1551 f(ic_oop);
1552 }
1553 }
1554 }
1555 }
1556 }
1557
1558 // Visit the metadata section
1559 for (Metadata** p = metadata_begin(); p < metadata_end(); p++) {
1560 if (*p == Universe::non_oop_word() || *p == NULL) continue; // skip non-oops
1561 Metadata* md = *p;
1562 f(md);
|
1523 // Iterate over metadata calling this function. Used by RedefineClasses
1524 void nmethod::metadata_do(void f(Metadata*)) {
1525 {
1526 // Visit all immediate references that are embedded in the instruction stream.
1527 RelocIterator iter(this, oops_reloc_begin());
1528 while (iter.next()) {
1529 if (iter.type() == relocInfo::metadata_type ) {
1530 metadata_Relocation* r = iter.metadata_reloc();
1531 // In this metadata, we must only follow those metadatas directly embedded in
1532 // the code. Other metadatas (oop_index>0) are seen as part of
1533 // the metadata section below.
1534 assert(1 == (r->metadata_is_immediate()) +
1535 (r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()),
1536 "metadata must be found in exactly one place");
1537 if (r->metadata_is_immediate() && r->metadata_value() != NULL) {
1538 Metadata* md = r->metadata_value();
1539 if (md != _method) f(md);
1540 }
1541 } else if (iter.type() == relocInfo::virtual_call_type) {
1542 // Check compiledIC holders associated with this nmethod
1543 ResourceMark rm;
1544 CompiledIC *ic = CompiledIC_at(&iter);
1545 if (ic->is_icholder_call()) {
1546 CompiledICHolder* cichk = ic->cached_icholder();
1547 f(cichk->holder_metadata());
1548 f(cichk->holder_klass());
1549 } else {
1550 Metadata* ic_oop = ic->cached_metadata();
1551 if (ic_oop != NULL) {
1552 f(ic_oop);
1553 }
1554 }
1555 }
1556 }
1557 }
1558
1559 // Visit the metadata section
1560 for (Metadata** p = metadata_begin(); p < metadata_end(); p++) {
1561 if (*p == Universe::non_oop_word() || *p == NULL) continue; // skip non-oops
1562 Metadata* md = *p;
1563 f(md);
|