> On May 4, 2022, at 8:29 PM, Xiaohong Gong <xg...@openjdk.java.net> wrote: > > The offset check could save the `checkMaskFromIndexSize` for cases that > offset are in the valid array bounds, which also improves the performance. > @rose00 , do you think this part of change is ok at least?
That part is ok, yes. I wish we could get the same effect with loop optimizations but I don’t know an easy way. The explicit check in the source code gives the JIT a crutch but I hope we can figure out a way in the future to integrate mask logic into range check elimination logic, making the crutches unnecessary. For now it’s fine.