8230853: Shenandoah: replace leftover assert(is_in(...)) with rich asserts

Reviewed-by: shade
This commit is contained in:
Aditya Mandaleeka 2020-03-09 22:41:11 +01:00 committed by Aleksey Shipilev
parent 9722dfc9bc
commit d112950b5b
4 changed files with 7 additions and 7 deletions

View File

@ -80,8 +80,8 @@ public:
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;

View File

@ -40,10 +40,11 @@ bool ShenandoahCollectionSet::is_in(ShenandoahHeapRegion* r) const {
}
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,

View File

@ -327,14 +327,12 @@ inline bool ShenandoahHeap::requires_marking(const void* entry) const {
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 {

View File

@ -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(ShenandoahHeapRegion* r) const {
}
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