Missaligned memory accesses from JDK

Vladimir Kempik vladimir.kempik at gmail.com
Mon Mar 20 09:42:02 UTC 2023

>  For each emit_intX functions modified, I see there is a correspondent version which handles unaligned access. For example, 'void emit_int16(uint8_t x1, uint8_t x2)' for 'void emit_int16(uint16_t x)' 
>  So if we encounter an unaligned access issue when using 'emit_int16(uint16_t x)', shouldn't we change the callsite to use 'emit_int16(uint8_t x1, uint8_t x2)' instead? 

not exactly
'void emit_int16(uint8_t x1, uint8_t x2)
will always use slow version ( store byte)

void emit_int16(uint16_t x)
will use slow version only on unaligned stores. if store is aligned, it will use "store half", which should be faster.

So we can’t always use emit_int16(uint8_t x1, uint8_t x2) at callsite.

and we can’t decide which one to use at callsite as callsite should be unaware of end() value inside CodeSection class

Regards, Vladimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/riscv-port-dev/attachments/20230320/7652339e/attachment.htm>

More information about the riscv-port-dev mailing list