Package org.jruby.ir.passes

Source Code of org.jruby.ir.passes.LiveVariableAnalysis

package org.jruby.ir.passes;

import java.util.ArrayList;
import java.util.List;

import org.jruby.ir.IRScope;
import org.jruby.ir.dataflow.analyses.LiveVariablesProblem;

public class LiveVariableAnalysis extends CompilerPass {
    public static List<Class<? extends CompilerPass>> DEPENDENCIES = new ArrayList<Class<? extends CompilerPass>>() {{
       add(CFGBuilder.class);
    }};
   
    public String getLabel() {
        return "Live Variable Analysis";
    }

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

    @Override
    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;
    }
   
    @Override
    public void invalidate(IRScope scope) {
        scope.setDataFlowSolution(LiveVariablesProblem.NAME, null);
    }
}
TOP

Related Classes of org.jruby.ir.passes.LiveVariableAnalysis

TOP
Copyright © 2018 www.massapi.com. 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.