Search in sources :

Example 16 with MMTkThread

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

the class AbstractSpaceDescriptorTest method testCreateDescriptorAddressAddress.

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

        public void run() {
            Extent chunkSize = Extent.fromLong(1L << VMLayoutConstants.LOG_BYTES_IN_CHUNK);
            Extent increment = chunkSize.toWord().rshl(2).toExtent();
            Extent size = chunkSize;
            Address base = Address.zero().plus(chunkSize);
            while (size.LE(VMLayoutConstants.MAX_SPACE_EXTENT)) {
                int d = SpaceDescriptor.createDescriptor(base, base.plus(size));
                for (Address addr = base; addr.LT(base.plus(size)); addr = addr.plus(increment)) {
                    if (VERBOSE)
                        System.out.printf("Testing address %s in space (%s,%s)%n", addr, base, base.plus(size));
                    Assert.assertTrue("addr " + addr + ", bounds(" + base + "," + base.plus(size) + ")", Space.isInSpace(d, addr));
                }
                Assert.assertFalse(Space.isInSpace(d, base.minus(4)));
                Assert.assertFalse(Space.isInSpace(d, base.plus(size)));
                size = size.plus(size);
            }
        }
    };
    runMMTkThread(t);
}
Also used : Address(org.vmmagic.unboxed.Address) Extent(org.vmmagic.unboxed.Extent) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test) BaseMMTkTest(org.mmtk.harness.tests.BaseMMTkTest)

Example 17 with MMTkThread

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

the class AbstractFragmentedMmapperTest method testEnsureMapped4.

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

        public void run() {
            Mmapper m = new FragmentedMmapper();
            Address base = Address.fromIntZeroExtend(0x68cfb000);
            m.ensureMapped(base, 23);
            for (int i = 0; i < 23; i++) {
                Address page = base.plus(4096 * i);
                page.loadWord();
                page.plus(4095).loadWord();
            }
        }
    };
    runMMTkThread(t);
}
Also used : Address(org.vmmagic.unboxed.Address) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test) BaseMMTkTest(org.mmtk.harness.tests.BaseMMTkTest)

Example 18 with MMTkThread

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

the class AbstractFragmentedMmapperTest method testEnsureMapped1.

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

        public void run() {
            Mmapper m = new FragmentedMmapper();
            Address base = Address.fromIntZeroExtend(0x40000000);
            m.ensureMapped(base, 1);
            base.loadWord();
        }
    };
    runMMTkThread(t);
}
Also used : Address(org.vmmagic.unboxed.Address) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) MMTkThread(org.mmtk.harness.scheduler.MMTkThread) Test(org.junit.Test) BaseMMTkTest(org.mmtk.harness.tests.BaseMMTkTest)

Example 19 with MMTkThread

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

the class FreeListTests method testAlloc3.

/**
 * Allocate and free units, ensuring that the allocator correctly reallocates them.
 */
@Test
public void testAlloc3() 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);
            assertEquals(1, fl.alloc(1));
            fl.free(2);
            assertEquals(2, fl.alloc(1));
            assertEquals(-1, fl.alloc(1));
            fl.free(3);
            fl.free(0);
            assertEquals(0, 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 20 with MMTkThread

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

the class FreeListTests method testAlloc2.

/**
 * Sequentially alloc pairs of units until the list is free.
 */
@Test
public void testAlloc2() throws Throwable {
    Thread t = new MMTkThread() {

        public void run() {
            GenericFreeList fl = createFreeList(6, 2, 32);
            assertEquals(0, fl.alloc(2));
            assertEquals(2, fl.alloc(2));
            assertEquals(4, fl.alloc(2));
            assertEquals(-1, fl.alloc(2));
        }
    };
    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