< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp
Print this page
rev 58063 : 8237780: Shenandoah: More reliable nmethod verification
*** 235,253 ****
ShenandoahNMethodOopDetector detector;
nm()->oops_do(&detector, allow_dead);
GrowableArray<oop*>* oops = detector.oops();
! assert(oops->length() == oop_count(), "Must match");
!
for (int index = 0; index < _oops_count; index ++) {
assert(oops->contains(_oops[index]), "Must contain this oop");
}
for (oop* p = nm()->oops_begin(); p < nm()->oops_end(); p ++) {
assert(oops->contains(p), "Must contain this oop");
}
}
void ShenandoahNMethod::assert_no_oops(nmethod* nm, bool allow_dead) {
ShenandoahNMethodOopDetector detector;
nm->oops_do(&detector, allow_dead);
--- 235,278 ----
ShenandoahNMethodOopDetector detector;
nm()->oops_do(&detector, allow_dead);
GrowableArray<oop*>* oops = detector.oops();
! int count = 0;
for (int index = 0; index < _oops_count; index ++) {
+ count++;
assert(oops->contains(_oops[index]), "Must contain this oop");
}
for (oop* p = nm()->oops_begin(); p < nm()->oops_end(); p ++) {
+ if (*p == Universe::non_oop_word()) continue;
+ count++;
assert(oops->contains(p), "Must contain this oop");
}
+ #ifdef ASSERT_DISABLED
+ if (oops->length() < count) {
+ tty->print_cr("detected locs: %d", oops->length());
+ for (int i = 0; i < oops->length(); i++) {
+ tty->print_cr("-> " PTR_FORMAT, p2i(oops->at(i)));
+ }
+ tty->print_cr("recorded oops: %d", _oops_count);
+ for (int i = 0; i < _oops_count; i++) {
+ tty->print_cr("-> " PTR_FORMAT, p2i(_oops[i]));
+ }
+ GrowableArray<oop*> check;
+ bool non_immed;
+ detect_reloc_oops(nm(), check, non_immed);
+ tty->print_cr("check oops: %d", check.length());
+ for (int i = 0; i < check.length(); i++) {
+ tty->print_cr("-> " PTR_FORMAT, p2i(check.at(i)));
+ }
+ assert(false, "Must match #detected: %d, #recorded: %d, #total: %d, begin: " PTR_FORMAT ", end: " PTR_FORMAT, oops->length(), _oops_count, count, p2i(nm()->oops_begin()), p2i(nm()->oops_end()));
+ }
+ #endif
+ assert(oops->length() >= count,
+ "Must match #detected: %d, #recorded: %d, #total: %d, begin: " PTR_FORMAT ", end: " PTR_FORMAT,
+ oops->length(), _oops_count, count, p2i(nm()->oops_begin()), p2i(nm()->oops_end()));
}
void ShenandoahNMethod::assert_no_oops(nmethod* nm, bool allow_dead) {
ShenandoahNMethodOopDetector detector;
nm->oops_do(&detector, allow_dead);
*** 275,284 ****
--- 300,310 ----
ShenandoahNMethod* data = ShenandoahNMethod::gc_data(nm);
ShenandoahReentrantLocker data_locker(data != NULL ? data->lock() : NULL);
if (data != NULL) {
assert(contain(nm), "Must have been registered");
+ assert(nm == data->nm(), "must be same nmethod");
data->update();
} else {
data = ShenandoahNMethod::for_nmethod(nm);
if (data == NULL) {
assert(!ShenandoahConcurrentRoots::can_do_concurrent_class_unloading(),
< prev index next >