Caching symbolic descriptors for the constant pool

- liangchenblue at gmail.com
Mon Apr 24 23:18:27 UTC 2023


First, thanks for the feedback on my cache proposal a few days ago!
I've prepared two patches under 8306697
https://github.com/openjdk/jdk/pull/13598and 8306698
https://github.com/openjdk/jdk/pull/13599, which will hopefully make
the Constant API more useful with classfiles.

I wish to cache symbolic descriptors in classfile API itself. One of
the prime candidates identified by Adam in his migration of
java.lang.invoke to classfile API is ClassEntry.asSymbol, which from
my search, appears to be frequently used in stack map generation. In
addition, a MethodTypeDesc is passed to stack map generator
constructor via ofDescriptor (which has slow parsing even after Adam's
optimization), but the parsing can totally be averted if we can reuse
the MethodTypeDesc passed in withMethod(). Thus, I wish to add
accessors like typeSymbol() and cachedTypeSymbol() for MethodInfo to
speed up StackMapGenerator initialization.

In addition, the stack map generator has a custom bitset-based tool to
split a descriptor on the fly (See
StackMapGenerator.processInvokeInstructions). I believe they can
benefit from reusing a parsed MethodTypeDesc as well, especially if
the invoke instructions were originally built with MethodTypeDesc.

Chen Liang


More information about the classfile-api-dev mailing list