Skip to content

Commit 56458ee

Browse files
committed
Restore the early check in CachedLazyCallTargetSupplier
* We don't want to create a monitor needlessly, e.g., when lazy CallTargets are disabled.
1 parent 5cca09b commit 56458ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/org/truffleruby/language/methods/CachedLazyCallTargetSupplier.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ public CachedLazyCallTargetSupplier(Supplier<RootCallTarget> supplier) {
2626

2727
public RootCallTarget get() {
2828
CompilerAsserts.neverPartOfCompilation("Only behind a transfer, must not PE the Supplier");
29+
30+
RootCallTarget alreadySet = this.callTarget;
31+
if (alreadySet != null) {
32+
return alreadySet;
33+
}
34+
2935
synchronized (this) {
3036
if (callTarget == null) {
3137
callTarget = supplier.get();

0 commit comments

Comments
 (0)