The downcallHandle method in Linker has a complex implementation, and type switches is triggered in multiple places in that handle.
After bytestacks analysis of a simple program that links the native implementation of Class::forName0, it turns out that: 1. there are a few missed usages of type switch in ClassFile API 2. type switch can speed up generation by using explicit stack maps, as stack map gen is over 50% of the generation instructions because the switch is branch-heavy, but the frames are actually simple. These two combined are not that significant in the overall overhead of downcallHandle, but would be helpful for other workloads. ------------- Commit messages: - Fix adding potentially unbound labels - 8354899: Reduce overhead associated with type switches Changes: https://git.openjdk.org/jdk/pull/24705/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24705&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8354899 Stats: 82 lines in 8 files changed: 38 ins; 9 del; 35 mod Patch: https://git.openjdk.org/jdk/pull/24705.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/24705/head:pull/24705 PR: https://git.openjdk.org/jdk/pull/24705