< prev index next >

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

Print this page
@@ -1,7 +1,8 @@
  /*
   * Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved.
+  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -30,10 +31,11 @@
  #include "memory/allocation.hpp"
  #include "oops/oopsHierarchy.hpp"
  #include "utilities/stack.hpp"
  
  class ShenandoahHeap;
+ class ShenandoahMarkingContext;
  
  #ifdef _WINDOWS
  #pragma warning( disable : 4522 )
  #endif
  

@@ -55,10 +57,28 @@
  class ShenandoahVerifier : public CHeapObj<mtGC> {
  private:
    ShenandoahHeap* _heap;
    MarkBitMap* _verification_bit_map;
  public:
+   typedef enum {
+     // Disable remembered set verification.
+     _verify_remembered_disable,
+ 
+     // Old objects should be registered and RS cards within *read-only* RS are dirty for all
+     // inter-generational pointers.
+     _verify_remembered_before_marking,
+ 
+     // Old objects should be registered and RS cards within *read-write* RS are dirty for all
+     // inter-generational pointers.
+     _verify_remembered_before_updating_references,
+ 
+     // Old objects should be registered and RS cards within *read-write* RS are dirty for all
+     // inter-generational pointers. Differs from previous verification modes by using top instead
+     // of update watermark and not using the marking context.
+     _verify_remembered_after_full_gc
+   } VerifyRememberedSet;
+ 
    typedef enum {
      // Disable marked objects verification.
      _verify_marked_disable,
  
      // Objects should be marked in "next" bitmap.

@@ -67,11 +87,16 @@
      // Objects should be marked in "complete" bitmap.
      _verify_marked_complete,
  
      // Objects should be marked in "complete" bitmap, except j.l.r.Reference referents, which
      // may be dangling after marking but before conc-weakrefs-processing.
-     _verify_marked_complete_except_references
+     _verify_marked_complete_except_references,
+ 
+     // Objects should be marked in "complete" bitmap, except j.l.r.Reference referents, which
+     // may be dangling after marking but before conc-weakrefs-processing. All SATB buffers must
+     // be empty.
+     _verify_marked_complete_satb_empty,
    } VerifyMarked;
  
    typedef enum {
      // Disable forwarded objects verification.
      _verify_forwarded_disable,

@@ -120,10 +145,21 @@
  
      // No trash and no cset regions allowed
      _verify_regions_notrash_nocset
    } VerifyRegions;
  
+   typedef enum {
+     // Disable size verification
+     _verify_size_disable,
+ 
+     // Enforce exact consistency
+     _verify_size_exact,
+ 
+     // Expect promote-in-place adjustments: padding inserted to temporarily prevent further allocation in regular regions
+     _verify_size_adjusted_for_padding
+   } VerifySize;
+ 
    typedef enum {
      // Disable gc-state verification
      _verify_gcstate_disable,
  
      // Nothing is in progress, no forwarded objects

@@ -131,14 +167,11 @@
  
      // Nothing is in progress, no forwarded objects, weak roots handling
      _verify_gcstate_stable_weakroots,
  
      // Nothing is in progress, some objects are forwarded
-     _verify_gcstate_forwarded,
- 
-     // Evacuation is in progress, some objects are forwarded
-     _verify_gcstate_evacuation
+     _verify_gcstate_forwarded
    } VerifyGCState;
  
    struct VerifyOptions {
      VerifyForwarded     _verify_forwarded;
      VerifyMarked        _verify_marked;

@@ -158,36 +191,49 @@
              _verify_liveness(verify_liveness), _verify_regions(verify_regions),
              _verify_gcstate(verify_gcstate) {}
    };
  
  private:
-   void verify_at_safepoint(const char *label,
+   void verify_at_safepoint(const char* label,
+                            VerifyRememberedSet remembered,
                             VerifyForwarded forwarded,
                             VerifyMarked marked,
                             VerifyCollectionSet cset,
                             VerifyLiveness liveness,
                             VerifyRegions regions,
+                            VerifySize sizeness,
                             VerifyGCState gcstate);
  
  public:
    ShenandoahVerifier(ShenandoahHeap* heap, MarkBitMap* verification_bitmap) :
            _heap(heap), _verification_bit_map(verification_bitmap) {};
  
    void verify_before_concmark();
    void verify_after_concmark();
+   void verify_after_concmark_with_promotions();
    void verify_before_evacuation();
-   void verify_during_evacuation();
-   void verify_after_evacuation();
    void verify_before_updaterefs();
    void verify_after_updaterefs();
    void verify_before_fullgc();
    void verify_after_fullgc();
    void verify_after_degenerated();
    void verify_generic(VerifyOption option);
  
    // Roots should only contain to-space oops
    void verify_roots_in_to_space();
- 
    void verify_roots_no_forwarded();
+ 
+   // Check that generation usages are accurate before rebuilding free set
+   void verify_before_rebuilding_free_set();
+ private:
+   template<typename Scanner>
+   void help_verify_region_rem_set(Scanner* scanner, ShenandoahHeapRegion* r, ShenandoahMarkingContext* ctx,
+                                   HeapWord* update_watermark, const char* message);
+ 
+   void verify_rem_set_before_mark();
+   void verify_rem_set_before_update_ref();
+   void verify_rem_set_after_full_gc();
+ 
+   ShenandoahMarkingContext* get_marking_context_for_old();
  };
  
  #endif // SHARE_GC_SHENANDOAH_SHENANDOAHVERIFIER_HPP
< prev index next >