1665 assert(cur != NULL, "not NULL-terminated");
1666 nmethod* next = cur->_oops_do_mark_link;
1667 cur->_oops_do_mark_link = NULL;
1668 DEBUG_ONLY(cur->verify_oop_relocations());
1669 NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark"));
1670 cur = next;
1671 }
1672 nmethod* required = _oops_do_mark_nmethods;
1673 nmethod* observed = Atomic::cmpxchg((nmethod*)NULL, &_oops_do_mark_nmethods, required);
1674 guarantee(observed == required, "no races in this sequential code");
1675 if (TraceScavenge) { tty->print_cr("oops_do_marking_epilogue]"); }
1676 }
1677
1678 class DetectScavengeRoot: public OopClosure {
1679 bool _detected_scavenge_root;
1680 public:
1681 DetectScavengeRoot() : _detected_scavenge_root(false)
1682 { NOT_PRODUCT(_print_nm = NULL); }
1683 bool detected_scavenge_root() { return _detected_scavenge_root; }
1684 virtual void do_oop(oop* p) {
1685 if ((*p) != NULL && (*p)->is_scavengable()) {
1686 NOT_PRODUCT(maybe_print(p));
1687 _detected_scavenge_root = true;
1688 }
1689 }
1690 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
1691
1692 #ifndef PRODUCT
1693 nmethod* _print_nm;
1694 void maybe_print(oop* p) {
1695 if (_print_nm == NULL) return;
1696 if (!_detected_scavenge_root) _print_nm->print_on(tty, "new scavenge root");
1697 tty->print_cr("" PTR_FORMAT "[offset=%d] detected scavengable oop " PTR_FORMAT " (found at " PTR_FORMAT ")",
1698 p2i(_print_nm), (int)((intptr_t)p - (intptr_t)_print_nm),
1699 p2i(*p), p2i(p));
1700 (*p)->print();
1701 }
1702 #endif //PRODUCT
1703 };
1704
1705 bool nmethod::detect_scavenge_root_oops() {
2160 }
2161 default:
2162 break;
2163 }
2164 assert(stub == NULL || stub_contains(stub), "static call stub outside stub section");
2165 }
2166 }
2167
2168
2169 // -----------------------------------------------------------------------------
2170 // Non-product code
2171 #ifndef PRODUCT
2172
2173 class DebugScavengeRoot: public OopClosure {
2174 nmethod* _nm;
2175 bool _ok;
2176 public:
2177 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2178 bool ok() { return _ok; }
2179 virtual void do_oop(oop* p) {
2180 if ((*p) == NULL || !(*p)->is_scavengable()) return;
2181 if (_ok) {
2182 _nm->print_nmethod(true);
2183 _ok = false;
2184 }
2185 tty->print_cr("*** scavengable oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)",
2186 p2i(*p), p2i(p), (int)((intptr_t)p - (intptr_t)_nm));
2187 (*p)->print();
2188 }
2189 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2190 };
2191
2192 void nmethod::verify_scavenge_root_oops() {
2193 if (!on_scavenge_root_list()) {
2194 // Actually look inside, to verify the claim that it's clean.
2195 DebugScavengeRoot debug_scavenge_root(this);
2196 oops_do(&debug_scavenge_root);
2197 if (!debug_scavenge_root.ok())
2198 fatal("found an unadvertised bad scavengable oop in the code cache");
2199 }
2200 assert(scavenge_root_not_marked(), "");
|
1665 assert(cur != NULL, "not NULL-terminated");
1666 nmethod* next = cur->_oops_do_mark_link;
1667 cur->_oops_do_mark_link = NULL;
1668 DEBUG_ONLY(cur->verify_oop_relocations());
1669 NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark"));
1670 cur = next;
1671 }
1672 nmethod* required = _oops_do_mark_nmethods;
1673 nmethod* observed = Atomic::cmpxchg((nmethod*)NULL, &_oops_do_mark_nmethods, required);
1674 guarantee(observed == required, "no races in this sequential code");
1675 if (TraceScavenge) { tty->print_cr("oops_do_marking_epilogue]"); }
1676 }
1677
1678 class DetectScavengeRoot: public OopClosure {
1679 bool _detected_scavenge_root;
1680 public:
1681 DetectScavengeRoot() : _detected_scavenge_root(false)
1682 { NOT_PRODUCT(_print_nm = NULL); }
1683 bool detected_scavenge_root() { return _detected_scavenge_root; }
1684 virtual void do_oop(oop* p) {
1685 if ((*p) != NULL && Universe::heap()->is_scavengable(*p)) {
1686 NOT_PRODUCT(maybe_print(p));
1687 _detected_scavenge_root = true;
1688 }
1689 }
1690 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
1691
1692 #ifndef PRODUCT
1693 nmethod* _print_nm;
1694 void maybe_print(oop* p) {
1695 if (_print_nm == NULL) return;
1696 if (!_detected_scavenge_root) _print_nm->print_on(tty, "new scavenge root");
1697 tty->print_cr("" PTR_FORMAT "[offset=%d] detected scavengable oop " PTR_FORMAT " (found at " PTR_FORMAT ")",
1698 p2i(_print_nm), (int)((intptr_t)p - (intptr_t)_print_nm),
1699 p2i(*p), p2i(p));
1700 (*p)->print();
1701 }
1702 #endif //PRODUCT
1703 };
1704
1705 bool nmethod::detect_scavenge_root_oops() {
2160 }
2161 default:
2162 break;
2163 }
2164 assert(stub == NULL || stub_contains(stub), "static call stub outside stub section");
2165 }
2166 }
2167
2168
2169 // -----------------------------------------------------------------------------
2170 // Non-product code
2171 #ifndef PRODUCT
2172
2173 class DebugScavengeRoot: public OopClosure {
2174 nmethod* _nm;
2175 bool _ok;
2176 public:
2177 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2178 bool ok() { return _ok; }
2179 virtual void do_oop(oop* p) {
2180 if ((*p) == NULL || !Universe::heap()->is_scavengable(*p)) return;
2181 if (_ok) {
2182 _nm->print_nmethod(true);
2183 _ok = false;
2184 }
2185 tty->print_cr("*** scavengable oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)",
2186 p2i(*p), p2i(p), (int)((intptr_t)p - (intptr_t)_nm));
2187 (*p)->print();
2188 }
2189 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2190 };
2191
2192 void nmethod::verify_scavenge_root_oops() {
2193 if (!on_scavenge_root_list()) {
2194 // Actually look inside, to verify the claim that it's clean.
2195 DebugScavengeRoot debug_scavenge_root(this);
2196 oops_do(&debug_scavenge_root);
2197 if (!debug_scavenge_root.ok())
2198 fatal("found an unadvertised bad scavengable oop in the code cache");
2199 }
2200 assert(scavenge_root_not_marked(), "");
|