32 class G1CollectedHeap; |
32 class G1CollectedHeap; |
33 |
33 |
34 class G1HeapVerifier : public CHeapObj<mtGC> { |
34 class G1HeapVerifier : public CHeapObj<mtGC> { |
35 private: |
35 private: |
36 G1CollectedHeap* _g1h; |
36 G1CollectedHeap* _g1h; |
|
37 int _enabled_verification_types; |
37 |
38 |
38 // verify_region_sets() performs verification over the region |
39 // verify_region_sets() performs verification over the region |
39 // lists. It will be compiled in the product code to be used when |
40 // lists. It will be compiled in the product code to be used when |
40 // necessary (i.e., during heap verification). |
41 // necessary (i.e., during heap verification). |
41 void verify_region_sets(); |
42 void verify_region_sets(); |
42 |
43 |
43 public: |
44 public: |
|
45 enum G1VerifyType { |
|
46 G1VerifyYoungOnly = 1, // -XX:VerifyGCType=young-only |
|
47 G1VerifyInitialMark = 2, // -XX:VerifyGCType=initial-mark |
|
48 G1VerifyMixed = 4, // -XX:VerifyGCType=mixed |
|
49 G1VerifyRemark = 8, // -XX:VerifyGCType=remark |
|
50 G1VerifyCleanup = 16, // -XX:VerifyGCType=cleanup |
|
51 G1VerifyFull = 32, // -XX:VerifyGCType=full |
|
52 G1VerifyAll = -1 |
|
53 }; |
44 |
54 |
45 G1HeapVerifier(G1CollectedHeap* heap) : _g1h(heap) { } |
55 G1HeapVerifier(G1CollectedHeap* heap) : _g1h(heap), _enabled_verification_types(G1VerifyAll) { } |
|
56 |
|
57 void parse_verification_type(const char* type); |
|
58 void enable_verification_type(G1VerifyType type); |
|
59 bool should_verify(G1VerifyType type); |
46 |
60 |
47 // Perform verification. |
61 // Perform verification. |
48 |
62 |
49 // vo == UsePrevMarking -> use "prev" marking information, |
63 // vo == UsePrevMarking -> use "prev" marking information, |
50 // vo == UseNextMarking -> use "next" marking information |
64 // vo == UseNextMarking -> use "next" marking information |
71 #else // HEAP_REGION_SET_FORCE_VERIFY |
85 #else // HEAP_REGION_SET_FORCE_VERIFY |
72 void verify_region_sets_optional() { } |
86 void verify_region_sets_optional() { } |
73 #endif // HEAP_REGION_SET_FORCE_VERIFY |
87 #endif // HEAP_REGION_SET_FORCE_VERIFY |
74 |
88 |
75 void prepare_for_verify(); |
89 void prepare_for_verify(); |
76 double verify(bool guard, const char* msg); |
90 double verify(G1VerifyType type, VerifyOption vo, const char* msg); |
77 void verify_before_gc(); |
91 void verify_before_gc(G1VerifyType type); |
78 void verify_after_gc(); |
92 void verify_after_gc(G1VerifyType type); |
79 |
93 |
80 #ifndef PRODUCT |
94 #ifndef PRODUCT |
81 // Make sure that the given bitmap has no marked objects in the |
95 // Make sure that the given bitmap has no marked objects in the |
82 // range [from,limit). If it does, print an error message and return |
96 // range [from,limit). If it does, print an error message and return |
83 // false. Otherwise, just return true. bitmap_name should be "prev" |
97 // false. Otherwise, just return true. bitmap_name should be "prev" |