Java Code Examples for jdk.nashorn.internal.ir.FunctionNode#IS_SPLIT
The following examples show how to use
jdk.nashorn.internal.ir.FunctionNode#IS_SPLIT .
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: CacheAst.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveFunctionNode(final FunctionNode functionNode) { final RecompilableScriptFunctionData data = dataStack.pop(); if (functionNode.isSplit()) { // NOTE: cache only split function ASTs from eager pass. Caching non-split functions would require // some additional work, namely creating the concept of "uncacheable" function and reworking // ApplySpecialization to ensure that functions undergoing apply-to-call transformations are not // cacheable as well as recomputing Symbol.useCount when caching the eagerly parsed AST. // Recomputing Symbol.useCount would be needed so it will only reflect uses from within the // function being cached (and not reflect uses from its own nested functions or functions it is // nested in). This is consistent with the count an on-demand recompilation of the function would // produce. This is important as the decision to emit shared scope calls is based on this count, // and if it is not matched between a previous version of the code and its deoptimizing rest-of // compilation, it can result in rest-of not emitting a shared scope call where a previous version // of the code (compiled from a cached eager pre-pass seeing higher (global) useCount) would emit // it, causing a mismatch in stack shapes between previous code and its rest-of. data.setCachedAst(functionNode); } if (!dataStack.isEmpty() && ((dataStack.peek().getFunctionFlags() & FunctionNode.IS_SPLIT) != 0)) { // Return a function node with no body so that caching outer functions doesn't hold on to nested // functions' bodies. Note we're doing this only for functions directly nested inside split // functions, since we're only caching the split ones. It is not necessary to limit body removal // to just these functions, but it's a cheap way to prevent unnecessary AST mutations. return functionNode.setBody(lc, functionNode.getBody().setStatements(null, Collections.<Statement>emptyList())); } return functionNode; }
Example 2
Source File: CacheAst.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveFunctionNode(final FunctionNode functionNode) { final RecompilableScriptFunctionData data = dataStack.pop(); if (functionNode.isSplit()) { // NOTE: cache only split function ASTs from eager pass. Caching non-split functions would require // some additional work, namely creating the concept of "uncacheable" function and reworking // ApplySpecialization to ensure that functions undergoing apply-to-call transformations are not // cacheable as well as recomputing Symbol.useCount when caching the eagerly parsed AST. // Recomputing Symbol.useCount would be needed so it will only reflect uses from within the // function being cached (and not reflect uses from its own nested functions or functions it is // nested in). This is consistent with the count an on-demand recompilation of the function would // produce. This is important as the decision to emit shared scope calls is based on this count, // and if it is not matched between a previous version of the code and its deoptimizing rest-of // compilation, it can result in rest-of not emitting a shared scope call where a previous version // of the code (compiled from a cached eager pre-pass seeing higher (global) useCount) would emit // it, causing a mismatch in stack shapes between previous code and its rest-of. data.setCachedAst(functionNode); } if (!dataStack.isEmpty() && ((dataStack.peek().getFunctionFlags() & FunctionNode.IS_SPLIT) != 0)) { // Return a function node with no body so that caching outer functions doesn't hold on to nested // functions' bodies. Note we're doing this only for functions directly nested inside split // functions, since we're only caching the split ones. It is not necessary to limit body removal // to just these functions, but it's a cheap way to prevent unnecessary AST mutations. return functionNode.setBody(lc, functionNode.getBody().setStatements(null, Collections.<Statement>emptyList())); } return functionNode; }
Example 3
Source File: CacheAst.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveFunctionNode(final FunctionNode functionNode) { final RecompilableScriptFunctionData data = dataStack.pop(); if (functionNode.isSplit()) { // NOTE: cache only split function ASTs from eager pass. Caching non-split functions would require // some additional work, namely creating the concept of "uncacheable" function and reworking // ApplySpecialization to ensure that functions undergoing apply-to-call transformations are not // cacheable as well as recomputing Symbol.useCount when caching the eagerly parsed AST. // Recomputing Symbol.useCount would be needed so it will only reflect uses from within the // function being cached (and not reflect uses from its own nested functions or functions it is // nested in). This is consistent with the count an on-demand recompilation of the function would // produce. This is important as the decision to emit shared scope calls is based on this count, // and if it is not matched between a previous version of the code and its deoptimizing rest-of // compilation, it can result in rest-of not emitting a shared scope call where a previous version // of the code (compiled from a cached eager pre-pass seeing higher (global) useCount) would emit // it, causing a mismatch in stack shapes between previous code and its rest-of. data.setCachedAst(functionNode); } if (!dataStack.isEmpty() && ((dataStack.peek().getFunctionFlags() & FunctionNode.IS_SPLIT) != 0)) { // Return a function node with no body so that caching outer functions doesn't hold on to nested // functions' bodies. Note we're doing this only for functions directly nested inside split // functions, since we're only caching the split ones. It is not necessary to limit body removal // to just these functions, but it's a cheap way to prevent unnecessary AST mutations. return functionNode.setBody(lc, functionNode.getBody().setStatements(null, Collections.<Statement>emptyList())); } return functionNode; }
Example 4
Source File: CacheAst.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveFunctionNode(final FunctionNode functionNode) { final RecompilableScriptFunctionData data = dataStack.pop(); if (functionNode.isSplit()) { // NOTE: cache only split function ASTs from eager pass. Caching non-split functions would require // some additional work, namely creating the concept of "uncacheable" function and reworking // ApplySpecialization to ensure that functions undergoing apply-to-call transformations are not // cacheable as well as recomputing Symbol.useCount when caching the eagerly parsed AST. // Recomputing Symbol.useCount would be needed so it will only reflect uses from within the // function being cached (and not reflect uses from its own nested functions or functions it is // nested in). This is consistent with the count an on-demand recompilation of the function would // produce. This is important as the decision to emit shared scope calls is based on this count, // and if it is not matched between a previous version of the code and its deoptimizing rest-of // compilation, it can result in rest-of not emitting a shared scope call where a previous version // of the code (compiled from a cached eager pre-pass seeing higher (global) useCount) would emit // it, causing a mismatch in stack shapes between previous code and its rest-of. data.setCachedAst(functionNode); } if (!dataStack.isEmpty() && ((dataStack.peek().getFunctionFlags() & FunctionNode.IS_SPLIT) != 0)) { // Return a function node with no body so that caching outer functions doesn't hold on to nested // functions' bodies. Note we're doing this only for functions directly nested inside split // functions, since we're only caching the split ones. It is not necessary to limit body removal // to just these functions, but it's a cheap way to prevent unnecessary AST mutations. return functionNode.setBody(lc, functionNode.getBody().setStatements(null, Collections.<Statement>emptyList())); } return functionNode; }
Example 5
Source File: CacheAst.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveFunctionNode(final FunctionNode functionNode) { final RecompilableScriptFunctionData data = dataStack.pop(); if (functionNode.isSplit()) { // NOTE: cache only split function ASTs from eager pass. Caching non-split functions would require // some additional work, namely creating the concept of "uncacheable" function and reworking // ApplySpecialization to ensure that functions undergoing apply-to-call transformations are not // cacheable as well as recomputing Symbol.useCount when caching the eagerly parsed AST. // Recomputing Symbol.useCount would be needed so it will only reflect uses from within the // function being cached (and not reflect uses from its own nested functions or functions it is // nested in). This is consistent with the count an on-demand recompilation of the function would // produce. This is important as the decision to emit shared scope calls is based on this count, // and if it is not matched between a previous version of the code and its deoptimizing rest-of // compilation, it can result in rest-of not emitting a shared scope call where a previous version // of the code (compiled from a cached eager pre-pass seeing higher (global) useCount) would emit // it, causing a mismatch in stack shapes between previous code and its rest-of. data.setCachedAst(functionNode); } if (!dataStack.isEmpty() && ((dataStack.peek().getFunctionFlags() & FunctionNode.IS_SPLIT) != 0)) { // Return a function node with no body so that caching outer functions doesn't hold on to nested // functions' bodies. Note we're doing this only for functions directly nested inside split // functions, since we're only caching the split ones. It is not necessary to limit body removal // to just these functions, but it's a cheap way to prevent unnecessary AST mutations. return functionNode.setBody(lc, functionNode.getBody().setStatements(null, Collections.<Statement>emptyList())); } return functionNode; }
Example 6
Source File: CacheAst.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveFunctionNode(final FunctionNode functionNode) { final RecompilableScriptFunctionData data = dataStack.pop(); if (functionNode.isSplit()) { // NOTE: cache only split function ASTs from eager pass. Caching non-split functions would require // some additional work, namely creating the concept of "uncacheable" function and reworking // ApplySpecialization to ensure that functions undergoing apply-to-call transformations are not // cacheable as well as recomputing Symbol.useCount when caching the eagerly parsed AST. // Recomputing Symbol.useCount would be needed so it will only reflect uses from within the // function being cached (and not reflect uses from its own nested functions or functions it is // nested in). This is consistent with the count an on-demand recompilation of the function would // produce. This is important as the decision to emit shared scope calls is based on this count, // and if it is not matched between a previous version of the code and its deoptimizing rest-of // compilation, it can result in rest-of not emitting a shared scope call where a previous version // of the code (compiled from a cached eager pre-pass seeing higher (global) useCount) would emit // it, causing a mismatch in stack shapes between previous code and its rest-of. data.setCachedAst(functionNode); } if (!dataStack.isEmpty() && ((dataStack.peek().getFunctionFlags() & FunctionNode.IS_SPLIT) != 0)) { // Return a function node with no body so that caching outer functions doesn't hold on to nested // functions' bodies. Note we're doing this only for functions directly nested inside split // functions, since we're only caching the split ones. It is not necessary to limit body removal // to just these functions, but it's a cheap way to prevent unnecessary AST mutations. return functionNode.setBody(lc, functionNode.getBody().setStatements(null, Collections.<Statement>emptyList())); } return functionNode; }