Package kilim.analysis

Examples of kilim.analysis.MethodFlow


    public void testNumFlows() {
        assertEquals(getFlows().size(), 8);
    }

    private void checkSize(String methodName, int expectedSize) {
        MethodFlow f = getFlow(methodName);
        if (f == null)
            return;
        if (f.getBasicBlocks().size() != expectedSize) {
            fail("Method " + methodName + ": expected flow size = "
                    + expectedSize + ", instead got "
                    + f.getBasicBlocks().size());
        }
    }
View Full Code Here


        }
    }

    protected MethodFlow getFlow(String methodName) {
        for (int i = 0; i < stflows.size(); i++) {
            MethodFlow flow = stflows.get(i);
            if (flow.name.equals(methodName)) {
                return flow;
            }
        }
        fail("No method called " + methodName);
View Full Code Here

    protected ArrayList<MethodFlow> getFlows() {
        return stflows;
    }

    protected void checkCov(String methodName) {
        MethodFlow flow = getFlow(methodName);
        if (flow == null)
            return;
        ArrayList<BasicBlock> bbs = flow.getBasicBlocks();
        // Verify that all instructions are covered and that the only ones that
        // aren't are labelnodes. Also verify that there are no overlaps.
        int size = flow.instructions.size();
        boolean coverage[] = new boolean[size];
        for (int i = 0; i < size; i++) {
View Full Code Here

    public void testNumFlows() {
        assertEquals(getFlows().size(), 7);
    }

    private void checkSize(String methodName, int expectedSize) {
        MethodFlow f = getFlow(methodName);
        if (f == null)
            return;
        if (f.getBasicBlocks().size() != expectedSize) {
            fail("Method " + methodName + ": expected flow size = "
                    + expectedSize + ", instead got "
                    + f.getBasicBlocks().size());
        }
    }
View Full Code Here

    protected void setUp() throws Exception {
        cache("kilim.test.ex.ExFlow");
    }

    public void testMerge() throws IncompatibleTypesException {
        MethodFlow flow = getFlow("loop");
        if (flow == null)
            return;
        // Make sure the merging is fine. There used to be a bug
        assertEquals("Lkilim/test/ex/ExA;", TypeDesc.mergeType("Lkilim/test/ex/ExC;", "Lkilim/test/ex/ExD;"));
        assertEquals("Lkilim/test/ex/ExA;", TypeDesc.mergeType("Lkilim/test/ex/ExD;", "Lkilim/test/ex/ExC;"));
View Full Code Here

        assertEquals("Lkilim/test/ex/ExFlow;", f.getStack(1).getTypeDesc());
        assertEquals("Lkilim/test/ex/ExA;", f.getStack(2).getTypeDesc());
    }

    public void testConstants() throws IncompatibleTypesException {
        MethodFlow flow = getFlow("loop");
        if (flow == null)
            return;
        BasicBlock bb = getBBForMethod(flow, "join");
        Frame f = bb.startFrame;
        assertSame(f.getLocal(2).getConstVal(), Value.NO_VAL);
View Full Code Here

            fail("Please use jasmin to compile " + className);
        } catch (VerifyError e) {
            fail("Verification error for " + className + ": " + e.getMessage());
        }
        cache(className);
        MethodFlow flow = getFlow("simpleJSR");
        assertEquals(3, flow.getBasicBlocks().size());
        flow = getFlow("pausableJSR1");
//        System.out.println(flow.getBasicBlocks());
        assertEquals(4, flow.getBasicBlocks().size());

        flow = getFlow("pausableJSR2");
        ArrayList<BasicBlock> bbs = flow.getBasicBlocks();
        assertEquals(7, bbs.size());
       
        // make sure the blocks are unique
        int flag = 1 << 12;
        for (BasicBlock bb: bbs) {
View Full Code Here

    protected void setUp() throws Exception {
        cache("kilim.test.ex.ExFrame");
    }

    public void testMethodFrame() {
        MethodFlow flow = getFlow("kitchensink");
        if (flow == null)
            return;
        for (BasicBlock bb : flow.getBasicBlocks()) {
            if (bb.startPos == 0) {
                Frame f = bb.startFrame;
                assertEquals("Lkilim/test/ex/ExFrame;", f.getLocal(0).getTypeDesc());
                assertSame(D_INT, f.getLocal(1).getTypeDesc());
                assertSame(D_LONG, f.getLocal(2).getTypeDesc());
View Full Code Here

        }
    }

    protected MethodFlow getFlow(String methodName) {
        for (int i = 0; i < stflows.size(); i++) {
            MethodFlow flow = stflows.get(i);
            if (flow.name.equals(methodName)) {
                return flow;
            }
        }
        fail("No method called " + methodName);
View Full Code Here

    protected ArrayList<MethodFlow> getFlows() {
        return stflows;
    }

    protected void checkCov(String methodName) {
        MethodFlow flow = getFlow(methodName);
        if (flow == null)
            return;
        ArrayList<BasicBlock> bbs = flow.getBasicBlocks();
        // Verify that all instructions are covered and that the only ones that
        // aren't are labelnodes. Also verify that there are no overlaps.
        List instructions = flow.instructions;
        int size = instructions.size();
        boolean coverage[] = new boolean[size];
View Full Code Here

TOP

Related Classes of kilim.analysis.MethodFlow

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.