On Mon, 20 May 2024 10:52:27 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> We can fold the call to `Objects.checkIndex` into the code generated in > generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. > This loads 9 less classes (of which 8 generated LFs and Species classes) on a > minimal test, while being neutral on a throughput sanity test: > > > Name Cnt Base Error Test Error Unit Change > SwitchSanity.switchSum 15 8,162 ± 0,117 8,152 ± 0,131 ns/op 1,00x (p = > 0,800 ) > * = significant > ``` > > A few additional optimizations includes generating the switch method using > the precise type (to avoid the need for an explicitCast adaptation), and > moving some seldom used `findStatic` calls to a holder. All in all this means > a reduction by 33-34M cycles to bootstrap a trivial switch expression on my > M1. Changes requested by liach (Author). src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 630: > 628: .withMethodBody("typeSwitch", > 629: > MethodTypeDescImpl.ofValidated(ConstantDescs.CD_int, > 630: > ClassDesc.ofDescriptor(selectorType.descriptorString()), `selectorType` can be primitive, therefore verification errors arise at `aload` in the generated code. This is why tests fail on GitHub actions. ------------- PR Review: https://git.openjdk.org/jdk/pull/19307#pullrequestreview-2067245226 PR Review Comment: https://git.openjdk.org/jdk/pull/19307#discussion_r1607425026