Package kilim.analysis

Examples of kilim.analysis.Usage


                Frame f = bb.startFrame;
                pn(f.toString());
                dedent(2);
                pn("Live locals:");
                indent(2);
                Usage u = bb.getVarUsage();
                pn(u.toString());
                dedent(2);
                pn("Actual usage: " + uniqueItems(bb, f, u, n));
                dedent(2);
            }
        }
View Full Code Here


public class TestUsage extends TestCase {
    /**
     * Tests whether a bunch of reads and writes produces the appropriate live-in
     */
    public void testReadWrite() {
        Usage u = new Usage(4);
        u.read(1);
        u.read(2);
        u.write(2);
        u.write(3);
        u.evalLiveIn(new ArrayList<Usage>());
        assertFalse(u.isLiveIn(0));
        assertTrue(u.isLiveIn(1));
        assertTrue(u.isLiveIn(2));
        assertFalse(u.isLiveIn(3));
    }
View Full Code Here

        assertTrue(u.isLiveIn(2));
        assertFalse(u.isLiveIn(3));
    }
   
    public void testChange() {
        Usage u = new Usage(31);
        Usage ufollow1 = new Usage(31);
        Usage ufollow2 = new Usage(31);
        //       29:R
        //       30:W
        // Usage 1 and 2.
        //   28:in    28:not_in
        //   29:in    29:not_in
        //   30:in    30:in
        // Expected usage.in :  28:in 29:in 30:not_in
        u.read(29); u.write(30);
        ufollow1.setLiveIn(28); ufollow1.setLiveIn(29); ufollow1.setLiveIn(30);
        ufollow2.setLiveIn(30);
        ArrayList<Usage> ua = new ArrayList<Usage>(2);
        ua.add(ufollow1); ua.add(ufollow2);
        assertTrue(u.evalLiveIn(ua)); // should return changed == true
        for (int i = 0; i < 28; i++) {
            assertFalse(u.isLiveIn(i));
View Full Code Here

                Frame f = bb.startFrame;
                pn(f.toString());
                dedent(2);
                pn("Live locals:");
                indent(2);
                Usage u = bb.getVarUsage();
                pn(u.toString());
                dedent(2);
                pn("Actual usage: " + uniqueItems(bb, f, u, n));
                dedent(2);
            }
        }
View Full Code Here

        Frame g = new Frame(4, 4);
        g.setLocal(1, Value.make(0, D_INT));
        g.setLocal(2, Value.make(0, "[Ljava/lang/Object;"));
        g.setLocal(3, Value.make(0, "Ljava/lang/reflect/Field;"));
        g.push(Value.make(0, "Ljava/io/Serializable;"));
        Usage usage = new Usage(4);
        usage.setLiveIn(1);
        usage.setLiveIn(2);
        usage.setLiveIn(3);
        assertEquals(f, f.merge(g, /* localsOnly= */false, usage));
    }
View Full Code Here

        g.setLocal(0, Value.make(0, D_INT));
        g.setLocal(1, Value.make(0, "Ljava/lang/reflect/AccessibleObject;"));
        g.setLocal(2, Value.make(0, "[Ljava/lang/Object;"));
        g.push(Value.make(0, "Ljava/lang/Object;"));

        Usage usage = new Usage(4);
        for (int i = 0; i < 4; i++)
            usage.setLiveIn(i);
        Frame h = f.merge(g, /* localsOnly= */false, usage);
        assertNotSame(f, h);
        for (int i = 0; i < 4; i++) {
            assertEquals(g.getLocal(i), h.getLocal(i));
        }
View Full Code Here

        Frame g = new Frame(4, 4);
        g.setLocal(0, Value.make(0, D_INT));
        g.setLocal(1, Value.make(0, D_DOUBLE));
        g.setLocal(3, Value.make(0, D_THROWABLE));

        Usage noUsage = new Usage(4); // default, everything is untouched.
        assertSame(f, f.merge(g, /* localsOnly= */true, noUsage));

        for (int i = 0; i < 4; i++) {
            noUsage.write(i); // set everything to OVERWRITTEN
        }
        assertSame(f, f.merge(g, /* localsOnly= */true, noUsage));
    }
View Full Code Here

        Frame f = new Frame(4, 4);
        f.setLocal(0, Value.make(0, D_OBJECT));
        Frame g = new Frame(4, 4);
        g.setLocal(0, Value.make(0, D_INT));

        Usage usage = new Usage(4);
        for (int i = 0; i < 4; i++) {
            usage.setLiveIn(i); // set everything to READ
        }
        f = f.merge(g, true, usage);
        assertTrue(f.getLocal(0).getTypeDesc() == D_UNDEFINED);
    }
View Full Code Here

TOP

Related Classes of kilim.analysis.Usage

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.