RFR: 8297728: Cache invocation type rather than invoker in NamedFunction
Claes Redestad
redestad at openjdk.org
Tue Nov 29 22:07:01 UTC 2022
`java.lang.invoke.LambdaForm.NamedFunction` has an `invoker` field acting as a cache, but this field is only used for lambda form interpretation, thus not very performance sensitive.
Since the invoker is already cached in the method type hierarchy we could replace it with a cache of the invocation type instead. This means cost to retrieve an invoker for lambda form interpretation is only slightly affected (a few ns/op that end up in the noise since interpretation already incur a >50ns/op overhead on even the simplest forms), while speeding up bytecode generation for `LF`s with `NamedFunction`s not holding a resolvedHandle.
Being lazy about the creation of the type is not significantly beneficial right now, but is done in anticipation of future changes that may better defer bytecode spinning for `LambdaForm`s.
-------------
Commit messages:
- Lazily calculate type
- Cache invocation type rather than invoker in NamedFunction
Changes: https://git.openjdk.org/jdk/pull/11424/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11424&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8297728
Stats: 19 lines in 1 file changed: 9 ins; 6 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/11424.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11424/head:pull/11424
PR: https://git.openjdk.org/jdk/pull/11424
More information about the core-libs-dev
mailing list