OpenJDK / jdk / jdk
changeset 58318:7e741a3fc650
8230853: Shenandoah: replace leftover assert(is_in(...)) with rich asserts
Reviewed-by: shade
Contributed-by: Aditya Mandaleeka <adityam@microsoft.com>
author | shade |
---|---|
date | Mon, 09 Mar 2020 22:41:11 +0100 |
parents | ffa717c6ffee |
children | b639fff3fc5a |
files | src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.inline.hpp |
diffstat | 4 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp Mon Mar 09 22:41:04 2020 +0100 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp Mon Mar 09 22:41:11 2020 +0100 @@ -80,8 +80,8 @@ inline bool is_in(ShenandoahHeapRegion* r) const; inline bool is_in(size_t region_number) const; - inline bool is_in(HeapWord* loc) const; inline bool is_in(oop obj) const; + inline bool is_in_loc(void* loc) const; void print_on(outputStream* out) const;
--- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp Mon Mar 09 22:41:04 2020 +0100 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp Mon Mar 09 22:41:11 2020 +0100 @@ -40,10 +40,11 @@ } bool ShenandoahCollectionSet::is_in(oop p) const { - return is_in(cast_from_oop<HeapWord*>(p)); + shenandoah_assert_in_heap(NULL, p); + return is_in_loc(cast_from_oop<void*>(p)); } -bool ShenandoahCollectionSet::is_in(HeapWord* p) const { +bool ShenandoahCollectionSet::is_in_loc(void* p) const { assert(_heap->is_in(p), "Must be in the heap"); uintx index = ((uintx) p) >> _region_size_bytes_shift; // no need to subtract the bottom of the heap from p,
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Mon Mar 09 22:41:04 2020 +0100 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Mon Mar 09 22:41:11 2020 +0100 @@ -327,14 +327,12 @@ inline bool ShenandoahHeap::in_collection_set(oop p) const { 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 { assert(collection_set() != NULL, "Sanity"); - assert(is_in(p), "should be in heap"); - return collection_set()->is_in((HeapWord*)p); + return collection_set()->is_in_loc(p); } inline bool ShenandoahHeap::is_stable() const {
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.inline.hpp Mon Mar 09 22:41:04 2020 +0100 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.inline.hpp Mon Mar 09 22:41:11 2020 +0100 @@ -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