use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class RawMemoryFreeListTest method testRawMemoryFreeListAddrAddrIntIntLarge.
@Test
public void testRawMemoryFreeListAddrAddrIntIntLarge() throws Throwable {
Thread t = new MMTkThread() {
@Override
public void run() {
new RawMemoryFreeList(baseAddress, mapLimit(ONE_MEG, 2), ONE_MEG, 2);
}
};
runMMTkThread(t);
}
use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class RawMemoryFreeListTest method testMulti.
@Test
public void testMulti() throws Throwable {
Thread t = new MMTkThread() {
@Override
public void run() {
RawMemoryFreeList fl = new RawMemoryFreeList(baseAddress, mapLimit(ONE_MEG, 32), 1024, 8, 1);
fl.growFreeList(0);
fl.dbgPrintSummary();
fl.dbgPrintDetail();
fl.dbgPrintFree();
fl.growFreeList(16);
fl.dbgPrintDetail();
fl.dbgPrintFree();
assertEquals("initial 8-unit allocation", 0, fl.alloc(8));
fl.dbgPrintDetail();
fl.dbgPrintFree();
for (int i = 8; i < 16; i++) {
assertEquals("following 1-unit allocation", i, fl.alloc(1));
}
fl.dbgPrintDetail();
fl.dbgPrintFree();
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 growFreeListMultiBlock.
protected void growFreeListMultiBlock(final int units, final int grain, final int heads, final int size) throws Throwable {
Thread t = new MMTkThread() {
int unit = 0;
boolean[] allocated = new boolean[units];
RawMemoryFreeList fl;
@Override
public void run() {
int blockSize = RawMemoryFreeList.defaultBlockSize(units, heads);
int mapSize = RawMemoryFreeList.sizeInPages(units, heads);
if (VERBOSE)
System.out.printf("growFreeListMultiBlock: blockSize=%d mapSize=%d%n", blockSize, mapSize);
mapSize += mapSize % blockSize == 0 ? 0 : blockSize - mapSize % blockSize;
fl = new RawMemoryFreeList(baseAddress, baseAddress.plus(Conversions.pagesToBytes(mapSize)), blockSize, units, grain, heads);
fl.dbgPrintSummary();
for (int i = 0; i < units; i++) {
allocated[i] = false;
}
fl.dbgPrintSummary();
fl.growFreeList(units);
for (int i = 0; i < units / size; i++) {
assertNotEquals("allocation failure at unit " + unit, GenericFreeList.FAILURE, allocate());
}
assertEquals("Free list should be exhausted at unit " + unit, -1, allocate());
fl.dbgPrintSummary();
for (int i = 0; i < units; i += size) {
assertTrue("Unit " + (i + 1) + " is not allocated", allocated[i]);
}
}
protected long allocate() {
unit += size;
long block = fl.alloc(size);
if (block == -1) {
return block;
}
assertFalse("Allocated same block twice, " + block, allocated[(int) block]);
allocated[(int) block] = true;
return block;
}
};
runMMTkThread(t);
}
use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class RawMemoryFreeListTest method testRawMemoryFreeListAddrAddrIntIntEmpty.
@Test
public void testRawMemoryFreeListAddrAddrIntIntEmpty() throws Throwable {
Thread t = new MMTkThread() {
@Override
public void run() {
new RawMemoryFreeList(baseAddress, baseAddress.plus(PAGE_SIZE), 0, 1);
}
};
runMMTkThread(t);
}
use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class RawMemoryFreeListTest method testGenericFreeListIntIntInt.
@Test
public void testGenericFreeListIntIntInt() throws Throwable {
Thread t = new MMTkThread() {
@Override
public void run() {
new RawMemoryFreeList(baseAddress, mapLimit(1024, 1), 1024, 1, 1);
}
};
runMMTkThread(t);
}
Aggregations