RFR: 8230853: Replace leftover is_in asserts with rich asserts
Aditya Mandaleeka
adityam at microsoft.com
Sun Mar 8 19:49:18 UTC 2020
Hi all,
This is a simple patch for JDK-8230853, updating some is_in heap asserts to use rich asserts instead.
It is mostly the same as what Aleksey already had done (thanks Aleksey!), except that there is one
more place in shenandoahHeap.inline.hpp where the old style assert was being used which I've fixed.
I did a quick regex search to look for other instances of this heap->is_in check in Shenandoah code
and didn't find any more. I also double-checked that the HeapWord*->oop conversion is doing the
right thing, thanks to some recent changes in this area.
Bug: https://bugs.openjdk.java.net/browse/JDK-8230853
Patch: As I don't yet have access to cr.openjdk.java.net, I am pasting the patch below.
Thanks,
Aditya Mandaleeka
===
diff -r e44b68e5bdaf src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp Sun Mar 08 15:15:38 2020 +0900
+++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp Sun Mar 08 12:30:59 2020 -0700
@@ -25,6 +25,7 @@
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_INLINE_HPP
#define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_INLINE_HPP
+#include "gc/shenandoah/shenandoahAsserts.hpp"
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
#include "gc/shenandoah/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
@@ -44,7 +45,7 @@
}
bool ShenandoahCollectionSet::is_in(HeapWord* p) const {
- assert(_heap->is_in(p), "Must be in the heap");
+ shenandoah_assert_in_heap(NULL, p);
uintx index = ((uintx) p) >> _region_size_bytes_shift;
// no need to subtract the bottom of the heap from p,
// _biased_cset_map is biased
diff -r e44b68e5bdaf src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Sun Mar 08 15:15:38 2020 +0900
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Sun Mar 08 12:30:59 2020 -0700
@@ -326,14 +326,14 @@
}
inline bool ShenandoahHeap::in_collection_set(oop p) const {
+ shenandoah_assert_in_heap(NULL, p);
assert(collection_set() != NULL, "Sanity");
- assert(is_in(p), "should be in heap");
return collection_set()->is_in(p);
}
inline bool ShenandoahHeap::in_collection_set_loc(void* p) const {
+ shenandoah_assert_in_heap(NULL, p);
assert(collection_set() != NULL, "Sanity");
- assert(is_in(p), "should be in heap");
return collection_set()->is_in((HeapWord*)p);
}
diff -r e44b68e5bdaf src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.inline.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.inline.hpp Sun Mar 08 15:15:38 2020 +0900
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.inline.hpp Sun Mar 08 12:30:59 2020 -0700
@@ -25,6 +25,7 @@
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGIONSET_INLINE_HPP
#define SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGIONSET_INLINE_HPP
+#include "gc/shenandoah/shenandoahAsserts.hpp"
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
#include "gc/shenandoah/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
@@ -40,7 +41,7 @@
}
bool ShenandoahHeapRegionSet::is_in(oop p) const {
- assert(_heap->is_in(p), "Must be in the heap");
+ shenandoah_assert_in_heap(NULL, p);
uintx index = (cast_from_oop<uintx>(p)) >> _region_size_bytes_shift;
// no need to subtract the bottom of the heap from p,
// _biased_set_map is biased
More information about the shenandoah-dev
mailing list