RFR: 8343658: Parallel: Implement block_start for Young generation
Thomas Stuefe
stuefe at openjdk.org
Thu Nov 7 10:50:48 UTC 2024
On Wed, 6 Nov 2024 18:08:43 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> src/hotspot/share/gc/parallel/mutableSpace.cpp line 239:
>>
>>> 237:
>>> 238: HeapWord* cur_addr = bottom();
>>> 239: while (cur_addr <= addr) {
>>
>> As already described in https://github.com/openjdk/jdk/pull/21870#issuecomment-2454964142, this will not work in the general case, if the heap is not walkable. In a debug build you'll run into the assertion once you arrive in the unallcoated TLAB area (which you don't want during error reporting).
>> Even worse, in the product build you can crash or run this loop infinitely, depending on what data `obj->size()` will find in the unallocated TLAB space.
>
>> this will not work in the general case, if the heap is not walkable.
>
> True, but this is the best-effort approach used in other GCs, as far as I can tell. Is there a real use case that warrants a more sophisticated variant?
What would be nice would be something like `oopDesc::safe_klass_or_null()` or similar, feeding into a corresponding `oopDesc::size_given_klass_safe_or_0()`. The former would check the klass word for validity before dereferencing - `CompressedKlassPointers::is_encodable(p)` and then the load of layouthelper etc should happen with SafeFetch. Alternatively (and a bit more unsafe), check the readability of Klass* with SafeFetch beforehand, then call normal size_given_klass.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21919#discussion_r1832464222
More information about the hotspot-gc-dev
mailing list