Skip to content

Commit

Permalink
DontInline slow path in MethodHandle::asType
Browse files Browse the repository at this point in the history
  • Loading branch information
mcimadamore committed Sep 30, 2024
1 parent c9c2f19 commit 8c2f978
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@


import jdk.internal.loader.ClassLoaders;
import jdk.internal.vm.annotation.DontInline;
import jdk.internal.vm.annotation.IntrinsicCandidate;

import java.lang.constant.ClassDesc;
Expand Down Expand Up @@ -867,7 +868,7 @@ public final MethodHandle asType(MethodType newType) {
if (at != null) {
return at;
}
return setAsTypeCache(asTypeUncached(newType));
return setAsTypeCache(newType);
}

private MethodHandle asTypeCached(MethodType newType) {
Expand All @@ -885,7 +886,9 @@ private MethodHandle asTypeCached(MethodType newType) {
return null;
}

private MethodHandle setAsTypeCache(MethodHandle at) {
@DontInline
private MethodHandle setAsTypeCache(MethodType newType) {
MethodHandle at = asTypeUncached(newType);
// Don't introduce a strong reference in the cache if newType depends on any class loader other than
// current method handle already does to avoid class loader leaks.
if (isSafeToCache(at.type)) {
Expand Down

0 comments on commit 8c2f978

Please sign in to comment.