On Mon, 9 Jun 2025 12:16:38 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
>> From what I could find, strict alignment checking must be explicitly enabled >> an aarch64. x86_64 does not require alignment either. In both cases, there >> might be a performance penalty. > > Once I turned on hard signals for these unaligned accesses to find some > performance problems (and I think I was debugging something on sparc). The > OS handles these signals silently but it does/can cause performance loss. > There must be a way to write this without all this C style casting with C++ > syntax or a special memcpy. It would still be performant for field access > even if the array was copied as a byte stream. There must be a more readable > way to do this. What's wrong about `memcpy`, or rather the builtin version? Naturally I could write a for cycle copying the bytes, and rely on the compiler to optimize that out anyway, but I think that this makes the intention clear. If the handling was done through OS, I guess that the penalty would be actually quite severe. I could have tested the previous version on aarch64 e.g. in AWS, though now there's no casting of pointers anymore. When we have a final version, I could set up a build in AWS and report performance data from there. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24847#discussion_r2135764757