Package ch.epfl.labos.iu.orm.queryll2

Source Code of ch.epfl.labos.iu.orm.queryll2.CFG

/**
*
*/
package ch.epfl.labos.iu.orm.queryll2;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.analysis.Analyzer;
import org.objectweb.asm.tree.analysis.AnalyzerException;
import org.objectweb.asm.tree.analysis.BasicInterpreter;

class CFG
{
   List<Integer> succsOf(int from)
   {
      return fromto.get(from);
   }
  
   Map<Integer, List<Integer>> fromto = new HashMap<Integer, List<Integer>>();
   CFG(String internalName, MethodNode m) throws AnalyzerException
   {
      Analyzer a = new Analyzer(new BasicInterpreter()){
         @Override protected void newControlFlowEdge(final int insn, final int successor) {
            if (!fromto.containsKey(insn))
               fromto.put(insn, new Vector<Integer>());
            fromto.get(insn).add(successor);
         }
      };
   a.analyze(internalName, m);
   }
}
TOP

Related Classes of ch.epfl.labos.iu.orm.queryll2.CFG

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.