Package org.objectweb.asm.tree.analysis

Examples of org.objectweb.asm.tree.analysis.Analyzer$Subroutine


                // Analyzer does not initialize some frames before newControlFlowExceptionEdge
                // is called, so remember the edges for later use.
                final ArrayList<Integer> edgeInsns = new ArrayList<Integer>();
                final ArrayList<Integer> edgeSuccessors = new ArrayList<Integer>();
               
                Analyzer a = new Analyzer(new IsNullInterpreter()) {
                    @Override protected Frame newFrame(int nLocals, int nStack) {
                        return new Node(nLocals, nStack);
                    }
                    @Override protected Frame newFrame(Frame src) {
                        return new Node(src);
                    }
                    @Override protected void newControlFlowEdge(int insn, int successor) {
                        edgeInsns.add(insn);
                        edgeSuccessors.add(successor);
                    }
                    @Override protected boolean newControlFlowExceptionEdge(int insn, int successor) {
                        newControlFlowEdge(insn, successor);
                        return true;
                    }
                };
               
                Frame[] frames;
                try {
                    frames = a.analyze(internalName, this);
                } catch (AnalyzerException e) {
                    throw new RuntimeException(e);
                }

                assert frames.length == instructions.size();

                // Use stored edges to build the graph.
                for (int i = 0; i < edgeInsns.size(); i++) {
                    int insn = edgeInsns.get(i);
                    int successor = edgeSuccessors.get(i);
                   
                    Node n = (Node)a.getFrames()[insn];
                    Node m = (Node)a.getFrames()[successor];
                    n.addSucc(m);
                    m.addPred(n);
                }
                edgeInsns.clear();
                edgeSuccessors.clear();
View Full Code Here


   }
  
   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);
   }
View Full Code Here

            MethodNode method = (MethodNode) methods.get(i);
            SimpleVerifier verifier = new SimpleVerifier(Type.getObjectType(cn.name),
                    syperType,
                    interfaces,
                    (cn.access | Opcodes.ACC_INTERFACE) != 0);
            Analyzer a = new Analyzer(verifier);
            if (loader != null) {
                verifier.setClassLoader(loader);
            }
            try {
                a.analyze(cn.name, method);
                if (!dump) {
                    continue;
                }
            } catch (Exception e) {
                e.printStackTrace(pw);
View Full Code Here

        final MethodVisitor mv,
        final Map labels)
    {
        this(new MethodNode(access, name, desc, null, null) {
            public void visitEnd() {
                Analyzer a = new Analyzer(new BasicVerifier());
                try {
                    a.analyze("dummy", this);
                } catch (Exception e) {
                    if (e instanceof IndexOutOfBoundsException
                            && maxLocals == 0 && maxStack == 0)
                    {
                        throw new RuntimeException("Data flow checking option requires valid, non zero maxLocals and maxStack values.");
View Full Code Here

   }
  
   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);
   }
View Full Code Here

        this.db = db;
        this.className = className;
        this.mn = mn;

        try {
            Analyzer a = new TypeAnalyzer(db);
            this.frames = a.analyze(className, mn);
            this.lvarStack = mn.maxLocals;
            this.lvarResumed = mn.maxLocals + 1;
            this.lvarInvocationReturnValue = mn.maxLocals + 2;
            // this.lvarSuspendableCalled = (verifyInstrumentation ? mn.maxLocals + 3 : -1);
            this.firstLocal = ((mn.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC) ? 0 : 1;
View Full Code Here

        List methods = ca.methods;
        for (int i = 0; i < methods.size(); ++i) {
            MethodNode method = (MethodNode) methods.get(i);
            if (method.instructions.size() > 0) {
                Analyzer a = new Analyzer(new SimpleVerifier());
                try {
                    a.analyze(ca.name, method);
                    continue;
                } catch (Exception e) {
                    e.printStackTrace();
                }
                final Frame[] frames = a.getFrames();

                if (!failed) {
                    failed = true;
                    log("verifying of class " + clazz + " failed");
                }
View Full Code Here

        List methods = cn.methods;
        for (int i = 0; i < methods.size(); ++i) {
            MethodNode method = (MethodNode) methods.get(i);
            if (method.instructions.size() > 0) {
                Analyzer a = new Analyzer(new SimpleVerifier(Type.getType("L"
                        + cn.name + ";"),
                        Type.getType("L" + cn.superName + ";"),
                        (cn.access & Opcodes.ACC_INTERFACE) != 0));
                try {
                    a.analyze(cn.name, method);
                    if (!dump) {
                        continue;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                final Frame[] frames = a.getFrames();

                System.err.println(method.name + method.desc);
                TraceMethodVisitor mv = new TraceMethodVisitor() {
                    public void visitMaxs(
                        final int maxStack,
View Full Code Here

            MethodNode method = (MethodNode) methods.get(i);
            SimpleVerifier verifier = new SimpleVerifier(Type.getObjectType(cn.name),
                    syperType,
                    interfaces,
                    false);
            Analyzer a = new Analyzer(verifier);
            if (loader != null) {
                verifier.setClassLoader(loader);
            }
            try {
                a.analyze(cn.name, method);
                if (!dump) {
                    continue;
                }
            } catch (Exception e) {
                e.printStackTrace(pw);
View Full Code Here

        final MethodVisitor mv,
        final Map labels)
    {
        this(new MethodNode(access, name, desc, null, null) {
            public void visitEnd() {
                Analyzer a = new Analyzer(new BasicVerifier());
                try {
                    a.analyze("dummy", this);
                } catch (Exception e) {
                    e.printStackTrace();
                    StringWriter sw = new StringWriter();
                    PrintWriter pw = new PrintWriter(sw, true);
                    CheckClassAdapter.printAnalyzerResult(this, a, pw);
View Full Code Here

TOP

Related Classes of org.objectweb.asm.tree.analysis.Analyzer$Subroutine

Copyright © 2018 www.massapicom. 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.