RFR: 8305056: Avoid unaligned access in emit_intX methods if not enabled [v3]

Vladimir Kempik vkempik at openjdk.org
Thu Mar 30 16:52:13 UTC 2023


On Thu, 30 Mar 2023 15:16:14 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> Sorry if I'm slow, but I do not understand this patch, and the JBS issue text does not help much. Why would the existing test for alignment not be sufficient to prevent unaligned access?

Hello

Currently emit_intXX perform unaligned access without any check for existing flags regarding the status of unaligned access.
This especially bad(performance wise) on platforms where misalignment access is emulated (e.g. some risc-v boards).

The idea of the patch is to use put_native_uX instead of direct pointer deref.

But then I need to adjust some existing put_native_uX code to respect UseUnalignedAccess flags.


As for speed of new put_native after adding flag check - that flag is kind of constant during the lifetime of jvm and should be easy for any branch predictor, resulting in a pretty low overhead.

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

PR Comment: https://git.openjdk.org/jdk/pull/13227#issuecomment-1490619497


More information about the hotspot-compiler-dev mailing list