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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations