Search in sources :

Example 21 with MMTkThread

use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.

the class FreeListTests method testAlloc4.

/**
 * Allocate and free units, ensuring that the allocator correctly coalesces adjacent units
 */
@Test
public void testAlloc4() throws Throwable {
    Thread t = new MMTkThread() {

        public void run() {
            GenericFreeList fl = createFreeList(4, 2, 32);
            assertEquals(0, fl.alloc(1));
            assertEquals(1, fl.alloc(1));
            assertEquals(2, fl.alloc(1));
            assertEquals(3, fl.alloc(1));
            assertEquals(-1, fl.alloc(1));
            fl.free(1);
            fl.free(0);
            assertEquals(0, fl.alloc(2));
            assertEquals(-1, fl.alloc(1));
        }
    };
    runMMTkThread(t);
}
Also used : MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test)

Example 22 with MMTkThread

use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.

the class FreeListTests method testAlloc.

/**
 * Sequentially alloc single units until the list is free
 * @throws Throwable
 * @throws InterruptedException
 */
@Test
public void testAlloc() throws Throwable {
    Thread t = new MMTkThread() {

        public void run() {
            GenericFreeList fl = createFreeList(4, 2, 2);
            assertEquals(0, fl.alloc(1));
            assertEquals(1, fl.alloc(1));
            assertEquals(2, fl.alloc(1));
            assertEquals(3, fl.alloc(1));
            assertEquals(-1, fl.alloc(1));
        }
    };
    runMMTkThread(t);
}
Also used : MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test)

Example 23 with MMTkThread

use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.

the class RawMemoryFreeListTest method testMulti2.

@Test
public void testMulti2() throws Throwable {
    Thread t = new MMTkThread() {

        @Override
        public void run() {
            RawMemoryFreeList fl = new RawMemoryFreeList(baseAddress, mapLimit(ONE_MEG, 1), 1024, 1024, 1);
            fl.resizeFreeList();
            int blockSize = 16;
            for (int block = 0; block < 4; block++) {
                fl.growFreeList(blockSize);
                int offset = block * blockSize;
                fl.setUncoalescable(offset);
                fl.setUncoalescable(offset + blockSize);
                assertEquals("initial 8-unit allocation", offset, fl.alloc(8, offset));
                for (int i = offset + 8; i < offset + blockSize; i++) {
                    assertEquals("following 1-unit allocation", i, fl.alloc(1));
                }
                assertEquals("list should be empty", -1, fl.alloc(1));
            }
        }
    };
    runMMTkThread(t);
}
Also used : MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test)

Example 24 with MMTkThread

use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.

the class RawMemoryFreeListTest method testGenericFreeListIntLarge.

@Test
public void testGenericFreeListIntLarge() throws Throwable {
    Thread t = new MMTkThread() {

        @Override
        public void run() {
            new RawMemoryFreeList(baseAddress, mapLimit(ONE_MEG, 1), ONE_MEG);
        }
    };
    runMMTkThread(t);
}
Also used : MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test)

Example 25 with MMTkThread

use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.

the class RawMemoryFreeListTest method testGenericFreeListIntSmall.

@Test
public void testGenericFreeListIntSmall() throws Throwable {
    Thread t = new MMTkThread() {

        @Override
        public void run() {
            new RawMemoryFreeList(baseAddress, mapLimit(1024, 1), 1024);
        }
    };
    runMMTkThread(t);
}
Also used : MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test)

Aggregations

MMTkThread (org.mmtk.harness.scheduler.MMTkThread)29 Test (org.junit.Test)25 BaseMMTkTest (org.mmtk.harness.tests.BaseMMTkTest)7 Address (org.vmmagic.unboxed.Address)6 ArrayList (java.util.ArrayList)1 WatchAddress (org.mmtk.harness.options.WatchAddress)1 Factory (org.mmtk.harness.vm.Factory)1 Extent (org.vmmagic.unboxed.Extent)1