use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class AbstractFragmentedMmapperTest method testEnsureMapped2.
@Test
public void testEnsureMapped2() throws Throwable {
Thread t = new MMTkThread() {
public void run() {
Mmapper m = new FragmentedMmapper();
Address base = Address.fromIntZeroExtend(0x80000000);
m.ensureMapped(base.minus(4096), 2);
base.minus(4096).loadWord();
base.loadWord();
base.plus(4095).loadWord();
}
};
runMMTkThread(t);
}
use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class AbstractFragmentedMmapperTest method testEnsureMapped3.
@Test
public void testEnsureMapped3() throws Throwable {
Thread t = new MMTkThread() {
public void run() {
Mmapper m = new FragmentedMmapper();
Address base = Address.fromIntZeroExtend(0xc0000000).minus(4096 * 2);
m.ensureMapped(base, 7);
for (int i = 0; i < 7; i++) {
base.plus(4096 * i).loadWord();
base.plus(4096 * i + 4095).loadWord();
}
}
};
runMMTkThread(t);
}
use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class AbstractFragmentedMmapperTest method testFragmentedMmapper.
@Test
public void testFragmentedMmapper() throws Throwable {
Thread t = new MMTkThread() {
public void run() {
new FragmentedMmapper();
}
};
runMMTkThread(t);
}
use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class AbstractFragmentedMmapperTest method testSlabIndex.
@Test
public void testSlabIndex() throws Throwable {
Thread t = new MMTkThread() {
public void run() {
FragmentedMmapper m = new FragmentedMmapper();
for (int i = 0; i < 16; i++) {
assertNotNull(m.slabTable(Address.fromIntZeroExtend(0x10000000 * i)));
}
}
};
runMMTkThread(t);
}
use of org.mmtk.harness.scheduler.MMTkThread in project JikesRVM by JikesRVM.
the class Harness method init.
/**
* Start up the harness, including creating the global plan and constraints,
* and starting off the collector threads.
*
* After calling this it is possible to begin creating mutator threads.
* @param args Command-line arguments
*/
public static void init(String... args) {
initialized = true;
/* Always use the harness factory */
System.setProperty("mmtk.hostjvm", Factory.class.getCanonicalName());
/* Options used for configuring the plan to use */
final ArrayList<String> newArgs = new ArrayList<String>();
for (String arg : args) {
if (!options.process(arg))
newArgs.add(arg);
}
/* If we're using the baseHeap mechanism, override initHeap and maxheap */
if (baseHeapSize() != 0 && initHeap.getPages() == initHeap.getDefaultPages()) {
applyHeapScaling();
}
trace.apply();
gcEvery.apply();
org.mmtk.harness.scheduler.Scheduler.init();
for (Address watchAddr : watchAddress.getAddresses()) {
System.err.printf("Setting watch at %s%n", watchAddr);
SimulatedMemory.addWatch(watchAddr);
}
/*
* Perform MMTk initialization in a minimal environment, specifically to
* give it a per-thread 'Log' object
*/
MMTkThread m = new MMTkThread() {
@Override
public void run() {
try {
/* Get MMTk breathing */
ActivePlan.init(PlanSpecificConfig.planClass(plan.getValue()));
/* Override some defaults */
Options.noFinalizer.setValue(true);
Options.variableSizeHeap.setValue(false);
/* Process command line options */
for (String arg : newArgs) {
if (!options.process(arg)) {
throw new RuntimeException("Invalid option '" + arg + "'");
}
}
ActivePlan.plan.enableAllocation();
if (org.mmtk.utility.options.Options.verbose.getValue() > 0) {
System.err.printf("[Harness] Configuring heap size [%4.2fMB..%4.2fMB]%n", initHeap.getBytes().toLong() / MB, maxHeap.getBytes().toLong() / MB);
}
HeapGrowthManager.boot(initHeap.getBytes(), maxHeap.getBytes());
/* Check options */
assert Options.noFinalizer.getValue() : "noFinalizer must be true";
/* Finish starting up MMTk */
ActivePlan.plan.processOptions();
ActivePlan.plan.enableCollection();
ActivePlan.plan.fullyBooted();
checkSpaces();
Log.flush();
} catch (Throwable e) {
e.printStackTrace();
Main.exitWithFailure();
}
}
};
m.start();
try {
m.join();
} catch (InterruptedException e) {
}
org.mmtk.harness.scheduler.Scheduler.initCollectors();
for (int value : watchObject.getValue()) {
System.out.printf("Setting watch for object %d%n", value);
org.mmtk.harness.vm.ObjectModel.watchObject(value);
}
/* Add exit handler to print yield stats */
if (policyStats.getValue()) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
AbstractPolicy.printStats();
}
});
}
}
Aggregations