RFR: 8300258: C2: vectorization fails on simple ByteBuffer loop [v2]

Roland Westrelin roland at openjdk.org
Thu Mar 2 09:56:08 UTC 2023


On Thu, 2 Mar 2023 09:05:28 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> Keeping `same_velt_type` will probably not harm much, but be more restrictive than neccessary.

It's quite possible that it's over conservative. What this change is trying to achieve is to relax checks so a pattern that's known to be used in the core libraries optimizes better. That pattern only optimizes for misaligned accesses. So it does seem wrong that those architectures that don't allow misaligned accesses are affected. Also, this code is complicated so it certainly feels safer to me to be on the safe side even if it feels too restrictive. Going forward refactoring this would be nice. I gave it a quick try and it was more complicated than I expected.

I also don't think we should spend too much time making sure every possible combinations of unsafe accesses optimize well or even  correctly if it's too much work. Once people start using unsafe, they are on their own. I think we should stick with whatever feels reasonable or is used in the core libraries (hopefully the second category is included in the first category).

What do you think @vnkozlov ?

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

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


More information about the hotspot-compiler-dev mailing list