Search in sources :

Example 56 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class OptGCMapIterator method updateLocateRegisters.

@Override
protected void updateLocateRegisters() {
    // HIGH MEMORY
    // 
    // +------------------+
    // |  NVolGPR[n]      |
    // |     ...          |   k == info.getFirstNonVolatileGPR()
    // |  NVolGPR[k]      |  <-- info.getUnsignedNonVolatileOffset()
    // +------------------+
    // |  ScratchGPR[LAST]|
    // |     ...          |     only SaveVolatile Frames
    // | ScratchGPR[FIRST]|
    // +------------------+
    // |  VolGPR[LAST]    |
    // |     ...          |     only SaveVolatile Frames
    // |  VolGPR[FIRST]   |
    // +------------------+
    // 
    // LOW MEMORY
    int frameOffset = compiledMethod.getUnsignedNonVolatileOffset();
    if (frameOffset >= 0) {
        // get to the nonVol area
        Address nonVolArea = framePtr.plus(frameOffset);
        // update non-volatiles that were saved
        int first = compiledMethod.getFirstNonVolatileGPR();
        if (first >= 0) {
            // move to the beginning of the save area for nonvolatiles
            Address location = nonVolArea;
            for (int i = first; i <= LAST_GCMAP_REG; i++) {
                registerLocations.set(i, location);
                location = location.plus(BYTES_IN_ADDRESS);
            }
        }
        // update volatiles if needed
        if (compiledMethod.isSaveVolatile()) {
            // move to the beginning of the save area for volatiles
            Address location = nonVolArea.minus(SAVE_VOL_SIZE);
            // Walk the saved volatiles, updating registerLocations array
            for (int i = FIRST_VOLATILE_GPR.value(); i <= LAST_VOLATILE_GPR.value(); i++) {
                registerLocations.set(i, location);
                location = location.plus(BYTES_IN_ADDRESS);
            }
            // Walk the saved scratch, updating registerLocations array
            for (int i = FIRST_SCRATCH_GPR.value(); i <= LAST_SCRATCH_GPR.value(); i++) {
                registerLocations.set(i, location);
                location = location.plus(BYTES_IN_ADDRESS);
            }
        }
    }
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 57 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class RuntimeMeasurements method takeCBSCallSample.

/**
 * Called from Thread.yieldpoint when it is time to take a CBS call sample.
 *
 * @param whereFrom source of the yieldpoint (e.g. backedge)
 * @param yieldpointServiceMethodFP the frame pointer of the service
 *  method that is responsible for handling the yieldpoint
 */
@Uninterruptible
public static void takeCBSCallSample(int whereFrom, Address yieldpointServiceMethodFP) {
    // method that took yieldpoint
    Address ypTakenInFP = Magic.getCallerFramePointer(yieldpointServiceMethodFP);
    // Get the cmid for the method in which the yieldpoint was taken.
    int ypTakenInCMID = Magic.getCompiledMethodID(ypTakenInFP);
    // Get the cmid for that method's caller.
    Address ypTakenInCallerFP = Magic.getCallerFramePointer(ypTakenInFP);
    int ypTakenInCallerCMID = Magic.getCompiledMethodID(ypTakenInCallerFP);
    // Determine if ypTakenInCallerCMID corresponds to a real Java stackframe.
    // If one of the following conditions is detected, set ypTakenInCallerCMID to -1
    // Caller is out-of-line assembly (no RVMMethod object) or top-of-stack psuedo-frame
    // Caller is a native method
    CompiledMethod ypTakenInCM = CompiledMethods.getCompiledMethod(ypTakenInCMID);
    if (ypTakenInCallerCMID == StackFrameLayout.getInvisibleMethodID() || ypTakenInCM.getMethod().getDeclaringClass().hasBridgeFromNativeAnnotation()) {
    // drop sample
    } else {
        // Notify all registered listeners
        for (ContextListener listener : cbsContextListeners) {
            if (listener.isActive()) {
                listener.update(ypTakenInFP, whereFrom);
            }
        }
    }
}
Also used : ContextListener(org.jikesrvm.adaptive.measurements.listeners.ContextListener) Address(org.vmmagic.unboxed.Address) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 58 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class LinearSpaceDriver method scan.

/**
 * Update the tile statistics
 * @param obj The current object
 * @param total Whether to accumulate the values
 */
@Override
public void scan(ObjectReference obj, boolean total) {
    boolean isArray = VM.objectModel.isArray(obj);
    int length = VM.objectModel.getCurrentSize(obj);
    Address addr = obj.toAddress();
    if (VM.VERIFY_ASSERTIONS) {
        if (addr.LT(lastAddress.plus(lastSize))) {
            Log.write("\nContiguousSpaceDriver finds addresses going backwards: ");
            Log.write("last=", lastAddress);
            Log.write(" last size=", lastSize);
            Log.writeln(" current=", addr);
        }
        lastAddress = addr;
        lastSize = length;
    }
    // Update the stats
    if (subspace.addressInRange(addr)) {
        int index = subspace.getIndex(addr);
        int remainder = subspace.spaceRemaining(addr);
        if (isArray) {
            arrayObjectsStream.increment(index, (short) 1);
            arrayUsedSpaceStream.distribute(index, remainder, blockSize, length);
            if (total) {
                totalArrayObjects++;
                totalArrayUsedSpace += length;
            }
        } else {
            if (!this.scanCheckPrimitiveArray(obj, index, total, length)) {
                // real object
                scalarObjectsStream.increment(index, (short) 1);
                if (total) {
                    totalScalarObjects++;
                    totalScalarUsedSpace += length;
                }
            }
            scalarUsedSpaceStream.distribute(index, remainder, blockSize, length);
        }
    }
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 59 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class FreeListPageResource method allocateContiguousChunks.

/**
 * Allocate sufficient contiguous chunks within a discontiguous region to
 * satisfy the pending request.  Note that this is purely about address space
 * allocation within a discontiguous region.  This method does not reserve
 * individual pages, it merely assigns a suitably large region of virtual
 * memory from within the discontiguous region for use by a particular space.
 *
 * @param pages The number of pages currently being requested
 * @return A chunk number or GenericFreelist.FAILURE
 */
private int allocateContiguousChunks(int pages) {
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(metaDataPagesPerRegion == 0 || pages <= PAGES_IN_CHUNK - metaDataPagesPerRegion);
    int rtn = GenericFreeList.FAILURE;
    int requiredChunks = Space.requiredChunks(pages);
    Address region = space.growDiscontiguousSpace(requiredChunks);
    if (VERBOSE) {
        Log.write("flpr.allocateContiguousChunks(", pages);
        Log.writeln("): region=", region);
    }
    if (!region.isZero()) {
        int regionStart = Conversions.bytesToPages(region.diff(start));
        int regionEnd = regionStart + (requiredChunks * PAGES_IN_CHUNK) - 1;
        freeList.setUncoalescable(regionStart);
        freeList.setUncoalescable(regionEnd + 1);
        for (int p = regionStart; p < regionEnd; p += PAGES_IN_CHUNK) {
            int liberated;
            if (p != regionStart)
                freeList.clearUncoalescable(p);
            // add chunk to our free list
            liberated = freeList.free(p, true);
            if (liberated != PAGES_IN_CHUNK + (p - regionStart)) {
                Log.write("flpr: liberated ", liberated);
                Log.write(" pages, expected ");
                Log.writeln(PAGES_IN_CHUNK + (p - regionStart));
            }
            if (VM.VERIFY_ASSERTIONS)
                VM.assertions._assert(liberated == PAGES_IN_CHUNK + (p - regionStart));
            if (metaDataPagesPerRegion > 1) {
                // carve out space for metadata
                freeList.alloc(metaDataPagesPerRegion, p);
            }
            pagesCurrentlyOnFreeList += PAGES_IN_CHUNK - metaDataPagesPerRegion;
        }
        // re-do the request which triggered this call
        rtn = freeList.alloc(pages);
    }
    return rtn;
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 60 with Address

use of org.vmmagic.unboxed.Address 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)

Aggregations

Address (org.vmmagic.unboxed.Address)281 Offset (org.vmmagic.unboxed.Offset)48 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)30 NoInline (org.vmmagic.pragma.NoInline)30 Test (org.junit.Test)24 Entrypoint (org.vmmagic.pragma.Entrypoint)22 TypeReference (org.jikesrvm.classloader.TypeReference)21 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)17 RVMType (org.jikesrvm.classloader.RVMType)16 Inline (org.vmmagic.pragma.Inline)15 Uninterruptible (org.vmmagic.pragma.Uninterruptible)14 Word (org.vmmagic.unboxed.Word)14 BaseMMTkTest (org.mmtk.harness.tests.BaseMMTkTest)13 Unpreemptible (org.vmmagic.pragma.Unpreemptible)12 ObjectReference (org.vmmagic.unboxed.ObjectReference)12 Interruptible (org.vmmagic.pragma.Interruptible)11 Extent (org.vmmagic.unboxed.Extent)11 RVMClass (org.jikesrvm.classloader.RVMClass)9 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)8