8301222: Generalize check_release_entry in OopStorage

Reviewed-by: tschatzl, kbarrett
This commit is contained in:
Erik Österlund 2023-03-06 11:14:32 +00:00
parent ec4e8aa4f7
commit bdffe460cd
3 changed files with 11 additions and 1 deletions

@ -152,6 +152,10 @@ MetaspaceSummary CollectedHeap::create_metaspace_summary() {
ms_chunk_free_list_summary, class_chunk_free_list_summary);
}
bool CollectedHeap::contains_null(const oop* p) const {
return *p == nullptr;
}
void CollectedHeap::print_heap_before_gc() {
LogTarget(Debug, gc, heap) lt;
if (lt.is_enabled()) {

@ -446,6 +446,12 @@ class CollectedHeap : public CHeapObj<mtGC> {
MetaspaceSummary create_metaspace_summary();
// GCs are free to represent the bit representation for null differently in memory,
// which is typically not observable when using the Access API. However, if for
// some reason a context doesn't allow using the Access API, then this function
// explicitly checks if the given memory location contains a null value.
virtual bool contains_null(const oop* p) const;
// Print heap information on the given outputStream.
virtual void print_on(outputStream* st) const = 0;
// The default behavior is to call print_on() on tty.

@ -766,7 +766,7 @@ bool OopStorage::reduce_deferred_updates() {
static inline void check_release_entry(const oop* entry) {
assert(entry != nullptr, "Releasing null");
assert(*entry == nullptr, "Releasing uncleared entry: " PTR_FORMAT, p2i(entry));
assert(Universe::heap()->contains_null(entry), "Releasing uncleared entry: " PTR_FORMAT, p2i(entry));
}
void OopStorage::release(const oop* ptr) {