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

Thomas Stuefe stuefe at openjdk.org
Fri Mar 31 13:10:18 UTC 2023


On Thu, 30 Mar 2023 16:49:31 GMT, Vladimir Kempik <vkempik 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.

@VladimirKempik Thank you for the clarification!

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

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


More information about the hotspot-compiler-dev mailing list