RFR: 8369828: Generalize share/utilities/bytes.hpp [v2]

Justin King jcking at openjdk.org
Wed Oct 15 13:58:51 UTC 2025


On Tue, 14 Oct 2025 17:38:32 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Justin King has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Qualify identifiers
>>   
>>   Signed-off-by: Justin King <jcking at google.com>
>
> src/hotspot/share/utilities/unalignedAccess.hpp line 143:
> 
>> 141:   }
>> 142: };
>> 143: #endif
> 
> Please add a comment about what condition is being closed.

Done.

> src/hotspot/share/utilities/unalignedAccess.hpp line 146:
> 
>> 144: 
>> 145: template<size_t byte_size>
>> 146: struct UnalignedAccess::StoreImpl {
> 
> These general implementations never get used in the ASAN-specialized case.  Maybe the `#endif`
> a few lines back should be an `#else` instead, and just suppress these general implementations
> in that case.

Fair point. Moved them to an `#else`.

> src/hotspot/share/utilities/unalignedAccess.hpp line 155:
> 
>> 153:     // the actual call to memcpy. On platforms which allow unaligned access,
>> 154:     // the compiler will emit a normal store instruction.
>> 155:     memcpy(ptr, &value, sizeof(T));
> 
> In slowdebug builds this will be pretty terrible, but presumably there aren't enough uses of these
> functions for that to matter.

Per godbolt it does not look like any of the compilers, even in `-O0`, ever emit an actual call to `memcpy`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27801#discussion_r2432660235
PR Review Comment: https://git.openjdk.org/jdk/pull/27801#discussion_r2432660965
PR Review Comment: https://git.openjdk.org/jdk/pull/27801#discussion_r2432650160


More information about the hotspot-dev mailing list