On Fri, 6 Sep 2024 10:42:54 GMT, Shaojin Wen <s...@openjdk.org> wrote:
>> - A small portion (~5%) of the instrumented overhead when spinning MH/LF >> classes in `InvokeBytecodeGenerator` comes from creating the exact same >> `RuntimeVisibleAnnotationsAttribute` for every method. Introducing a couple >> of constants has a small but measurable impact. >> - `classDesc(MemberName.class)` is called ~8000 times during an OpenJDK >> build, `classDesc(MethodType.class)` ~900 - special casing looks profitable >> - Class name validation narrowed down, use ReferenceClassDescImpl.ofValidated >> - Various minor optimizations helping reduce bytecode size and speed up >> interpreter execution > > src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java > line 149: > >> 147: localsMap[0] = 0; // localsMap has at least one element >> 148: for (int i = 1, index = 0; i < localsMap.length; i++) { >> 149: Class<?> cl = mt.parameterType(i - 1); > > Can we use var? > > var cl = mt.parameterType(i - 1); I'm not too keen on `var` when it's not immediately obvious what the type is. For these two places I think `var` would make type information slightly less obvious when reading the code, so I'll opt to leave it as-is. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20887#discussion_r1747032114