RFR: 8291550: RISC-V: jdk uses misaligned memory access when AvoidUnalignedAccess enabled [v9]
Vladimir Kempik
vkempik at openjdk.org
Thu May 11 15:55:49 UTC 2023
On Thu, 11 May 2023 13:25:12 GMT, Vladimir Kempik <vkempik at openjdk.org> wrote:
>> 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.
new version results in jmh:
Benchmark Mode Cnt Score Error Units
StringEquals.almostEqual avgt 25 29.459 ± 0.173 ns/op
StringEquals.almostEqualUTF16 avgt 25 29.833 ± 0.596 ns/op
StringEquals.different avgt 25 19.896 ± 1.024 ns/op
StringEquals.differentCoders avgt 25 14.986 ± 1.748 ns/op
StringEquals.equal avgt 25 31.174 ± 0.226 ns/op
StringEquals.equalsUTF16 avgt 25 32.718 ± 0.982 ns/op
should not read past an object boundaries anymore
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13645#discussion_r1191381460
More information about the hotspot-dev
mailing list