< prev index next >

src/hotspot/share/code/nmethod.cpp

Print this page

1740 }
1741 
1742 
1743 // This is called at the end of the strong tracing/marking phase of a
1744 // GC to unload an nmethod if it contains otherwise unreachable
1745 // oops.
1746 
1747 void nmethod::do_unloading(bool unloading_occurred) {
1748   // Make sure the oop's ready to receive visitors
1749   assert(!is_zombie() && !is_unloaded(),
1750          "should not call follow on zombie or unloaded nmethod");
1751 
1752   if (is_unloading()) {
1753     make_unloaded();
1754   } else {
1755     guarantee(unload_nmethod_caches(unloading_occurred),
1756               "Should not need transition stubs");
1757   }
1758 }
1759 
1760 void nmethod::oops_do(OopClosure* f, bool allow_zombie) {
1761   // make sure the oops ready to receive visitors
1762   assert(allow_zombie || !is_zombie(), "should not call follow on zombie nmethod");
1763   assert(!is_unloaded(), "should not call follow on unloaded nmethod");
1764 
1765   // Prevent extra code cache walk for platforms that don't have immediate oops.
1766   if (relocInfo::mustIterateImmediateOopsInCode()) {
1767     RelocIterator iter(this, oops_reloc_begin());
1768 
1769     while (iter.next()) {
1770       if (iter.type() == relocInfo::oop_type ) {
1771         oop_Relocation* r = iter.oop_reloc();
1772         // In this loop, we must only follow those oops directly embedded in
1773         // the code.  Other oops (oop_index>0) are seen as part of scopes_oops.
1774         assert(1 == (r->oop_is_immediate()) +
1775                (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()),
1776                "oop must be found in exactly one place");
1777         if (r->oop_is_immediate() && r->oop_value() != NULL) {
1778           f->do_oop(r->oop_addr());
1779         }
1780       }
1781     }
1782   }
1783 

1740 }
1741 
1742 
1743 // This is called at the end of the strong tracing/marking phase of a
1744 // GC to unload an nmethod if it contains otherwise unreachable
1745 // oops.
1746 
1747 void nmethod::do_unloading(bool unloading_occurred) {
1748   // Make sure the oop's ready to receive visitors
1749   assert(!is_zombie() && !is_unloaded(),
1750          "should not call follow on zombie or unloaded nmethod");
1751 
1752   if (is_unloading()) {
1753     make_unloaded();
1754   } else {
1755     guarantee(unload_nmethod_caches(unloading_occurred),
1756               "Should not need transition stubs");
1757   }
1758 }
1759 
1760 void nmethod::oops_do(OopClosure* f, bool allow_dead) {
1761   // make sure the oops ready to receive visitors
1762   assert(allow_dead || is_alive(), "should not call follow on dead nmethod");

1763 
1764   // Prevent extra code cache walk for platforms that don't have immediate oops.
1765   if (relocInfo::mustIterateImmediateOopsInCode()) {
1766     RelocIterator iter(this, oops_reloc_begin());
1767 
1768     while (iter.next()) {
1769       if (iter.type() == relocInfo::oop_type ) {
1770         oop_Relocation* r = iter.oop_reloc();
1771         // In this loop, we must only follow those oops directly embedded in
1772         // the code.  Other oops (oop_index>0) are seen as part of scopes_oops.
1773         assert(1 == (r->oop_is_immediate()) +
1774                (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()),
1775                "oop must be found in exactly one place");
1776         if (r->oop_is_immediate() && r->oop_value() != NULL) {
1777           f->do_oop(r->oop_addr());
1778         }
1779       }
1780     }
1781   }
1782 
< prev index next >