499
500 public:
501 VerifyStrongCodeRootOopClosure(const HeapRegion* hr, nmethod* nm):
502 _hr(hr), _failures(false), _has_oops_in_region(false) {}
503
504 void do_oop(narrowOop* p) { do_oop_work(p); }
505 void do_oop(oop* p) { do_oop_work(p); }
506
507 bool failures() { return _failures; }
508 bool has_oops_in_region() { return _has_oops_in_region; }
509 };
510
511 class VerifyStrongCodeRootCodeBlobClosure: public CodeBlobClosure {
512 const HeapRegion* _hr;
513 bool _failures;
514 public:
515 VerifyStrongCodeRootCodeBlobClosure(const HeapRegion* hr) :
516 _hr(hr), _failures(false) {}
517
518 void do_code_blob(CodeBlob* cb) {
519 nmethod* nm = (cb == NULL) ? NULL : cb->as_nmethod_or_null();
520 if (nm != NULL) {
521 // Verify that the nemthod is live
522 if (!nm->is_alive()) {
523 log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] has dead nmethod " PTR_FORMAT " in its strong code roots",
524 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
525 _failures = true;
526 } else {
527 VerifyStrongCodeRootOopClosure oop_cl(_hr, nm);
528 nm->oops_do(&oop_cl);
529 if (!oop_cl.has_oops_in_region()) {
530 log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] has nmethod " PTR_FORMAT " in its strong code roots with no pointers into region",
531 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
532 _failures = true;
533 } else if (oop_cl.failures()) {
534 log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] has other failures for nmethod " PTR_FORMAT,
535 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
536 _failures = true;
537 }
538 }
539 }
|
499
500 public:
501 VerifyStrongCodeRootOopClosure(const HeapRegion* hr, nmethod* nm):
502 _hr(hr), _failures(false), _has_oops_in_region(false) {}
503
504 void do_oop(narrowOop* p) { do_oop_work(p); }
505 void do_oop(oop* p) { do_oop_work(p); }
506
507 bool failures() { return _failures; }
508 bool has_oops_in_region() { return _has_oops_in_region; }
509 };
510
511 class VerifyStrongCodeRootCodeBlobClosure: public CodeBlobClosure {
512 const HeapRegion* _hr;
513 bool _failures;
514 public:
515 VerifyStrongCodeRootCodeBlobClosure(const HeapRegion* hr) :
516 _hr(hr), _failures(false) {}
517
518 void do_code_blob(CodeBlob* cb) {
519 nmethod* nm = (cb == NULL) ? NULL : cb->as_compiled_method()->as_nmethod_or_null();
520 if (nm != NULL) {
521 // Verify that the nemthod is live
522 if (!nm->is_alive()) {
523 log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] has dead nmethod " PTR_FORMAT " in its strong code roots",
524 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
525 _failures = true;
526 } else {
527 VerifyStrongCodeRootOopClosure oop_cl(_hr, nm);
528 nm->oops_do(&oop_cl);
529 if (!oop_cl.has_oops_in_region()) {
530 log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] has nmethod " PTR_FORMAT " in its strong code roots with no pointers into region",
531 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
532 _failures = true;
533 } else if (oop_cl.failures()) {
534 log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] has other failures for nmethod " PTR_FORMAT,
535 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm));
536 _failures = true;
537 }
538 }
539 }
|