jdk.nashorn.internal.ir.FunctionNode.CompilationState Java Examples

The following examples show how to use jdk.nashorn.internal.ir.FunctionNode.CompilationState. 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: CodeGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    try {
        if(emittedMethods.add(functionNode.getName())) {
            method.end(); // wrap up this method
            unit   = lc.popCompileUnit(functionNode.getCompileUnit());
            method = lc.popMethodEmitter(method);
            LOG.info("=== END ", functionNode.getName());
        }

        final FunctionNode newFunctionNode = functionNode.setState(lc, CompilationState.EMITTED);
        newFunctionObject(newFunctionNode, functionNode);
        return newFunctionNode;
    } catch (final Throwable t) {
        Context.printStackTrace(t);
        final VerifyError e = new VerifyError("Code generation bug in \"" + functionNode.getName() + "\": likely stack misaligned: " + t + " " + functionNode.getSource().getName());
        e.initCause(t);
        throw e;
    }
}
 
Example #2
Source File: CodeGenerator.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    try {
        if(emittedMethods.add(functionNode.getName())) {
            method.end(); // wrap up this method
            unit   = lc.popCompileUnit(functionNode.getCompileUnit());
            method = lc.popMethodEmitter(method);
            LOG.info("=== END ", functionNode.getName());
        }

        final FunctionNode newFunctionNode = functionNode.setState(lc, CompilationState.EMITTED);
        newFunctionObject(newFunctionNode, functionNode);
        return newFunctionNode;
    } catch (final Throwable t) {
        Context.printStackTrace(t);
        final VerifyError e = new VerifyError("Code generation bug in \"" + functionNode.getName() + "\": likely stack misaligned: " + t + " " + functionNode.getSource().getName());
        e.initCause(t);
        throw e;
    }
}
 
Example #3
Source File: CodeGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    try {
        if(emittedMethods.add(functionNode.getName())) {
            method.end(); // wrap up this method
            unit   = lc.popCompileUnit(functionNode.getCompileUnit());
            method = lc.popMethodEmitter(method);
            LOG.info("=== END ", functionNode.getName());
        }

        final FunctionNode newFunctionNode = functionNode.setState(lc, CompilationState.EMITTED);
        newFunctionObject(newFunctionNode, functionNode);
        return newFunctionNode;
    } catch (final Throwable t) {
        Context.printStackTrace(t);
        final VerifyError e = new VerifyError("Code generation bug in \"" + functionNode.getName() + "\": likely stack misaligned: " + t + " " + functionNode.getSource().getName());
        e.initCause(t);
        throw e;
    }
}
 
Example #4
Source File: AssignSymbols.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    final FunctionNode finalizedFunction;
    if (isUnparsedFunction(functionNode)) {
        finalizedFunction = functionNode;
    } else {
        finalizedFunction =
           markProgramBlock(
           removeUnusedSlots(
           createSyntheticInitializers(
           finalizeParameters(
                   lc.applyTopFlags(functionNode))))
                   .setThisProperties(lc, thisProperties.pop().size()));
    }
    return finalizedFunction.setState(lc, CompilationState.SYMBOLS_ASSIGNED);
}
 
Example #5
Source File: ApplySpecialization.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to do the apply to call transformation
 * @return true if successful, false otherwise
 */
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    FunctionNode newFunctionNode = functionNode;
    final String functionName = newFunctionNode.getName();

    if (changed.contains(newFunctionNode.getId())) {
        newFunctionNode = newFunctionNode.clearFlag(lc, FunctionNode.USES_ARGUMENTS).
                setFlag(lc, FunctionNode.HAS_APPLY_TO_CALL_SPECIALIZATION).
                setParameters(lc, explodedArguments.peek());

        if (log.isEnabled()) {
            log.info("Success: ",
                    massageURL(newFunctionNode.getSource().getURL()),
                    '.',
                    functionName,
                    "' id=",
                    newFunctionNode.getId(),
                    " params=",
                    callSiteTypes.peek());
        }
    }

    callSiteTypes.pop();
    explodedArguments.pop();

    return newFunctionNode.setState(lc, CompilationState.BUILTINS_TRANSFORMED);
}
 
Example #6
Source File: Parser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private FunctionNode restoreFunctionNode(final FunctionNode functionNode, final long lastToken) {
final Block newBody = restoreBlock(lc.getFunctionBody(functionNode));

return lc.pop(functionNode).
    setBody(lc, newBody).
    setLastToken(lc, lastToken).
    setState(lc, errors.hasErrors() ? CompilationState.PARSE_ERROR : CompilationState.PARSED).
    snapshot(lc);
}
 
Example #7
Source File: Parser.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private FunctionNode restoreFunctionNode(final FunctionNode functionNode, final long lastToken) {
final Block newBody = restoreBlock(lc.getFunctionBody(functionNode));

return lc.pop(functionNode).
    setBody(lc, newBody).
    setLastToken(lc, lastToken).
    setState(lc, errors.hasErrors() ? CompilationState.PARSE_ERROR : CompilationState.PARSED).
    snapshot(lc);
}
 
Example #8
Source File: Parser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private FunctionNode restoreFunctionNode(final FunctionNode functionNode, final long lastToken) {
    final Block newBody = restoreBlock(lc.getFunctionBody(functionNode));

    return lc.pop(functionNode).
        setBody(lc, newBody).
        setLastToken(lc, lastToken).
        setState(lc, errors.hasErrors() ? CompilationState.PARSE_ERROR : CompilationState.PARSED);
}
 
Example #9
Source File: Parser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private FunctionNode restoreFunctionNode(final FunctionNode functionNode, final long lastToken) {
final Block newBody = restoreBlock(lc.getFunctionBody(functionNode));

return lc.pop(functionNode).
    setBody(lc, newBody).
    setLastToken(lc, lastToken).
    setState(lc, errors.hasErrors() ? CompilationState.PARSE_ERROR : CompilationState.PARSED).
    snapshot(lc);
}
 
Example #10
Source File: ReplaceCompileUnits.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode node) {
    return node.setCompileUnit(lc, getExistingReplacement(node)).setState(lc, CompilationState.COMPILE_UNITS_REUSED);
}
 
Example #11
Source File: FoldConstants.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    return functionNode.setState(lc, CompilationState.CONSTANT_FOLDED);
}
 
Example #12
Source File: Lower.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    LOG.info("END FunctionNode: ", functionNode.getName());
    return functionNode.setState(lc, CompilationState.LOWERED);
}
 
Example #13
Source File: FinalizeTypes.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    return functionNode.setState(lc, CompilationState.FINALIZED);
}
 
Example #14
Source File: FoldConstants.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    return functionNode.setState(lc, CompilationState.CONSTANT_FOLDED);
}
 
Example #15
Source File: Lower.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    LOG.info("END FunctionNode: ", functionNode.getName());
    return functionNode.setState(lc, CompilationState.LOWERED);
}
 
Example #16
Source File: FinalizeTypes.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    return functionNode.setState(lc, CompilationState.FINALIZED);
}
 
Example #17
Source File: FoldConstants.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    return functionNode.setState(lc, CompilationState.CONSTANT_FOLDED);
}
 
Example #18
Source File: Lower.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    LOG.info("END FunctionNode: ", functionNode.getName());
    return functionNode.setState(lc, CompilationState.LOWERED);
}
 
Example #19
Source File: FinalizeTypes.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    return functionNode.setState(lc, CompilationState.FINALIZED);
}
 
Example #20
Source File: FoldConstants.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    return functionNode.setState(lc, CompilationState.CONSTANT_FOLDED);
}
 
Example #21
Source File: OptimisticTypesCalculator.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    neverOptimistic.pop();
    return functionNode.setState(lc, CompilationState.OPTIMISTIC_TYPES_ASSIGNED);
}
 
Example #22
Source File: Lower.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
    log.info("END FunctionNode: ", functionNode.getName());
    return functionNode.setState(lc, CompilationState.LOWERED);
}