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

org.jruby.ir.dataflow.analyses.LoadLocalVarPlacementProblem Maven / Gradle / Ivy

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

import org.jruby.ir.dataflow.DataFlowProblem;
import org.jruby.ir.dataflow.FlowGraphNode;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.LocalVariable;
import org.jruby.ir.representations.BasicBlock;

import java.util.Map;
import java.util.Set;

public class LoadLocalVarPlacementProblem extends DataFlowProblem {
    public LoadLocalVarPlacementProblem() { 
        super(DataFlowProblem.DF_Direction.BACKWARD);
        initLoadsOnExit = new java.util.HashSet();
        bindingHasEscaped = false;
    }

    public String getName() {
        return "Binding Loads Placement Analysis";
    }
    
    public FlowGraphNode buildFlowGraphNode(BasicBlock bb) {
        return new LoadLocalVarPlacementNode(this, bb);
    }
    
    @Override
    public String getDataFlowVarsForOutput() {
        return "";
    }
    
    public void initLoadsOnScopeExit(Set loads) {
        initLoadsOnExit = loads;
    }
    
    public Set getLoadsOnScopeExit() {
        return initLoadsOnExit;
    }
    
    public boolean bindingHasEscaped() {
        return bindingHasEscaped;
    }
    
    public void setBindingHasEscaped(boolean flag) {
        bindingHasEscaped = flag;
    }

    public void addLoads(Map varRenameMap) {
        for (FlowGraphNode n: flowGraphNodes) {
            LoadLocalVarPlacementNode blpn = (LoadLocalVarPlacementNode)n;
            blpn.addLoads(varRenameMap);
        }
    }

    private Set initLoadsOnExit;
    
    // Has this method's (or the containing method's binding in the case of a closure) binding escaped?
    private boolean bindingHasEscaped;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy