63 static void assert_forwarded(void* interior_loc, oop obj, const char* file, int line);
64 static void assert_not_forwarded(void* interior_loc, oop obj, const char* file, int line);
65 static void assert_marked(void* interior_loc, oop obj, const char* file, int line);
66 static void assert_marked_weak(void* interior_loc, oop obj, const char* file, int line);
67 static void assert_marked_strong(void* interior_loc, oop obj, const char* file, int line);
68
69 // Assert that marking is complete for the generation where this obj resides
70 static void assert_mark_complete(HeapWord* obj, const char* file, int line);
71 static void assert_in_cset(void* interior_loc, oop obj, const char* file, int line);
72 static void assert_not_in_cset(void* interior_loc, oop obj, const char* file, int line);
73 static void assert_not_in_cset_loc(void* interior_loc, const char* file, int line);
74
75 static void assert_locked_or_shenandoah_safepoint(Mutex* lock, const char* file, int line);
76
77 static void assert_heaplocked(const char* file, int line);
78 static void assert_not_heaplocked(const char* file, int line);
79 static void assert_heaplocked_or_safepoint(const char* file, int line);
80 static void assert_control_or_vm_thread_at_safepoint(bool at_safepoint, const char* file, int line);
81 static void assert_generational(const char* file, int line);
82
83 // Given a possibly invalid oop, extract narrowKlass (if UCCP) and Klass*
84 // from it safely.
85 // Note: For -UCCP, returned nk is always 0.
86 static bool extract_klass_safely(oop obj, narrowKlass& nk, const Klass*& k);
87
88 #ifdef ASSERT
89 #define shenandoah_assert_in_heap_bounds(interior_loc, obj) \
90 ShenandoahAsserts::assert_in_heap_bounds(interior_loc, obj, __FILE__, __LINE__)
91 #define shenandoah_assert_in_heap_bounds_or_null(interior_loc, obj) \
92 ShenandoahAsserts::assert_in_heap_bounds_or_null(interior_loc, obj, __FILE__, __LINE__)
93 #define shenandoah_assert_in_correct_region(interior_loc, obj) \
94 ShenandoahAsserts::assert_in_correct_region(interior_loc, obj, __FILE__, __LINE__)
95
96 #define shenandoah_assert_correct_if(interior_loc, obj, condition) \
97 if (condition) ShenandoahAsserts::assert_correct(interior_loc, obj, __FILE__, __LINE__)
98 #define shenandoah_assert_correct_except(interior_loc, obj, exception) \
99 if (!(exception)) ShenandoahAsserts::assert_correct(interior_loc, obj, __FILE__, __LINE__)
100 #define shenandoah_assert_correct(interior_loc, obj) \
101 ShenandoahAsserts::assert_correct(interior_loc, obj, __FILE__, __LINE__)
102
142 if (condition) ShenandoahAsserts::assert_in_cset(interior_loc, obj, __FILE__, __LINE__)
143 #define shenandoah_assert_in_cset_except(interior_loc, obj, exception) \
144 if (!(exception)) ShenandoahAsserts::assert_in_cset(interior_loc, obj, __FILE__, __LINE__)
145 #define shenandoah_assert_in_cset(interior_loc, obj) \
146 ShenandoahAsserts::assert_in_cset(interior_loc, obj, __FILE__, __LINE__)
147
148 #define shenandoah_assert_not_in_cset_if(interior_loc, obj, condition) \
149 if (condition) ShenandoahAsserts::assert_not_in_cset(interior_loc, obj, __FILE__, __LINE__)
150 #define shenandoah_assert_not_in_cset_except(interior_loc, obj, exception) \
151 if (!(exception)) ShenandoahAsserts::assert_not_in_cset(interior_loc, obj, __FILE__, __LINE__)
152 #define shenandoah_assert_not_in_cset(interior_loc, obj) \
153 ShenandoahAsserts::assert_not_in_cset(interior_loc, obj, __FILE__, __LINE__)
154
155 #define shenandoah_assert_not_in_cset_loc_if(interior_loc, condition) \
156 if (condition) ShenandoahAsserts::assert_not_in_cset_loc(interior_loc, __FILE__, __LINE__)
157 #define shenandoah_assert_not_in_cset_loc_except(interior_loc, exception) \
158 if (!(exception)) ShenandoahAsserts::assert_not_in_cset_loc(interior_loc, __FILE__, __LINE__)
159 #define shenandoah_assert_not_in_cset_loc(interior_loc) \
160 ShenandoahAsserts::assert_not_in_cset_loc(interior_loc, __FILE__, __LINE__)
161
162 #define shenandoah_assert_rp_isalive_installed() \
163 ShenandoahAsserts::assert_rp_isalive_installed(__FILE__, __LINE__)
164 #define shenandoah_assert_rp_isalive_not_installed() \
165 ShenandoahAsserts::assert_rp_isalive_not_installed(__FILE__, __LINE__)
166
167 #define shenandoah_assert_safepoint() \
168 assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should be at Shenandoah Safepoints")
169
170 #define shenandoah_assert_locked_or_safepoint(lock) \
171 ShenandoahAsserts::assert_locked_or_shenandoah_safepoint(lock, __FILE__, __LINE__)
172
173 #define shenandoah_assert_heaplocked() \
174 ShenandoahAsserts::assert_heaplocked(__FILE__, __LINE__)
175
176 #define shenandoah_assert_not_heaplocked() \
177 ShenandoahAsserts::assert_not_heaplocked(__FILE__, __LINE__)
178
179 #define shenandoah_assert_heaplocked_or_safepoint() \
180 ShenandoahAsserts::assert_heaplocked_or_safepoint(__FILE__, __LINE__)
181
228 #define shenandoah_assert_not_in_cset_except(interior_loc, obj, exception)
229 #define shenandoah_assert_not_in_cset(interior_loc, obj)
230
231 #define shenandoah_assert_not_in_cset_loc_if(interior_loc, condition)
232 #define shenandoah_assert_not_in_cset_loc_except(interior_loc, exception)
233 #define shenandoah_assert_not_in_cset_loc(interior_loc)
234
235 #define shenandoah_assert_rp_isalive_installed()
236 #define shenandoah_assert_rp_isalive_not_installed()
237
238 #define shenandoah_assert_safepoint()
239 #define shenandoah_assert_locked_or_safepoint(lock)
240
241 #define shenandoah_assert_heaplocked()
242 #define shenandoah_assert_not_heaplocked()
243 #define shenandoah_assert_heaplocked_or_safepoint()
244 #define shenandoah_assert_control_or_vm_thread()
245 #define shenandoah_assert_control_or_vm_thread_at_safepoint()
246 #define shenandoah_assert_generational()
247
248 #endif
249
250 #define shenandoah_not_implemented \
251 { fatal("Deliberately not implemented."); }
252 #define shenandoah_not_implemented_return(v) \
253 { fatal("Deliberately not implemented."); return v; }
254
255 };
256
257 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHASSERTS_HPP
|
63 static void assert_forwarded(void* interior_loc, oop obj, const char* file, int line);
64 static void assert_not_forwarded(void* interior_loc, oop obj, const char* file, int line);
65 static void assert_marked(void* interior_loc, oop obj, const char* file, int line);
66 static void assert_marked_weak(void* interior_loc, oop obj, const char* file, int line);
67 static void assert_marked_strong(void* interior_loc, oop obj, const char* file, int line);
68
69 // Assert that marking is complete for the generation where this obj resides
70 static void assert_mark_complete(HeapWord* obj, const char* file, int line);
71 static void assert_in_cset(void* interior_loc, oop obj, const char* file, int line);
72 static void assert_not_in_cset(void* interior_loc, oop obj, const char* file, int line);
73 static void assert_not_in_cset_loc(void* interior_loc, const char* file, int line);
74
75 static void assert_locked_or_shenandoah_safepoint(Mutex* lock, const char* file, int line);
76
77 static void assert_heaplocked(const char* file, int line);
78 static void assert_not_heaplocked(const char* file, int line);
79 static void assert_heaplocked_or_safepoint(const char* file, int line);
80 static void assert_control_or_vm_thread_at_safepoint(bool at_safepoint, const char* file, int line);
81 static void assert_generational(const char* file, int line);
82
83 static void assert_in_young(void* interior_loc, oop obj, const char* file, int line);
84
85 // Given a possibly invalid oop, extract narrowKlass (if UCCP) and Klass*
86 // from it safely.
87 // Note: For -UCCP, returned nk is always 0.
88 static bool extract_klass_safely(oop obj, narrowKlass& nk, const Klass*& k);
89
90 #ifdef ASSERT
91 #define shenandoah_assert_in_heap_bounds(interior_loc, obj) \
92 ShenandoahAsserts::assert_in_heap_bounds(interior_loc, obj, __FILE__, __LINE__)
93 #define shenandoah_assert_in_heap_bounds_or_null(interior_loc, obj) \
94 ShenandoahAsserts::assert_in_heap_bounds_or_null(interior_loc, obj, __FILE__, __LINE__)
95 #define shenandoah_assert_in_correct_region(interior_loc, obj) \
96 ShenandoahAsserts::assert_in_correct_region(interior_loc, obj, __FILE__, __LINE__)
97
98 #define shenandoah_assert_correct_if(interior_loc, obj, condition) \
99 if (condition) ShenandoahAsserts::assert_correct(interior_loc, obj, __FILE__, __LINE__)
100 #define shenandoah_assert_correct_except(interior_loc, obj, exception) \
101 if (!(exception)) ShenandoahAsserts::assert_correct(interior_loc, obj, __FILE__, __LINE__)
102 #define shenandoah_assert_correct(interior_loc, obj) \
103 ShenandoahAsserts::assert_correct(interior_loc, obj, __FILE__, __LINE__)
104
144 if (condition) ShenandoahAsserts::assert_in_cset(interior_loc, obj, __FILE__, __LINE__)
145 #define shenandoah_assert_in_cset_except(interior_loc, obj, exception) \
146 if (!(exception)) ShenandoahAsserts::assert_in_cset(interior_loc, obj, __FILE__, __LINE__)
147 #define shenandoah_assert_in_cset(interior_loc, obj) \
148 ShenandoahAsserts::assert_in_cset(interior_loc, obj, __FILE__, __LINE__)
149
150 #define shenandoah_assert_not_in_cset_if(interior_loc, obj, condition) \
151 if (condition) ShenandoahAsserts::assert_not_in_cset(interior_loc, obj, __FILE__, __LINE__)
152 #define shenandoah_assert_not_in_cset_except(interior_loc, obj, exception) \
153 if (!(exception)) ShenandoahAsserts::assert_not_in_cset(interior_loc, obj, __FILE__, __LINE__)
154 #define shenandoah_assert_not_in_cset(interior_loc, obj) \
155 ShenandoahAsserts::assert_not_in_cset(interior_loc, obj, __FILE__, __LINE__)
156
157 #define shenandoah_assert_not_in_cset_loc_if(interior_loc, condition) \
158 if (condition) ShenandoahAsserts::assert_not_in_cset_loc(interior_loc, __FILE__, __LINE__)
159 #define shenandoah_assert_not_in_cset_loc_except(interior_loc, exception) \
160 if (!(exception)) ShenandoahAsserts::assert_not_in_cset_loc(interior_loc, __FILE__, __LINE__)
161 #define shenandoah_assert_not_in_cset_loc(interior_loc) \
162 ShenandoahAsserts::assert_not_in_cset_loc(interior_loc, __FILE__, __LINE__)
163
164 #define shenandoah_assert_in_young_if(interior_loc, obj, condition) \
165 if (condition) ShenandoahAsserts::assert_in_young(interior_loc, obj, __FILE__, __LINE__)
166 #define shenandoah_assert_in_young_except(interior_loc, obj, exception) \
167 if (!(exception)) ShenandoahAsserts::assert_in_young(interior_loc, obj, __FILE__, __LINE__)
168 #define shenandoah_assert_in_young(interior_loc, obj) \
169 ShenandoahAsserts::assert_in_young(interior_loc, obj, __FILE__, __LINE__)
170
171 #define shenandoah_assert_rp_isalive_installed() \
172 ShenandoahAsserts::assert_rp_isalive_installed(__FILE__, __LINE__)
173 #define shenandoah_assert_rp_isalive_not_installed() \
174 ShenandoahAsserts::assert_rp_isalive_not_installed(__FILE__, __LINE__)
175
176 #define shenandoah_assert_safepoint() \
177 assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should be at Shenandoah Safepoints")
178
179 #define shenandoah_assert_locked_or_safepoint(lock) \
180 ShenandoahAsserts::assert_locked_or_shenandoah_safepoint(lock, __FILE__, __LINE__)
181
182 #define shenandoah_assert_heaplocked() \
183 ShenandoahAsserts::assert_heaplocked(__FILE__, __LINE__)
184
185 #define shenandoah_assert_not_heaplocked() \
186 ShenandoahAsserts::assert_not_heaplocked(__FILE__, __LINE__)
187
188 #define shenandoah_assert_heaplocked_or_safepoint() \
189 ShenandoahAsserts::assert_heaplocked_or_safepoint(__FILE__, __LINE__)
190
237 #define shenandoah_assert_not_in_cset_except(interior_loc, obj, exception)
238 #define shenandoah_assert_not_in_cset(interior_loc, obj)
239
240 #define shenandoah_assert_not_in_cset_loc_if(interior_loc, condition)
241 #define shenandoah_assert_not_in_cset_loc_except(interior_loc, exception)
242 #define shenandoah_assert_not_in_cset_loc(interior_loc)
243
244 #define shenandoah_assert_rp_isalive_installed()
245 #define shenandoah_assert_rp_isalive_not_installed()
246
247 #define shenandoah_assert_safepoint()
248 #define shenandoah_assert_locked_or_safepoint(lock)
249
250 #define shenandoah_assert_heaplocked()
251 #define shenandoah_assert_not_heaplocked()
252 #define shenandoah_assert_heaplocked_or_safepoint()
253 #define shenandoah_assert_control_or_vm_thread()
254 #define shenandoah_assert_control_or_vm_thread_at_safepoint()
255 #define shenandoah_assert_generational()
256
257 #define shenandoah_assert_in_young_if(interior_loc, obj, condition)
258 #define shenandoah_assert_in_young_except(interior_loc, obj, exception)
259 #define shenandoah_assert_in_young(interior_loc, obj)
260
261 #endif
262
263 #define shenandoah_not_implemented \
264 { fatal("Deliberately not implemented."); }
265 #define shenandoah_not_implemented_return(v) \
266 { fatal("Deliberately not implemented."); return v; }
267
268 };
269
270 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHASSERTS_HPP
|