use of org.vmmagic.unboxed.Extent in project JikesRVM by JikesRVM.
the class BootImageWriter method getWordValue.
private static Word getWordValue(Object addr, String msg, boolean warn) {
if (addr == null)
return Word.zero();
Word value = Word.zero();
if (addr instanceof Address) {
value = ((Address) addr).toWord();
} else if (addr instanceof ObjectReference) {
value = ((ObjectReference) addr).toAddress().toWord();
} else if (addr instanceof Word) {
value = (Word) addr;
} else if (addr instanceof Extent) {
value = ((Extent) addr).toWord();
} else if (addr instanceof Offset) {
value = ((Offset) addr).toWord();
} else {
say("Unhandled supposed address value: " + addr);
say(msg);
fail("incomplete boot image support");
}
if (warn)
check(value, msg);
return value;
}
use of org.vmmagic.unboxed.Extent in project JikesRVM by JikesRVM.
the class MemoryManager method boot.
/**
* Initialization that occurs at <i>boot</i> time (runtime
* initialization). This is only executed by one processor (the
* primordial thread).
* @param theBootRecord the boot record. Contains information about
* the heap size.
*/
@Interruptible
public static void boot(BootRecord theBootRecord) {
Extent pageSize = BootRecord.the_boot_record.bytesInPage;
org.jikesrvm.runtime.Memory.setPageSize(pageSize);
HeapLayout.mmapper.markAsMapped(BOOT_IMAGE_DATA_START, BOOT_IMAGE_DATA_SIZE);
HeapLayout.mmapper.markAsMapped(BOOT_IMAGE_CODE_START, BOOT_IMAGE_CODE_SIZE);
HeapGrowthManager.boot(theBootRecord.initialHeapSize, theBootRecord.maximumHeapSize);
DebugUtil.boot(theBootRecord);
Selected.Plan.get().enableAllocation();
SynchronizedCounter.boot();
Callbacks.addExitMonitor(new Callbacks.ExitMonitor() {
@Override
public void notifyExit(int value) {
Selected.Plan.get().notifyExit(value);
}
});
booted = true;
}
use of org.vmmagic.unboxed.Extent in project JikesRVM by JikesRVM.
the class FreeListPageResource method reserveMetaData.
/**
* Reserve virtual address space for meta-data.
*
* @param extent The size of this space
*/
private void reserveMetaData(Extent extent) {
highWaterMark = 0;
if (metaDataPagesPerRegion > 0) {
if (VM.VERIFY_ASSERTIONS)
VM.assertions._assert(start.toWord().rshl(EmbeddedMetaData.LOG_BYTES_IN_REGION).lsh(EmbeddedMetaData.LOG_BYTES_IN_REGION).toAddress().EQ(start));
Extent size = extent.toWord().rshl(EmbeddedMetaData.LOG_BYTES_IN_REGION).lsh(EmbeddedMetaData.LOG_BYTES_IN_REGION).toExtent();
Address cursor = start.plus(size);
while (cursor.GT(start)) {
cursor = cursor.minus(EmbeddedMetaData.BYTES_IN_REGION);
int unit = cursor.diff(start).toWord().rshl(LOG_BYTES_IN_PAGE).toInt();
int tmp = freeList.alloc(metaDataPagesPerRegion, unit);
pagesCurrentlyOnFreeList -= metaDataPagesPerRegion;
if (VM.VERIFY_ASSERTIONS)
VM.assertions._assert(tmp == unit);
}
}
}
use of org.vmmagic.unboxed.Extent in project JikesRVM by JikesRVM.
the class MonotonePageResource method releasePages.
/**
* Release all pages associated with this page resource, optionally
* zeroing on release and optionally memory protecting on release.
*/
@Inline
private void releasePages() {
if (contiguous) {
// TODO: We will perform unnecessary zeroing if the nursery size has decreased.
if (zeroConcurrent) {
// Wait for current zeroing to finish.
while (zeroingCursor.LT(zeroingSentinel)) {
}
}
// Reset zeroing region.
if (cursor.GT(zeroingSentinel)) {
zeroingSentinel = cursor;
}
zeroingCursor = start;
cursor = start;
currentChunk = Conversions.chunkAlign(start, true);
} else {
/* Not contiguous */
if (!cursor.isZero()) {
do {
Extent bytes = cursor.diff(currentChunk).toWord().toExtent();
releasePages(currentChunk, bytes);
} while (moveToNextChunk());
currentChunk = Address.zero();
sentinel = Address.zero();
cursor = Address.zero();
space.releaseAllChunks();
}
}
}
use of org.vmmagic.unboxed.Extent in project JikesRVM by JikesRVM.
the class Map32 method insert.
/**
**************************************************************************
*
* Map accesses and insertion
*/
/**
* Insert a space and its descriptor into the map, associating it
* with a particular address range.
*
* @param start The start address of the region to be associated
* with this space.
* @param extent The size of the region, in bytes
* @param descriptor The descriptor for this space
* @param space The space to be associated with this region
*/
@Override
public void insert(Address start, Extent extent, int descriptor, Space space) {
Extent e = Extent.zero();
while (e.LT(extent)) {
int index = getChunkIndex(start.plus(e));
if (descriptorMap[index] != 0) {
Log.write("Conflicting virtual address request for space \"");
Log.write(space.getName());
Log.write("\" at ");
Log.writeln(start.plus(e));
Space.printVMMap();
VM.assertions.fail("exiting");
}
descriptorMap[index] = descriptor;
VM.barriers.objectArrayStoreNoGCBarrier(spaceMap, index, space);
e = e.plus(VMLayoutConstants.BYTES_IN_CHUNK);
}
}
Aggregations