All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jruby.ir.passes.LiveVariableAnalysis Maven / Gradle / Ivy

There is a newer version: 9.4.9.0
Show newest version
package org.jruby.ir.passes;

import java.util.Arrays;
import java.util.List;

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

public class LiveVariableAnalysis extends CompilerPass {
    public static List> DEPENDENCIES = Arrays.>asList(CFGBuilder.class);

    @Override
    public String getLabel() {
        return "Live Variable Analysis";
    }

    @Override
    public List> getDependencies() {
        return DEPENDENCIES;
    }

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

    @Override
    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);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy