mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-29 14:52:52 +00:00
8059938: NPE restoring cached script with optimistic types disabled
Reviewed-by: lagergren, sundar
This commit is contained in:
parent
4f8e9a09e2
commit
2134f7554d
@ -1138,6 +1138,9 @@ public final class Context {
|
||||
|
||||
StoredScript storedScript = null;
|
||||
FunctionNode functionNode = null;
|
||||
// We only use the code store here if optimistic types are disabled. With optimistic types,
|
||||
// code is stored per function in RecompilableScriptFunctionData.
|
||||
// TODO: This should really be triggered by lazy compilation, not optimistic types.
|
||||
final boolean useCodeStore = env._persistent_cache && !env._parse_only && !env._optimistic_types;
|
||||
final String cacheKey = useCodeStore ? CodeStore.getCacheKey(0, null) : null;
|
||||
|
||||
@ -1224,7 +1227,7 @@ public final class Context {
|
||||
final String mainClassName = storedScript.getMainClassName();
|
||||
final byte[] mainClassBytes = classBytes.get(mainClassName);
|
||||
final Class<?> mainClass = installer.install(mainClassName, mainClassBytes);
|
||||
final Map<Integer, FunctionInitializer> initialzers = storedScript.getInitializers();
|
||||
final Map<Integer, FunctionInitializer> initializers = storedScript.getInitializers();
|
||||
|
||||
installedClasses.put(mainClassName, mainClass);
|
||||
|
||||
@ -1244,8 +1247,8 @@ public final class Context {
|
||||
if (constant instanceof RecompilableScriptFunctionData) {
|
||||
final RecompilableScriptFunctionData data = (RecompilableScriptFunctionData) constant;
|
||||
data.initTransients(source, installer);
|
||||
if (initialzers != null) {
|
||||
final FunctionInitializer initializer = initialzers.get(data.getFunctionNodeId());
|
||||
final FunctionInitializer initializer = initializers.get(data.getFunctionNodeId());
|
||||
if (initializer != null) {
|
||||
initializer.setCode(installedClasses.get(initializer.getClassName()));
|
||||
data.initializeCode(initializer);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user