RFR: 8310268: RISC-V: misaligned memory access in String.Compare intrinsic

Vladimir Kempik vkempik at openjdk.org
Mon Jun 26 05:09:05 UTC 2023


On Mon, 26 Jun 2023 03:49:01 GMT, Fei Yang <fyang at openjdk.org> wrote:

> Hi, I am looking at this but it really takes quite some time for me understand this. I have to say that the added logic for handling unaligned accesses makes the already complex assembly code even harder to read. And I am also worried about code maintainability as previously mentioned by @theRealAph about increasing checkings for AvoidUnalignedAccesses.
> 
> After a cursory look at this change, it seems that we could make use of the newly-added `load_X_misaligned` assemblers for the possibly unaligned memory accesses instead of adding the extra logic under AvoidUnalignedAccesses. This might not offer us the optimal performance but it does reduce code complexity.


This is really complex change, and it's last for string intrinsics we have.

I have used load_X_misaligned where it made sense ( in compare_long UU/LL)
in compare_long UL/LU the main comparision loop was doing misaligned loads ( 4 bytes aligned but not 8 bytes aligned) for latin string. hence it required complicated fix ( thanks Feilong Jiang).

The compare_short ( in c2_macroAssember) was doing too much conditional branches in one place,it was possible to slightly reduce it.
Thanks for looking at it.

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

PR Comment: https://git.openjdk.org/jdk/pull/14534#issuecomment-1606656440


More information about the hotspot-dev mailing list