RFR: 8301222: Generalize check_release_entry in OopStorage
Thomas Schatzl
tschatzl at openjdk.org
Fri Mar 3 09:35:11 UTC 2023
On Fri, 27 Jan 2023 10:19:39 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:
> When an oop handle is released to OopStorage, we want to check that its contents has been cleared appropriately, honouring the general contract with OopStorage. This is currently done with a raw access checking for null. However, the raw contents in memory might not be 0, just because the logical value is null. In particular, generational ZGC will have some low order colour bits set. This CR aims to address that.
src/hotspot/share/gc/shared/oopStorage.cpp line 770:
> 768: assert(entry != NULL, "Releasing NULL");
> 769: assert(!Universe::heap()->is_in(*reinterpret_cast<void* const*>(entry)),
> 770: "Releasing uncleared entry: " PTR_FORMAT, p2i(entry));
Why are the extra bits only in this particular case an issue? We compare to null in quite a few places, and there we probably just added code to strip these extra bits (or is already by previous code).
That would be more expensive to do in the assert I guess, but much more clear to me what we are comparing to.
-------------
PR: https://git.openjdk.org/jdk/pull/12252
More information about the hotspot-gc-dev
mailing list