File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -737,10 +737,14 @@ protected void initializeMultipleContexts() {
737
737
738
738
@ TruffleBoundary
739
739
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 {
742
746
return createCode .get ();
743
- });
747
+ }
744
748
}
745
749
746
750
@ Override
@@ -827,7 +831,11 @@ public synchronized Shape getHPySymbolCacheShape() {
827
831
*/
828
832
public RootCallTarget createCachedCallTarget (Function <PythonLanguage , RootNode > rootNodeFunction , Object key ) {
829
833
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
+ }
831
839
}
832
840
833
841
/**
You can’t perform that action at this time.
0 commit comments