< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp

Print this page




 611   guarantee(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "only when nothing else happens");
 612   guarantee(ShenandoahVerify, "only when enabled, and bitmap is initialized in ShenandoahHeap::initialize");
 613 
 614   // Avoid side-effect of changing workers' active thread count, but bypass concurrent/parallel protocol check
 615   ShenandoahPushWorkerScope verify_worker_scope(_heap->workers(), _heap->max_workers(), false /*bypass check*/);
 616 
 617   log_info(gc,start)("Verify %s, Level " INTX_FORMAT, label, ShenandoahVerifyLevel);
 618 
 619   // GC state checks
 620   {
 621     char expected = -1;
 622     bool enabled;
 623     switch (gcstate) {
 624       case _verify_gcstate_disable:
 625         enabled = false;
 626         break;
 627       case _verify_gcstate_forwarded:
 628         enabled = true;
 629         expected = ShenandoahHeap::HAS_FORWARDED;
 630         break;
 631       case _verify_gcstate_evacuation:
 632         enabled = true;
 633         expected = ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION;
 634         break;
 635       case _verify_gcstate_stable:
 636         enabled = true;
 637         expected = ShenandoahHeap::STABLE;
 638         break;
 639       default:
 640         enabled = false;
 641         assert(false, "Unhandled gc-state verification");
 642     }
 643 
 644     if (enabled) {
 645       char actual = _heap->gc_state();
 646       if (actual != expected) {
 647         fatal("%s: Global gc-state: expected %d, actual %d", label, expected, actual);
 648       }
 649 
 650       VerifyThreadGCState vtgcs(label, expected);
 651       Threads::java_threads_do(&vtgcs);
 652     }
 653   }
 654 


 792   verify_at_safepoint(
 793           "After Mark",
 794           _verify_forwarded_none,      // no forwarded references
 795           _verify_marked_complete,     // bitmaps as precise as we can get
 796           _verify_cset_none,           // no references to cset anymore
 797           _verify_liveness_complete,   // liveness data must be complete here
 798           _verify_regions_disable,     // trash regions not yet recycled
 799           _verify_gcstate_stable       // mark should have stabilized the heap
 800   );
 801 }
 802 
 803 void ShenandoahVerifier::verify_before_evacuation() {
 804   verify_at_safepoint(
 805           "Before Evacuation",
 806           _verify_forwarded_none,    // no forwarded references
 807           _verify_marked_complete,   // walk over marked objects too
 808           _verify_cset_disable,      // non-forwarded references to cset expected
 809           _verify_liveness_complete, // liveness data must be complete here
 810           _verify_regions_disable,   // trash regions not yet recycled
 811           _verify_gcstate_stable     // mark should have stabilized the heap
 812   );
 813 }
 814 
 815 void ShenandoahVerifier::verify_during_evacuation() {
 816   verify_at_safepoint(
 817           "During Evacuation",
 818           _verify_forwarded_allow,   // some forwarded references are allowed
 819           _verify_marked_disable,    // walk only roots
 820           _verify_cset_disable,      // some cset references are not forwarded yet
 821           _verify_liveness_disable,  // liveness data might be already stale after pre-evacs
 822           _verify_regions_disable,   // trash regions not yet recycled
 823           _verify_gcstate_evacuation // evacuation is in progress
 824   );
 825 }
 826 
 827 void ShenandoahVerifier::verify_after_evacuation() {
 828   verify_at_safepoint(
 829           "After Evacuation",
 830           _verify_forwarded_allow,     // objects are still forwarded
 831           _verify_marked_complete,     // bitmaps might be stale, but alloc-after-mark should be well
 832           _verify_cset_forwarded,      // all cset refs are fully forwarded
 833           _verify_liveness_disable,    // no reliable liveness data anymore
 834           _verify_regions_notrash,     // trash regions have been recycled already
 835           _verify_gcstate_forwarded    // evacuation produced some forwarded objects
 836   );
 837 }
 838 
 839 void ShenandoahVerifier::verify_before_updaterefs() {
 840   verify_at_safepoint(
 841           "Before Updating References",
 842           _verify_forwarded_allow,     // forwarded references allowed
 843           _verify_marked_complete,     // bitmaps might be stale, but alloc-after-mark should be well




 611   guarantee(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "only when nothing else happens");
 612   guarantee(ShenandoahVerify, "only when enabled, and bitmap is initialized in ShenandoahHeap::initialize");
 613 
 614   // Avoid side-effect of changing workers' active thread count, but bypass concurrent/parallel protocol check
 615   ShenandoahPushWorkerScope verify_worker_scope(_heap->workers(), _heap->max_workers(), false /*bypass check*/);
 616 
 617   log_info(gc,start)("Verify %s, Level " INTX_FORMAT, label, ShenandoahVerifyLevel);
 618 
 619   // GC state checks
 620   {
 621     char expected = -1;
 622     bool enabled;
 623     switch (gcstate) {
 624       case _verify_gcstate_disable:
 625         enabled = false;
 626         break;
 627       case _verify_gcstate_forwarded:
 628         enabled = true;
 629         expected = ShenandoahHeap::HAS_FORWARDED;
 630         break;




 631       case _verify_gcstate_stable:
 632         enabled = true;
 633         expected = ShenandoahHeap::STABLE;
 634         break;
 635       default:
 636         enabled = false;
 637         assert(false, "Unhandled gc-state verification");
 638     }
 639 
 640     if (enabled) {
 641       char actual = _heap->gc_state();
 642       if (actual != expected) {
 643         fatal("%s: Global gc-state: expected %d, actual %d", label, expected, actual);
 644       }
 645 
 646       VerifyThreadGCState vtgcs(label, expected);
 647       Threads::java_threads_do(&vtgcs);
 648     }
 649   }
 650 


 788   verify_at_safepoint(
 789           "After Mark",
 790           _verify_forwarded_none,      // no forwarded references
 791           _verify_marked_complete,     // bitmaps as precise as we can get
 792           _verify_cset_none,           // no references to cset anymore
 793           _verify_liveness_complete,   // liveness data must be complete here
 794           _verify_regions_disable,     // trash regions not yet recycled
 795           _verify_gcstate_stable       // mark should have stabilized the heap
 796   );
 797 }
 798 
 799 void ShenandoahVerifier::verify_before_evacuation() {
 800   verify_at_safepoint(
 801           "Before Evacuation",
 802           _verify_forwarded_none,    // no forwarded references
 803           _verify_marked_complete,   // walk over marked objects too
 804           _verify_cset_disable,      // non-forwarded references to cset expected
 805           _verify_liveness_complete, // liveness data must be complete here
 806           _verify_regions_disable,   // trash regions not yet recycled
 807           _verify_gcstate_stable     // mark should have stabilized the heap












 808   );
 809 }
 810 
 811 void ShenandoahVerifier::verify_after_evacuation() {
 812   verify_at_safepoint(
 813           "After Evacuation",
 814           _verify_forwarded_allow,     // objects are still forwarded
 815           _verify_marked_complete,     // bitmaps might be stale, but alloc-after-mark should be well
 816           _verify_cset_forwarded,      // all cset refs are fully forwarded
 817           _verify_liveness_disable,    // no reliable liveness data anymore
 818           _verify_regions_notrash,     // trash regions have been recycled already
 819           _verify_gcstate_forwarded    // evacuation produced some forwarded objects
 820   );
 821 }
 822 
 823 void ShenandoahVerifier::verify_before_updaterefs() {
 824   verify_at_safepoint(
 825           "Before Updating References",
 826           _verify_forwarded_allow,     // forwarded references allowed
 827           _verify_marked_complete,     // bitmaps might be stale, but alloc-after-mark should be well


< prev index next >