Question

This is the related code fragment where I can't print out the values from valuebox. May I know what's the problem?

public GuaranteedDefsAnalysis(UnitGraph graph)
{
    super(graph);
    DominatorsFinder df = new MHGDominatorsFinder(graph);
    unitToGenerateSet = new HashMap<Unit, FlowSet>(graph.size() * 2 + 1, 0.7f);

    // pre-compute generate sets
    for(Iterator unitIt = graph.iterator(); unitIt.hasNext();){
        Unit s = (Unit) unitIt.next();
        FlowSet genSet = emptySet.clone();

        for(Iterator domsIt = df.getDominators(s).iterator(); domsIt.hasNext();){
            Unit dom = (Unit) domsIt.next();
            for(Iterator boxIt = dom.getDefBoxes().iterator(); boxIt.hasNext();){
                ValueBox box = (ValueBox) boxIt.next();
                box.getValue().toString(); // simply using toString does not work
                if(box.getValue() instanceof Local)
                    genSet.add(box.getValue(), genSet);
            }
        }

        unitToGenerateSet.put(s, genSet);
    }

    doAnalysis();
}

No correct solution

OTHER TIPS

Can you maybe rephrase your question? What do you mean by "does not work"? Did you forget to add the println statement maybe?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top