RFR: 8341512: Optimize StackMapGenerator::processInvokeInstructions

ExE Boss duke at openjdk.org
Fri Oct 4 14:03:45 UTC 2024


On Fri, 4 Oct 2024 02:15:51 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> A small optimization for StackMapGenerator::processInvokeInstructions.
> 
> 1. Use local currentFrame to avoid multiple getfields
> 2. remove Util.methodTypeSymbol(NameAndTypeEntry)
> 3. Use decStack instead of popStack to reduce array access in popStack
> 4. codeSize reduced from 277 to 262

src/java.base/share/classes/java/lang/classfile/attribute/EnclosingMethodAttribute.java line 95:

> 93:      */
> 94:     default Optional<MethodTypeDesc> enclosingMethodTypeSymbol() {
> 95:         return enclosingMethod().map(NameAndTypeEntry::type).map(Util::methodTypeSymbol);

Maybe call `enclosingMethodType()` here so that the `NameAndTypeEntry::type` lambda class doesn’t get spun up twice:
Suggestion:

        return enclosingMethodType().map(Util::methodTypeSymbol);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21344#discussion_r1787764793


More information about the core-libs-dev mailing list