RFR: 8305056: Avoid unaligned access in emit_intX methods if not enabled [v4]
Andrew Haley
aph at openjdk.org
Tue Apr 18 09:46:47 UTC 2023
On Mon, 17 Apr 2023 14:19:36 GMT, Vladimir Kempik <vkempik at openjdk.org> wrote:
>> Please review this change which attempts to eliminate unaligned memory stores generated by emit_int16/32/64 methods on some platforms.
>>
>> Primary aim is risc-v platform. But I had to change some code in ppc/arm32/x86 to prevent possible perf degradation.
>
> Vladimir Kempik has updated the pull request incrementally with one additional commit since the last revision:
>
> Rework the fix to use memcpy in codeBuffer.hpp
src/hotspot/share/asm/codeBuffer.hpp line 262:
> 260: void emit_float( jfloat x) { put_native(end(), jint_cast(x)); set_end(end() + sizeof(jfloat)); }
> 261: void emit_double(jdouble x) { put_native(end(), julong_cast(x)); set_end(end() + sizeof(jdouble)); }
> 262: void emit_address(address x) { put_native(end(), p2i(x)); set_end(end() + sizeof(address)); }
Suggestion:
template <typename T>
void emit_native(T x) { put_native(end(), x); set_end(end() + sizeof x); }
void emit_float( jfloat x) { emit_native(x); }
void emit_double(jdouble x) { emit_native(x); }
void emit_address(address x) { emit_native(x); }
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13227#discussion_r1169768579
More information about the hotspot-compiler-dev
mailing list