src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java

Print this page

        

@@ -489,11 +489,11 @@
 
         if (log.isEnabled()) {
             log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
         }
 
-        final boolean persistentCache = usePersistentCodeCache() && persist;
+        final boolean persistentCache = persist && usePersistentCodeCache();
         String cacheKey = null;
         if (persistentCache) {
             final TypeMap typeMap = typeMap(actualCallSiteType);
             final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
             cacheKey = CodeStore.getCacheKey(functionNodeId, paramTypes);

@@ -516,12 +516,11 @@
         }
         return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
     }
 
     boolean usePersistentCodeCache() {
-        final ScriptEnvironment env = installer.getOwner();
-        return env._persistent_cache && env._optimistic_types;
+        return installer != null && installer.getOwner()._persistent_cache;
     }
 
     private MethodType explicitParams(final MethodType callSiteType) {
         if (CompiledFunction.isVarArgsType(callSiteType)) {
             return null;