Skip to content
Permalink
Browse files
8230853: Shenandoah: replace leftover assert(is_in(...)) with rich as…
…serts

Reviewed-by: shade
  • Loading branch information
adityamandaleeka authored and shipilev committed Mar 9, 2020
1 parent 9722dfc commit d112950b5b0562efcadd856d6e01606f9c48977e
@@ -80,8 +80,8 @@ class ShenandoahCollectionSet : public CHeapObj<mtGC> {

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;

@@ -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,
@@ -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 {
@@ -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

0 comments on commit d112950

Please sign in to comment.