449 void ShenandoahAsserts::assert_not_in_cset(void* interior_loc, oop obj, const char* file, int line) {
450 assert_correct(interior_loc, obj, file, line);
451
452 ShenandoahHeap* heap = ShenandoahHeap::heap();
453 if (heap->in_collection_set(obj)) {
454 print_failure(_safe_all, obj, interior_loc, nullptr, "Shenandoah assert_not_in_cset failed",
455 "Object should not be in collection set",
456 file, line);
457 }
458 }
459
460 void ShenandoahAsserts::assert_not_in_cset_loc(void* interior_loc, const char* file, int line) {
461 ShenandoahHeap* heap = ShenandoahHeap::heap();
462 if (heap->in_collection_set_loc(interior_loc)) {
463 print_failure(_safe_unknown, nullptr, interior_loc, nullptr, "Shenandoah assert_not_in_cset_loc failed",
464 "Interior location should not be in collection set",
465 file, line);
466 }
467 }
468
469 void ShenandoahAsserts::print_rp_failure(const char *label, BoolObjectClosure* actual,
470 const char *file, int line) {
471 ShenandoahMessageBuffer msg("%s\n", label);
472 msg.append(" Actual: " PTR_FORMAT "\n", p2i(actual));
473 report_vm_error(file, line, msg.buffer());
474 }
475
476 void ShenandoahAsserts::assert_locked_or_shenandoah_safepoint(Mutex* lock, const char* file, int line) {
477 if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) {
478 return;
479 }
480
481 if (lock->owned_by_self()) {
482 return;
483 }
484
485 ShenandoahMessageBuffer msg("Must be at a Shenandoah safepoint or held %s lock", lock->name());
486 report_vm_error(file, line, msg.buffer());
487 }
488
|
449 void ShenandoahAsserts::assert_not_in_cset(void* interior_loc, oop obj, const char* file, int line) {
450 assert_correct(interior_loc, obj, file, line);
451
452 ShenandoahHeap* heap = ShenandoahHeap::heap();
453 if (heap->in_collection_set(obj)) {
454 print_failure(_safe_all, obj, interior_loc, nullptr, "Shenandoah assert_not_in_cset failed",
455 "Object should not be in collection set",
456 file, line);
457 }
458 }
459
460 void ShenandoahAsserts::assert_not_in_cset_loc(void* interior_loc, const char* file, int line) {
461 ShenandoahHeap* heap = ShenandoahHeap::heap();
462 if (heap->in_collection_set_loc(interior_loc)) {
463 print_failure(_safe_unknown, nullptr, interior_loc, nullptr, "Shenandoah assert_not_in_cset_loc failed",
464 "Interior location should not be in collection set",
465 file, line);
466 }
467 }
468
469 void ShenandoahAsserts::assert_in_young(void* interior_loc, oop obj, const char* file, int line) {
470 assert_correct(interior_loc, obj, file, line);
471
472 ShenandoahHeap* heap = ShenandoahHeap::heap();
473 if (!heap->heap_region_containing(obj)->is_young()) {
474 print_failure(_safe_all, obj, interior_loc, nullptr, "Shenandoah assert_in_young failed",
475 "Object should be in young region",
476 file, line);
477 }
478 }
479
480 void ShenandoahAsserts::print_rp_failure(const char *label, BoolObjectClosure* actual,
481 const char *file, int line) {
482 ShenandoahMessageBuffer msg("%s\n", label);
483 msg.append(" Actual: " PTR_FORMAT "\n", p2i(actual));
484 report_vm_error(file, line, msg.buffer());
485 }
486
487 void ShenandoahAsserts::assert_locked_or_shenandoah_safepoint(Mutex* lock, const char* file, int line) {
488 if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) {
489 return;
490 }
491
492 if (lock->owned_by_self()) {
493 return;
494 }
495
496 ShenandoahMessageBuffer msg("Must be at a Shenandoah safepoint or held %s lock", lock->name());
497 report_vm_error(file, line, msg.buffer());
498 }
499
|