Package org.jruby.ir.dataflow.analyses

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


    public Object previouslyRun(IRScope scope) {
        return scope.getDataFlowSolution(LiveVariablesProblem.NAME);
    }

    public Object execute(IRScope scope, Object... data) {
        LiveVariablesProblem lvp = new LiveVariablesProblem(scope);
        lvp.compute_MOP_Solution();
       
        scope.setDataFlowSolution(LiveVariablesProblem.NAME, lvp);
       
        return lvp;
    }
View Full Code Here


        // }

        // Make sure flags are computed
        scope.computeScopeFlags();

        LiveVariablesProblem lvp = new LiveVariablesProblem(scope);

        if (scope instanceof IRClosure) {
            // Go conservative! Normally, closure scopes are analyzed
            // in the context of their outermost method scopes where we
            // have better knowledge of aliveness in that global context.
            //
            // But, if we are analyzing closures standalone, we have to
            // conservatively assume that any dirtied variables that
            // belong to an outer scope are live on exit.
            Set<LocalVariable> nlVars = new HashSet<LocalVariable>();
            collectNonLocalDirtyVars((IRClosure)scope, nlVars, scope.getFlags().contains(IRFlags.DYNSCOPE_ELIMINATED) ? -1 : 0);

            // Init DF vars from this set
            for (Variable v: nlVars) {
                lvp.addDFVar(v);
            }
            lvp.setVarsLiveOnScopeExit(nlVars);
        }

        lvp.compute_MOP_Solution();
        scope.setDataFlowSolution(LiveVariablesProblem.NAME, lvp);

        return lvp;
    }
View Full Code Here

TOP

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

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.