Package org.jruby.ir.dataflow.analyses

Examples of org.jruby.ir.dataflow.analyses.StoreLocalVarPlacementProblem


    public List<Class<? extends CompilerPass>> getDependencies() {
        return DEPENDENCIES;
    }

    public Object execute(IRScope scope, Object... data) {
        StoreLocalVarPlacementProblem slvpp = (StoreLocalVarPlacementProblem)scope.getDataFlowSolution(StoreLocalVarPlacementProblem.NAME);

        boolean scopeHasLocalVarStores      = false;
        boolean scopeHasUnrescuedExceptions = false;

        CFG        cfg = scope.cfg();
        BasicBlock geb = cfg.getGlobalEnsureBB();

        if (slvpp != null) {
            scopeHasLocalVarStores      = slvpp.scopeHasLocalVarStores();
            scopeHasUnrescuedExceptions = slvpp.scopeHasUnrescuedExceptions();
        } else {
            // We dont require local-var load/stores to have been run.
            // If it is not run, we go conservative and add push/pop binding instrs. everywhere
            scopeHasLocalVarStores      = true;
            scopeHasUnrescuedExceptions = false;
View Full Code Here


        // 2. Add stores
        // 3. Figure out required loads
        // 4. Add loads
        //
        // Order is important since loads in 3. depend on stores in 2.
        StoreLocalVarPlacementProblem slvp = new StoreLocalVarPlacementProblem();
        slvp.setup(s);
        slvp.compute_MOP_Solution();

        // Add stores, assigning an equivalent tmp-var for each local var
        Map<Operand, Operand> varRenameMap = new HashMap<Operand, Operand>();
        slvp.addStores(varRenameMap);

        // Once stores have been added, figure out required loads
        LoadLocalVarPlacementProblem llvp = new LoadLocalVarPlacementProblem();
        llvp.setup(s);
        llvp.compute_MOP_Solution();
View Full Code Here

        //
        // Add explicit frame and binding push/pop instrs ONLY for methods -- we cannot handle this in closures and evals yet
        // If the scope uses $_ or $~ family of vars, has local load/stores, or if its binding has escaped, we have
        // to allocate a dynamic scope for it and add binding push/pop instructions.
        if (explicitCallProtocolSupported(scope)) {
            StoreLocalVarPlacementProblem slvpp = (StoreLocalVarPlacementProblem)scope.getDataFlowSolution(StoreLocalVarPlacementProblem.NAME);
            boolean scopeHasLocalVarStores = false;
            boolean bindingHasEscaped      = scope.bindingHasEscaped();

            CFG cfg = scope.cfg();

            if (slvpp != null && bindingHasEscaped) {
                scopeHasLocalVarStores = slvpp.scopeHasLocalVarStores();
            } else {
                // We dont require local-var load/stores to have been run.
                // If it is not run, we go conservative and add push/pop binding instrs. everywhere
                scopeHasLocalVarStores = bindingHasEscaped;
            }
View Full Code Here

        return DEPENDENCIES;
    }

    @Override
    public Object execute(IRScope s, Object... data) {
        StoreLocalVarPlacementProblem slvp = new StoreLocalVarPlacementProblem();

        // No need to run this pass if we eliminated the dynamic scope!
        if (!s.getFlags().contains(IRFlags.DYNSCOPE_ELIMINATED) || s.getFlags().contains(IRFlags.REUSE_PARENT_DYNSCOPE)) {
            // Make sure flags are computed
            s.computeScopeFlags();

            Map<Operand, Operand> varRenameMap = new HashMap<Operand, Operand>();
            // 1. Figure out required stores
            // 2. Add stores
            // 3. Figure out required loads
            // 4. Add loads
            //
            // Order is important since loads in 3. depend on stores in 2.
            slvp.setup(s);
            slvp.compute_MOP_Solution();

            // Add stores, assigning an equivalent tmp-var for each local var
            slvp.addStores(varRenameMap);

            // Once stores have been added, figure out required loads
            LoadLocalVarPlacementProblem llvp = new LoadLocalVarPlacementProblem();
            llvp.setup(s);
            llvp.compute_MOP_Solution();
View Full Code Here

TOP

Related Classes of org.jruby.ir.dataflow.analyses.StoreLocalVarPlacementProblem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.