RFR: 8291550: RISC-V: jdk uses misaligned memory access when AvoidUnalignedAccess enabled [v9]

Vladimir Kempik vkempik at openjdk.org
Thu May 11 13:27:50 UTC 2023


On Thu, 11 May 2023 08:03:51 GMT, Vladimir Kempik <vkempik at openjdk.org> wrote:

>> Thanks for trying this out. Another issue here is that 8-byte memory accesses at address a1/a2 would exceed the range for strings whose size is smaller than wordSize. I am not quite sure whether that is safe to do. Could we just incorporate changes which only resolves the unaligned access problem here?
>
> On an fpga I can see these numbers with perfnorm profiler:
> 
> Just this PR:
> 
> Secondary result "org.openjdk.bench.java.lang.StringEquals.equal:IPC":
>   1.245 ±(99.9%) 0.037 insns/clk [Average]
>   (min, avg, max) = (1.234, 1.245, 1.258), stdev = 0.010
>   CI (99.9%): [1.209, 1.282] (assumes normal distribution)
> 
> This PR + moving xor:
> 
> Secondary result "org.openjdk.bench.java.lang.StringEquals.equal:IPC":
>   1.239 ±(99.9%) 0.050 insns/clk [Average]
>   (min, avg, max) = (1.224, 1.239, 1.253), stdev = 0.013
>   CI (99.9%): [1.190, 1.289] (assumes normal distribution)

You are right, if the object is located at the end of an allocated memory region ( and nothing past it) then this might produce sigsegv.

I'll ty to modify old version of string_equals to use TAIL logic for the tail of long strings, lwu+lhu+lbu is slower than ld but still faster than falling to misaligned access emulator.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13645#discussion_r1191181578


More information about the hotspot-dev mailing list