jdk.nashorn.internal.codegen.TypeMap Java Examples

The following examples show how to use jdk.nashorn.internal.codegen.TypeMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RecompilableScriptFunctionData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    return Compiler.forOnDemandCompilation(
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            isStrict() | functionNode.isStrict(), // is strict
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example #2
Source File: RecompilableScriptFunctionData.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    return Compiler.forOnDemandCompilation(
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            isStrict() | functionNode.isStrict(), // is strict
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example #3
Source File: RecompilableScriptFunctionData.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    return Compiler.forOnDemandCompilation(
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            isStrict() | functionNode.isStrict(), // is strict
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example #4
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    return Compiler.forOnDemandCompilation(
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            isStrict() | functionNode.isStrict(), // is strict
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example #5
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    return Compiler.forOnDemandCompilation(
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            isStrict() | functionNode.isStrict(), // is strict
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example #6
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    return Compiler.forOnDemandCompilation(
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            isStrict() | functionNode.isStrict(), // is strict
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example #7
Source File: RecompilableScriptFunctionData.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
        final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
        final int[] continuationEntryPoints) {
    final TypeMap typeMap = typeMap(actualCallSiteType);
    final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
    final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
    final Context context = Context.getContextTrusted();
    return new Compiler(
            context,
            context.getEnv(),
            getInstallerForNewCode(),
            functionNode.getSource(),  // source
            context.getErrorManager(),
            isStrict() | functionNode.isStrict(), // is strict
            true,       // is on demand
            this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
            typeMap,    // type map
            getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
            typeInformationFile,
            continuationEntryPoints, // continuation entry points
            runtimeScope); // runtime scope
}
 
Example #8
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
TypeMap typeMap(final MethodType fnCallSiteType) {
    if (fnCallSiteType == null) {
        return null;
    }

    if (CompiledFunction.isVarArgsType(fnCallSiteType)) {
        return null;
    }

    return new TypeMap(functionNodeId, explicitParams(fnCallSiteType), needsCallee());
}
 
Example #9
Source File: RecompilableScriptFunctionData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private FunctionInitializer compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope, final boolean persist) {
    // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
    // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
    // CompilationEnvironment#declareLocalSymbol()).

    if (log.isEnabled()) {
        log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    }

    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);
        final CodeInstaller<ScriptEnvironment> newInstaller = getInstallerForNewCode();
        final StoredScript script = newInstaller.loadScript(source, cacheKey);

        if (script != null) {
            Compiler.updateCompilationId(script.getCompilationId());
            return script.installFunction(this, newInstaller);
        }
    }

    final FunctionNode fn = reparse();
    final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
    final FunctionNode compiledFn = compiler.compile(fn,
            isSerialized() ? CompilationPhases.COMPILE_ALL_SERIALIZED : CompilationPhases.COMPILE_ALL);

    if (persist && !compiledFn.getFlag(FunctionNode.HAS_APPLY_TO_CALL_SPECIALIZATION)) {
        compiler.persistClassInfo(cacheKey, compiledFn);
    }
    return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
}
 
Example #10
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private FunctionInitializer compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope, final boolean persist) {
    // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
    // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
    // CompilationEnvironment#declareLocalSymbol()).

    if (log.isEnabled()) {
        log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    }

    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);
        final CodeInstaller newInstaller = getInstallerForNewCode();
        final StoredScript script = newInstaller.loadScript(source, cacheKey);

        if (script != null) {
            Compiler.updateCompilationId(script.getCompilationId());
            return script.installFunction(this, newInstaller);
        }
    }

    final FunctionNode fn = reparse();
    final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
    final FunctionNode compiledFn = compiler.compile(fn,
            fn.isCached() ? CompilationPhases.COMPILE_ALL_CACHED : CompilationPhases.COMPILE_ALL);

    if (persist && !compiledFn.hasApplyToCallSpecialization()) {
        compiler.persistClassInfo(cacheKey, compiledFn);
    }
    return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
}
 
Example #11
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
TypeMap typeMap(final MethodType fnCallSiteType) {
    if (fnCallSiteType == null) {
        return null;
    }

    if (CompiledFunction.isVarArgsType(fnCallSiteType)) {
        return null;
    }

    return new TypeMap(functionNodeId, explicitParams(fnCallSiteType), needsCallee());
}
 
Example #12
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private FunctionInitializer compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope, final boolean persist) {
    // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
    // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
    // CompilationEnvironment#declareLocalSymbol()).

    if (log.isEnabled()) {
        log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    }

    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);
        final CodeInstaller newInstaller = getInstallerForNewCode();
        final StoredScript script = newInstaller.loadScript(source, cacheKey);

        if (script != null) {
            Compiler.updateCompilationId(script.getCompilationId());
            return script.installFunction(this, newInstaller);
        }
    }

    final FunctionNode fn = reparse();
    final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
    final FunctionNode compiledFn = compiler.compile(fn,
            fn.isCached() ? CompilationPhases.COMPILE_ALL_CACHED : CompilationPhases.COMPILE_ALL);

    if (persist && !compiledFn.hasApplyToCallSpecialization()) {
        compiler.persistClassInfo(cacheKey, compiledFn);
    }
    return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
}
 
Example #13
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
TypeMap typeMap(final MethodType fnCallSiteType) {
    if (fnCallSiteType == null) {
        return null;
    }

    if (CompiledFunction.isVarArgsType(fnCallSiteType)) {
        return null;
    }

    return new TypeMap(functionNodeId, explicitParams(fnCallSiteType), needsCallee());
}
 
Example #14
Source File: RecompilableScriptFunctionData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
TypeMap typeMap(final MethodType fnCallSiteType) {
    if (fnCallSiteType == null) {
        return null;
    }

    if (CompiledFunction.isVarArgsType(fnCallSiteType)) {
        return null;
    }

    return new TypeMap(functionNodeId, explicitParams(fnCallSiteType), needsCallee());
}
 
Example #15
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private FunctionInitializer compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope, final boolean persist) {
    // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
    // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
    // CompilationEnvironment#declareLocalSymbol()).

    if (log.isEnabled()) {
        log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    }

    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);
        final CodeInstaller newInstaller = getInstallerForNewCode();
        final StoredScript script = newInstaller.loadScript(source, cacheKey);

        if (script != null) {
            Compiler.updateCompilationId(script.getCompilationId());
            return script.installFunction(this, newInstaller);
        }
    }

    final FunctionNode fn = reparse();
    final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
    final FunctionNode compiledFn = compiler.compile(fn,
            fn.isCached() ? CompilationPhases.COMPILE_ALL_CACHED : CompilationPhases.COMPILE_ALL);

    if (persist && !compiledFn.hasApplyToCallSpecialization()) {
        compiler.persistClassInfo(cacheKey, compiledFn);
    }
    return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
}
 
Example #16
Source File: RecompilableScriptFunctionData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
TypeMap typeMap(final MethodType fnCallSiteType) {
    if (fnCallSiteType == null) {
        return null;
    }

    if (CompiledFunction.isVarArgsType(fnCallSiteType)) {
        return null;
    }

    return new TypeMap(functionNodeId, explicitParams(fnCallSiteType), needsCallee());
}
 
Example #17
Source File: RecompilableScriptFunctionData.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private FunctionInitializer compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope, final boolean persist) {
    // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
    // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
    // CompilationEnvironment#declareLocalSymbol()).

    if (log.isEnabled()) {
        log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    }

    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);
        final CodeInstaller newInstaller = getInstallerForNewCode();
        final StoredScript script = newInstaller.loadScript(source, cacheKey);

        if (script != null) {
            Compiler.updateCompilationId(script.getCompilationId());
            return script.installFunction(this, newInstaller);
        }
    }

    final FunctionNode fn = reparse();
    final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
    final FunctionNode compiledFn = compiler.compile(fn,
            fn.isCached() ? CompilationPhases.COMPILE_ALL_CACHED : CompilationPhases.COMPILE_ALL);

    if (persist && !compiledFn.hasApplyToCallSpecialization()) {
        compiler.persistClassInfo(cacheKey, compiledFn);
    }
    return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
}
 
Example #18
Source File: RecompilableScriptFunctionData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private FunctionInitializer compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope, final boolean persist) {
    // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
    // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
    // CompilationEnvironment#declareLocalSymbol()).

    if (log.isEnabled()) {
        log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    }

    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);
        final CodeInstaller newInstaller = getInstallerForNewCode();
        final StoredScript script = newInstaller.loadScript(source, cacheKey);

        if (script != null) {
            Compiler.updateCompilationId(script.getCompilationId());
            return script.installFunction(this, newInstaller);
        }
    }

    final FunctionNode fn = reparse();
    final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
    final FunctionNode compiledFn = compiler.compile(fn,
            fn.isCached() ? CompilationPhases.COMPILE_ALL_CACHED : CompilationPhases.COMPILE_ALL);

    if (persist && !compiledFn.hasApplyToCallSpecialization()) {
        compiler.persistClassInfo(cacheKey, compiledFn);
    }
    return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
}
 
Example #19
Source File: RecompilableScriptFunctionData.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
TypeMap typeMap(final MethodType fnCallSiteType) {
    if (fnCallSiteType == null) {
        return null;
    }

    if (CompiledFunction.isVarArgsType(fnCallSiteType)) {
        return null;
    }

    return new TypeMap(functionNodeId, explicitParams(fnCallSiteType), needsCallee());
}
 
Example #20
Source File: RecompilableScriptFunctionData.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
TypeMap typeMap(final MethodType fnCallSiteType) {
    if (fnCallSiteType == null) {
        return null;
    }

    if (CompiledFunction.isVarArgsType(fnCallSiteType)) {
        return null;
    }

    return new TypeMap(functionNodeId, explicitParams(fnCallSiteType), needsCallee());
}
 
Example #21
Source File: RecompilableScriptFunctionData.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private FunctionInitializer compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope, final boolean persist) {
    // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
    // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
    // CompilationEnvironment#declareLocalSymbol()).

    if (log.isEnabled()) {
        log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType);
    }

    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);
        final CodeInstaller newInstaller = getInstallerForNewCode();
        final StoredScript script = newInstaller.loadScript(source, cacheKey);

        if (script != null) {
            Compiler.updateCompilationId(script.getCompilationId());
            return script.installFunction(this, newInstaller);
        }
    }

    final FunctionNode fn = reparse();
    final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
    final FunctionNode compiledFn = compiler.compile(fn,
            fn.isCached() ? CompilationPhases.COMPILE_ALL_CACHED : CompilationPhases.COMPILE_ALL);

    if (persist && !compiledFn.hasApplyToCallSpecialization()) {
        compiler.persistClassInfo(cacheKey, compiledFn);
    }
    return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints());
}