RFR: 8331626: unsafe.cpp:162:38: runtime error in index_oop_from_field_offset_long - applying non-zero offset 4563897424 to null pointer [v2]

Martin Doerr mdoerr at openjdk.org
Mon May 6 09:42:20 UTC 2024


On Mon, 6 May 2024 08:32:58 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Change coding style.
>
> src/hotspot/share/prims/unsafe.cpp line 158:
> 
>> 156:   assert_field_offset_sane(p, field_offset);
>> 157:   uintptr_t base_address = cast_from_oop<uintptr_t>(p),
>> 158:             byte_offset  = (uintptr_t)field_offset_to_byte_offset(field_offset);
> 
> We tend to not use this style for setting up variables in HotSpot code: I propose that you update the code to:
> Suggestion:
> 
>   uintptr_t base_address = cast_from_oop<uintptr_t>(p);
>   uintptr_t byte_offset  = (uintptr_t)field_offset_to_byte_offset(field_offset);

I couldn't find that in the hotspot style guide. Is that documented anywhere? We sometimes use it. Nevertheless, I've changed it.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19087#discussion_r1590768283


More information about the hotspot-dev mailing list