Skip to content

Commit 37bc84b

Browse files
committed
do not cache CallTargets in single context mode, since we're now freezing the core
1 parent bcc8b7d commit 37bc84b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,10 +737,14 @@ protected void initializeMultipleContexts() {
737737

738738
@TruffleBoundary
739739
public CallTarget cacheCode(String filename, Supplier<CallTarget> createCode) {
740-
return cachedCode.computeIfAbsent(filename, f -> {
741-
LOGGER.log(Level.FINEST, () -> "Caching CallTarget for " + filename);
740+
if (!singleContext) {
741+
return cachedCode.computeIfAbsent(filename, f -> {
742+
LOGGER.log(Level.FINEST, () -> "Caching CallTarget for " + filename);
743+
return createCode.get();
744+
});
745+
} else {
742746
return createCode.get();
743-
});
747+
}
744748
}
745749

746750
@Override
@@ -827,7 +831,11 @@ public synchronized Shape getHPySymbolCacheShape() {
827831
*/
828832
public RootCallTarget createCachedCallTarget(Function<PythonLanguage, RootNode> rootNodeFunction, Object key) {
829833
CompilerAsserts.neverPartOfCompilation();
830-
return cachedCallTargets.computeIfAbsent(key, k -> PythonUtils.getOrCreateCallTarget(rootNodeFunction.apply(this)));
834+
if (!singleContext) {
835+
return cachedCallTargets.computeIfAbsent(key, k -> PythonUtils.getOrCreateCallTarget(rootNodeFunction.apply(this)));
836+
} else {
837+
return PythonUtils.getOrCreateCallTarget(rootNodeFunction.apply(this));
838+
}
831839
}
832840

833841
/**

0 commit comments

Comments
 (0)