On Tue, 14 Mar 2023 22:52:44 GMT, Martin Doerr <mdo...@openjdk.org> wrote:

> Btw. the new cases in which we use int and short accesses when byteWidth is 
> not a power of 2 are never unaligned AFAICS. I guess _UNALIGNED is 
> unnecessary in the JAVA_INT_UNALIGNED and JAVA_SHORT_UNALIGNED. They are 
> always aligned wrt. to their size.

They are not necessarily aligned, for instance of the struct we are given is 
not aligned itself (at least in the reading case). Though we currently reject 
that case in AbstractLinker, it is something we might want to allow, and we 
have been looking at that as of late, for instance to pass packed structs to 
native code.

FWIW, using the unaligned variant effectively just turns off the alignment 
checks we do. So we have less safety, in theory. There should be no performance 
difference though just from using the _UNALIGNED layout.

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

PR: https://git.openjdk.org/jdk/pull/12708

Reply via email to