jdk.nashorn.internal.runtime.FunctionInitializer Java Examples

The following examples show how to use jdk.nashorn.internal.runtime.FunctionInitializer. 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: Compiler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Persist current compilation with the given {@code cacheKey}.
 * @param cacheKey cache key
 * @param functionNode function node
 */
public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) {
    if (cacheKey != null && env._persistent_cache) {
        // If this is an on-demand compilation create a function initializer for the function being compiled.
        // Otherwise use function initializer map generated by codegen.
        final Map<Integer, FunctionInitializer> initializers = new HashMap<>();
        if (isOnDemandCompilation()) {
            initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
        } else {
            for (final CompileUnit compileUnit : getCompileUnits()) {
                for (final FunctionNode fn : compileUnit.getFunctionNodes()) {
                    initializers.put(fn.getId(), new FunctionInitializer(fn));
                }
            }
        }
        final String mainClassName = getFirstCompileUnit().getUnitClassName();
        installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId);
    }
}
 
Example #2
Source File: Compiler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Persist current compilation with the given {@code cacheKey}.
 * @param cacheKey cache key
 * @param functionNode function node
 */
public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) {
    if (cacheKey != null && env._persistent_cache) {
        // If this is an on-demand compilation create a function initializer for the function being compiled.
        // Otherwise use function initializer map generated by codegen.
        Map<Integer, FunctionInitializer> initializers = new HashMap<>();
        if (isOnDemandCompilation()) {
            initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
        } else {
            for (final CompileUnit compileUnit : getCompileUnits()) {
                for (final FunctionNode fn : compileUnit.getFunctionNodes()) {
                    initializers.put(fn.getId(), new FunctionInitializer(fn));
                }
            }
        }
        final String mainClassName = getFirstCompileUnit().getUnitClassName();
        installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId);
    }
}
 
Example #3
Source File: Compiler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Persist current compilation with the given {@code cacheKey}.
 * @param cacheKey cache key
 * @param functionNode function node
 */
public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) {
    if (cacheKey != null && env._persistent_cache) {
        // If this is an on-demand compilation create a function initializer for the function being compiled.
        // Otherwise use function initializer map generated by codegen.
        final Map<Integer, FunctionInitializer> initializers = new HashMap<>();
        if (isOnDemandCompilation()) {
            initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
        } else {
            for (final CompileUnit compileUnit : getCompileUnits()) {
                for (final FunctionNode fn : compileUnit.getFunctionNodes()) {
                    initializers.put(fn.getId(), new FunctionInitializer(fn));
                }
            }
        }
        final String mainClassName = getFirstCompileUnit().getUnitClassName();
        installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId);
    }
}
 
Example #4
Source File: Compiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Persist current compilation with the given {@code cacheKey}.
 * @param cacheKey cache key
 * @param functionNode function node
 */
public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) {
    if (cacheKey != null && env._persistent_cache) {
        // If this is an on-demand compilation create a function initializer for the function being compiled.
        // Otherwise use function initializer map generated by codegen.
        final Map<Integer, FunctionInitializer> initializers = new HashMap<>();
        if (isOnDemandCompilation()) {
            initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
        } else {
            for (final CompileUnit compileUnit : getCompileUnits()) {
                for (final FunctionNode fn : compileUnit.getFunctionNodes()) {
                    initializers.put(fn.getId(), new FunctionInitializer(fn));
                }
            }
        }
        final String mainClassName = getFirstCompileUnit().getUnitClassName();
        installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId);
    }
}
 
Example #5
Source File: Compiler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Persist current compilation with the given {@code cacheKey}.
 * @param cacheKey cache key
 * @param functionNode function node
 */
public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) {
    if (cacheKey != null && env._persistent_cache) {
        // If this is an on-demand compilation create a function initializer for the function being compiled.
        // Otherwise use function initializer map generated by codegen.
        final Map<Integer, FunctionInitializer> initializers = new HashMap<>();
        if (isOnDemandCompilation()) {
            initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
        } else {
            for (final CompileUnit compileUnit : getCompileUnits()) {
                for (final FunctionNode fn : compileUnit.getFunctionNodes()) {
                    initializers.put(fn.getId(), new FunctionInitializer(fn));
                }
            }
        }
        final String mainClassName = getFirstCompileUnit().getUnitClassName();
        installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId);
    }
}
 
Example #6
Source File: Compiler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Persist current compilation with the given {@code cacheKey}.
 * @param cacheKey cache key
 * @param functionNode function node
 */
public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) {
    if (cacheKey != null && env._persistent_cache) {
        // If this is an on-demand compilation create a function initializer for the function being compiled.
        // Otherwise use function initializer map generated by codegen.
        final Map<Integer, FunctionInitializer> initializers = new HashMap<>();
        if (isOnDemandCompilation()) {
            initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
        } else {
            for (final CompileUnit compileUnit : getCompileUnits()) {
                for (final FunctionNode fn : compileUnit.getFunctionNodes()) {
                    initializers.put(fn.getId(), new FunctionInitializer(fn));
                }
            }
        }
        final String mainClassName = getFirstCompileUnit().getUnitClassName();
        installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId);
    }
}
 
Example #7
Source File: Compiler.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Persist current compilation with the given {@code cacheKey}.
 * @param cacheKey cache key
 * @param functionNode function node
 */
public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) {
    if (cacheKey != null && env._persistent_cache) {
        // If this is an on-demand compilation create a function initializer for the function being compiled.
        // Otherwise use function initializer map generated by codegen.
        final Map<Integer, FunctionInitializer> initializers = new HashMap<>();
        if (isOnDemandCompilation()) {
            initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
        } else {
            for (final CompileUnit compileUnit : getCompileUnits()) {
                for (final FunctionNode fn : compileUnit.getFunctionNodes()) {
                    initializers.put(fn.getId(), new FunctionInitializer(fn));
                }
            }
        }
        final String mainClassName = getFirstCompileUnit().getUnitClassName();
        installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId);
    }
}