File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/main/java/org/truffleruby Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public CachedSupplier(Supplier<T> supplier) {
22
22
23
23
@ Override
24
24
public T get () {
25
- if (value != null ) {
25
+ if (isAvailable () ) {
26
26
return value ;
27
27
}
28
28
synchronized (this ) {
@@ -33,4 +33,9 @@ public T get() {
33
33
return value ;
34
34
}
35
35
}
36
+
37
+ public boolean isAvailable () {
38
+ return value != null ;
39
+ }
40
+
36
41
}
Original file line number Diff line number Diff line change @@ -171,6 +171,13 @@ private InternalMethod(
171
171
this .proc = proc ;
172
172
this .callTarget = callTarget ;
173
173
this .callTargetSupplier = callTargetSupplier ;
174
+
175
+ /* If the call target supplier has already been run, then don't wait until the first time the InternalMethod is
176
+ * asked for the call target, because this would be a deoptimisation in getCallTarget. */
177
+
178
+ if (callTarget == null && callTargetSupplier != null && callTargetSupplier .isAvailable ()) {
179
+ this .callTarget = callTargetSupplier .get ();
180
+ }
174
181
}
175
182
176
183
public SharedMethodInfo getSharedMethodInfo () {
You can’t perform that action at this time.
0 commit comments