RFR: 8352075: Perf regression accessing fields [v23]
Coleen Phillimore
coleenp at openjdk.org
Mon Jun 9 12:19:04 UTC 2025
On Mon, 9 Jun 2025 06:52:41 GMT, Radim Vansa <rvansa at openjdk.org> wrote:
>> src/hotspot/share/utilities/packedTable.cpp line 49:
>>
>>> 47: assert((key & ~_key_mask) == 0, "key out of bounds");
>>> 48: assert((value & ~_value_mask) == 0, "value out of bounds: %x vs. %x (%x)", value, _value_mask, ~_value_mask);
>>> 49: *reinterpret_cast<uint64_t*>(data + offset) = static_cast<uint64_t>(key) | (static_cast<uint64_t>(value) << _value_shift);
>>
>> How does this line not get a signal for unaligned write?
>
> From what I could find, strict alignment checking must be explicitly enabled an aarch64. x86_64 does not require alignment either. In both cases, there might be a performance penalty.
Once I turned on hard signals for these unaligned accesses to find some performance problems (and I think I was debugging something on sparc). The OS handles these signals silently but it does/can cause performance loss. There must be a way to write this without all this C style casting with C++ syntax or a special memcpy. It would still be performant for field access even if the array was copied as a byte stream. There must be a more readable way to do this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24847#discussion_r2135613762
More information about the serviceability-dev
mailing list