Search in sources :

Example 1 with Extent

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;
}
Also used : Word(org.vmmagic.unboxed.Word) Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) Extent(org.vmmagic.unboxed.Extent) Offset(org.vmmagic.unboxed.Offset)

Example 2 with Extent

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;
}
Also used : Callbacks(org.jikesrvm.runtime.Callbacks) Extent(org.vmmagic.unboxed.Extent) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 3 with Extent

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);
        }
    }
}
Also used : Address(org.vmmagic.unboxed.Address) Extent(org.vmmagic.unboxed.Extent)

Example 4 with Extent

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();
        }
    }
}
Also used : Extent(org.vmmagic.unboxed.Extent) Inline(org.vmmagic.pragma.Inline)

Example 5 with Extent

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);
    }
}
Also used : Extent(org.vmmagic.unboxed.Extent)

Aggregations

Extent (org.vmmagic.unboxed.Extent)21 Address (org.vmmagic.unboxed.Address)11 Inline (org.vmmagic.pragma.Inline)3 Offset (org.vmmagic.unboxed.Offset)3 Test (org.junit.Test)2 BaseMMTkTest (org.mmtk.harness.tests.BaseMMTkTest)2 RawMemoryFreeList (org.mmtk.utility.RawMemoryFreeList)2 Interruptible (org.vmmagic.pragma.Interruptible)2 Word (org.vmmagic.unboxed.Word)2 Field (java.lang.reflect.Field)1 RVMField (org.jikesrvm.classloader.RVMField)1 RVMType (org.jikesrvm.classloader.RVMType)1 TypeReference (org.jikesrvm.classloader.TypeReference)1 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)1 DoubleConstantOperand (org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand)1 FloatConstantOperand (org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand)1 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)1 LongConstantOperand (org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand)1 NullConstantOperand (org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand)1 ObjectConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)1