RFR: 8334738: os::print_hex_dump should optionally print ASCII [v2]
David Holmes
dholmes at openjdk.org
Wed Jul 3 03:11:21 UTC 2024
On Thu, 27 Jun 2024 07:27:48 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/runtime/os.cpp line 949:
>>
>>> 947: uintptr_t i = (uintptr_t)SafeFetchN((intptr_t*)p, errval);
>>> 948: if (i == errval) {
>>> 949: i = (uintptr_t)SafeFetchN((intptr_t*)p, ~errval);
>>
>> Pre-existing but if the initial fetch fails why do we think the second one can succeed ???
>
> There is a one-in-2^(32|64) chance the errval numerical value happend to be in memory. By reading twice, with different errval, we diminish the chance of mistaking a successful read for an error.
Ouch! So all the other places we only use SafetchN once are potentially broken? Or is this is special case where any value in memory could theoretically be valid?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19835#discussion_r1663414798
More information about the hotspot-dev
mailing list