RFR: 8343658: Parallel: Implement block_start for Young generation
Volker Simonis
simonis at openjdk.org
Thu Nov 7 12:48:43 UTC 2024
On Thu, 7 Nov 2024 12:38:03 GMT, Volker Simonis <simonis at openjdk.org> wrote:
>> 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.
>
>> > 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?
>
> The **only** use case for this code during hs_err reporting for heap-addresses not pointing at the beginning of an oop. I think we should be conservative here, because a secondary crash will cut the information available in the hs_err file and will therefor do more harm then being helpful.
> 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.
We already have [LocationPrinter::is_valid_obj()](https://github.com/openjdk/jdk/blob/ac82a8f89c7066fb1d379b12bcfd68053cb39ba4/src/hotspot/share/gc/shared/locationPrinter.cpp#L33) which uses [Klass::is_valid()](https://github.com/openjdk/jdk/blob/ac82a8f89c7066fb1d379b12bcfd68053cb39ba4/src/hotspot/share/oops/klass.cpp#L1038) to check the validity of an oop. I don't think we need `SafeFetch` here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21919#discussion_r1832623326
More information about the hotspot-gc-dev
mailing list