Examples of ControlFlowGraph


Examples of org.apache.bcel.verifier.structurals.ControlFlowGraph

            currentMethodStatic = methods[i].isStatic();
            if (isValid(method)) {
                // analyse the code of the method to create the frame
                // information about every instruction
                ControlFlowGraph cfg = new ControlFlowGraph(method);
                analyse(clazz, method, cfg, icv, ev);
                // add intercepting code
                rewrite(method, cfg);
                // make last optional check for consistency
                clazz.replaceMethod(methods[i], method.getMethod());
View Full Code Here

Examples of org.aspectj.apache.bcel.verifier.structurals.ControlFlowGraph

            // //////////// DFA BEGINS HERE ////////////////
            if (!(mg.isAbstract() || mg.isNative())) { // IF mg HAS CODE (See
                // pass 2)

                ControlFlowGraph cfg = new ControlFlowGraph(mg);

                // Build the initial frame situation for this method.
                Frame f = new Frame(mg.getMaxLocals(), mg.getMaxStack());
                if (!mg.isStatic()) {
                    if (mg.getName().equals(Constants.CONSTRUCTOR_NAME)) {
                        Frame._this = new UninitializedObjectType(new ObjectType(jc.getClassName()));
                        f.getLocals().set(0, Frame._this);
                    } else {
                        Frame._this = null;
                        f.getLocals().set(0, new ObjectType(jc.getClassName()));
                    }
                }
                Type[] argtypes = mg.getArgumentTypes();
                int twoslotoffset = 0;
                for (int j = 0; j < argtypes.length; j++) {
                    if (argtypes[j] == Type.SHORT || argtypes[j] == Type.BYTE
                            || argtypes[j] == Type.CHAR
                            || argtypes[j] == Type.BOOLEAN)
                    {
                        argtypes[j] = Type.INT;
                    }
                    f.getLocals().set(twoslotoffset + j
                            + (mg.isStatic() ? 0 : 1),
                            argtypes[j]);
                    if (argtypes[j].getSize() == 2) {
                        twoslotoffset++;
                        f.getLocals().set(twoslotoffset + j
                                + (mg.isStatic() ? 0 : 1),
                                Type.UNKNOWN);
                    }
                }
                circulationPump(cfg, cfg.contextOf(mg.getInstructionList()
                        .getStart()), f, icv, ev);
            }
        } catch (VerifierConstraintViolatedException ce) {
            ce.extendMessage("Constraint violated in method '"
                    + methods[method_no] + "':\n", "");
View Full Code Here

Examples of org.aspectj.apache.bcel.verifier.structurals.ControlFlowGraph

            // //////////// DFA BEGINS HERE ////////////////
            if (!(mg.isAbstract() || mg.isNative())) { // IF mg HAS CODE (See
                // pass 2)

                ControlFlowGraph cfg = new ControlFlowGraph(mg);

                // Build the initial frame situation for this method.
                Frame f = new Frame(mg.getMaxLocals(), mg.getMaxStack());
                if (!mg.isStatic()) {
                    if (mg.getName().equals(Constants.CONSTRUCTOR_NAME)) {
                        Frame._this = new UninitializedObjectType(new ObjectType(jc.getClassName()));
                        f.getLocals().set(0, Frame._this);
                    } else {
                        Frame._this = null;
                        f.getLocals().set(0, new ObjectType(jc.getClassName()));
                    }
                }
                Type[] argtypes = mg.getArgumentTypes();
                int twoslotoffset = 0;
                for (int j = 0; j < argtypes.length; j++) {
                    if (argtypes[j] == Type.SHORT || argtypes[j] == Type.BYTE
                            || argtypes[j] == Type.CHAR
                            || argtypes[j] == Type.BOOLEAN)
                    {
                        argtypes[j] = Type.INT;
                    }
                    f.getLocals().set(twoslotoffset + j
                            + (mg.isStatic() ? 0 : 1),
                            argtypes[j]);
                    if (argtypes[j].getSize() == 2) {
                        twoslotoffset++;
                        f.getLocals().set(twoslotoffset + j
                                + (mg.isStatic() ? 0 : 1),
                                Type.UNKNOWN);
                    }
                }
                circulationPump(cfg, cfg.contextOf(mg.getInstructionList()
                        .getStart()), f, icv, ev);
            }
        } catch (VerifierConstraintViolatedException ce) {
            ce.extendMessage("Constraint violated in method '"
                    + methods[method_no] + "':\n", "");
View Full Code Here

Examples of org.checkerframework.dataflow.cfg.ControlFlowGraph

        "Method to analyze must have a body. Method passed in: %s() in file %s",
        method.getName(),
        methodPath.getCompilationUnit().getSourceFile().getName());

    final ProcessingEnvironment env = JavacProcessingEnvironment.instance(context);
    final ControlFlowGraph cfg = cfgCache.getUnchecked(new CFGParams(methodPath, env));
    final AnalysisParams aparams = new AnalysisParams(transfer, cfg, env);
    @SuppressWarnings("unchecked")
    final Analysis<A, S, T> analysis = (Analysis<A, S, T>) analysisCache.getUnchecked(aparams);

    return new Result<A, S, T>() {
View Full Code Here

Examples of org.jnode.vm.bytecode.ControlFlowGraph

                        bcv = new VerifyingCompilerBytecodeVisitor<CompilerBytecodeVisitor>(bcv);
                    }
                    // Get the bytecode
                    final VmByteCode bc = method.getBytecode();
                    // Create the control flow graph
                    ControlFlowGraph cfg = (ControlFlowGraph) bc.getCompilerData();
                    if (cfg == null) {
                        cfg = new ControlFlowGraph(bc);
                        bc.setCompilerData(cfg);
                    }
                    // Compile the code 1 basic block at a time
                    final CompilerBytecodeParser parser = new CompilerBytecodeParser(bc, cfg, bcv);
                    bcv.startMethod(method);
View Full Code Here

Examples of org.jnode.vm.bytecode.ControlFlowGraph

        final VmByteCode bc = method.getBytecode();
        System.out.println("Method     " + method);
        System.out.println("MaxStack   " + bc.getMaxStack());
        System.out.println("#Locals    " + bc.getNoLocals());
        System.out.println("#Arg slots " + method.getArgSlotCount());
        final ControlFlowGraph cfg = new ControlFlowGraph(method.getBytecode());
        BytecodeParser.parse(method.getBytecode(), new BytecodeViewer(cfg));

        System.out.println();
    }
View Full Code Here

Examples of org.jnode.vm.bytecode.ControlFlowGraph

        if (inlineDepth > 1) {
            ibv.visit_nop();
        }

        // Create the control flow graph
        ControlFlowGraph cfg = (ControlFlowGraph) bc.getCompilerData();
        if (cfg == null) {
            cfg = new ControlFlowGraph(bc);
            bc.setCompilerData(cfg);
        }
        // Compile the code 1 basic block at a time
        final CompilerBytecodeParser parser = new CompilerBytecodeParser(bc,
            cfg, this);
View Full Code Here

Examples of org.renjin.compiler.cfg.ControlFlowGraph

public class SsaTransformTest extends CompilerTestCase {

  @Test
  public void cytronSsa() throws IOException {
    IRBody block = parseCytron();
    ControlFlowGraph cfg = new ControlFlowGraph(block);

    Iterable<BasicBlock> assignmentsToK = Iterables.filter(cfg.getBasicBlocks(),
        CfgPredicates.containsAssignmentTo(new EnvironmentVariable("K")));
   
    assertThat(Iterables.size(assignmentsToK), equalTo(3));
   
   
    DominanceTree dtree = new DominanceTree(cfg);
    System.out.println(dtree);
   
    SsaTransformer transformer = new SsaTransformer(cfg, dtree);
    transformer.transform();
   
    // See Figure 6 in
    // http://www.cs.utexas.edu/~pingali/CS380C/2010/papers/ssaCytron.pdf
   
   
    // just before branching in basic block #2,
    // we need phi functions for all 4 variables
   
    BasicBlock bb2 = cfg.getBasicBlocks().get(1);
    assertThat(bb2.getStatements().size(), equalTo(5));
  
    System.out.println(cfg);
  }
View Full Code Here

Examples of org.renjin.compiler.cfg.ControlFlowGraph

    IRBody block = buildScope("for(i in 1:10) { n<-x[i]; print(n); }");
   
    System.out.println(block);
   
   
    ControlFlowGraph cfg = new ControlFlowGraph(block);
   
  
    DominanceTree dtree = new DominanceTree(cfg);
   
    System.out.println("CFG:");
    System.out.println(cfg.getGraph());
   
    System.out.println("Dominance Tree:")
    System.out.println(dtree);
   
    SsaTransformer transformer = new SsaTransformer(cfg, dtree);
View Full Code Here

Examples of org.renjin.compiler.cfg.ControlFlowGraph

    IRFunctionTable functionTable = new IRFunctionTable();
    IRBody block = new IRBodyBuilder(functionTable).build(ast);

    System.out.println(block);
   
    final ControlFlowGraph cfg = new ControlFlowGraph(block);
  
    System.out.println(cfg);
   
   
    JFrame frame = new JFrame("Simple Graph View");
View Full Code Here
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.