Search in sources :

Example 26 with Interruptible

use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.

the class Map32 method finalizeStaticSpaceMap.

/**
 * Finalize the space map, establishing which virtual memory
 * is nailed down, and then placing the rest into a map to
 * be used by discontiguous spaces.
 */
@Override
@Interruptible
public void finalizeStaticSpaceMap() {
    /* establish bounds of discontiguous space */
    Address startAddress = Space.getDiscontigStart();
    int firstChunk = getChunkIndex(startAddress);
    int lastChunk = getChunkIndex(Space.getDiscontigEnd());
    int unavailStartChunk = lastChunk + 1;
    int trailingChunks = VMLayoutConstants.MAX_CHUNKS - unavailStartChunk;
    int pages = (1 + lastChunk - firstChunk) * VMLayoutConstants.PAGES_IN_CHUNK;
    globalPageMap.resizeFreeList(pages, pages);
    for (int pr = 0; pr < sharedDiscontigFLCount; pr++) sharedFLMap[pr].resizeFreeList(startAddress);
    /* set up the region map free list */
    // block out entire bottom of address range
    int allocedChunk = regionMap.alloc(firstChunk);
    for (int chunkIndex = firstChunk; chunkIndex <= lastChunk; chunkIndex++) // Tentatively allocate all usable chunks
    allocedChunk = regionMap.alloc(1);
    // block out entire top of address range
    allocedChunk = regionMap.alloc(trailingChunks);
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(allocedChunk == unavailStartChunk);
    /* set up the global page map and place chunks on free list */
    int firstPage = 0;
    for (int chunkIndex = firstChunk; chunkIndex <= lastChunk; chunkIndex++) {
        if (VM.VERIFY_ASSERTIONS)
            VM.assertions._assert(spaceMap[chunkIndex] == null);
        totalAvailableDiscontiguousChunks++;
        // put this chunk on the free list
        regionMap.free(chunkIndex);
        globalPageMap.setUncoalescable(firstPage);
        // populate the global page map
        int allocedPages = globalPageMap.alloc(VMLayoutConstants.PAGES_IN_CHUNK);
        if (VM.VERIFY_ASSERTIONS)
            VM.assertions._assert(allocedPages == firstPage);
        firstPage += VMLayoutConstants.PAGES_IN_CHUNK;
    }
    finalized = true;
}
Also used : Address(org.vmmagic.unboxed.Address) Interruptible(org.vmmagic.pragma.Interruptible)

Example 27 with Interruptible

use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.

the class Map64 method createFreeList.

@Override
@Interruptible
public GenericFreeList createFreeList(FreeListPageResource pr, int units, int grain) {
    Space space = pr.getSpace();
    Address start = space.getStart();
    Extent extent = space.getExtent();
    int index = spaceIndex(start);
    units = (int) (units * NON_MAP_FRACTION);
    Extent listExtent = Conversions.pagesToBytes(RawMemoryFreeList.sizeInPages(units, 1));
    if (VMLayoutConstants.VERBOSE_BUILD) {
        Log.write("Allocating free list for space ");
        Log.write(space.getName());
        Log.write(", start = ", start);
        Log.write(", extent = ", extent);
        Log.write(", units = ", units);
        Log.write("  listPages = ", RawMemoryFreeList.sizeInPages(units, 1));
        Log.writeln(", listExtent = ", listExtent);
    }
    RawMemoryFreeList list = new RawMemoryFreeList(start, start.plus(listExtent), units, grain);
    flPageResources[index] = pr;
    flMap[index] = list;
    /* Adjust the base address and highwater to account for the allocated chunks for the map */
    Address base = Conversions.chunkAlign(start.plus(listExtent), false);
    highWater.set(index, base);
    baseAddress.set(index, base);
    return list;
}
Also used : Space(org.mmtk.policy.Space) RawMemoryFreeList(org.mmtk.utility.RawMemoryFreeList) Address(org.vmmagic.unboxed.Address) Extent(org.vmmagic.unboxed.Extent) Interruptible(org.vmmagic.pragma.Interruptible)

Example 28 with Interruptible

use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.

the class RVMThread method getLiveThreadsForJMX.

/**
 * Gets live threads.
 * <p>
 * Note: this is an expensive operation operation because we're grabbing
 * the accounting lock and thus prevent the threading system from changing
 * the set of active threads.
 *
 * @return the live threads that ought to be user-visible, i.e.
 *  all threads except the system threads
 */
@Interruptible
public static Thread[] getLiveThreadsForJMX() {
    int threadIndex = 0;
    acctLock.lockNoHandshake();
    Thread[] liveThreads = new Thread[numActiveThreads];
    for (int i = 0; i < RVMThread.numThreads; i++) {
        RVMThread t = RVMThread.threads[i];
        if (t.isAlive() && !t.isSystemThread()) {
            Thread javaLangThread = t.getJavaLangThread();
            if (javaLangThread == null) {
                continue;
            }
            boolean enoughSpace = threadIndex < numActiveThreads;
            if (!enoughSpace) {
                // unlock because of imminent (assertion) failure
                acctLock.unlock();
                if (VM.VerifyAssertions) {
                    VM._assert(VM.NOT_REACHED, "Not enough space in array for all live threads");
                } else {
                    VM.sysFail("Not enough space in array for all live threads");
                }
            }
            liveThreads[threadIndex] = javaLangThread;
            threadIndex++;
        }
    }
    acctLock.unlock();
    return liveThreads;
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) CollectorThread(org.jikesrvm.mm.mminterface.CollectorThread) Interruptible(org.vmmagic.pragma.Interruptible)

Example 29 with Interruptible

use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.

the class RVMThread method notifyAll.

/**
 * Support for Java synchronization primitive.
 *
 * @param o the object synchronized on
 * @see java.lang.Object#notifyAll
 */
@Interruptible
public static void notifyAll(Object o) {
    if (STATS)
        notifyAllOperations++;
    Lock l = ObjectModel.getHeavyLock(o, false);
    if (l == null)
        return;
    l.mutex.lock();
    int owner = l.getOwnerId();
    l.mutex.unlock();
    if (owner != getCurrentThread().getLockingId()) {
        raiseIllegalMonitorStateException("notifying all (expected lock to be held by " + getCurrentThread().getLockingId() + " but was held by " + l.getOwnerId() + ") ", o);
    }
    for (; ; ) {
        l.mutex.lock();
        RVMThread toAwaken = l.waiting.dequeue();
        l.mutex.unlock();
        if (toAwaken == null)
            break;
        toAwaken.monitor().lockedBroadcastNoHandshake();
    }
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 30 with Interruptible

use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.

the class Services method addressAsHexString.

/**
 * Format a 32/64 bit number as "0x" followed by 8/16 hex digits.
 * Do this without referencing Integer or Character classes,
 * in order to avoid dynamic linking.
 *
 * @param addr  The 32/64 bit number to format.
 * @return a String with the hex representation of an Address
 */
@Interruptible
public static String addressAsHexString(Address addr) {
    int len = 2 + (BITS_IN_ADDRESS >> 2);
    char[] buf = new char[len];
    while (--len > 1) {
        int digit = addr.toInt() & 0x0F;
        buf[len] = digit <= 9 ? (char) ('0' + digit) : (char) ('a' + digit - 10);
        addr = addr.toWord().rshl(4).toAddress();
    }
    buf[len--] = 'x';
    buf[len] = '0';
    return new String(buf);
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Aggregations

Interruptible (org.vmmagic.pragma.Interruptible)44 Entrypoint (org.vmmagic.pragma.Entrypoint)22 Address (org.vmmagic.unboxed.Address)11 NoInline (org.vmmagic.pragma.NoInline)9 TIB (org.jikesrvm.objectmodel.TIB)8 RVMArray (org.jikesrvm.classloader.RVMArray)7 RVMType (org.jikesrvm.classloader.RVMType)6 RVMMethod (org.jikesrvm.classloader.RVMMethod)3 Offset (org.vmmagic.unboxed.Offset)3 NormalMethod (org.jikesrvm.classloader.NormalMethod)2 RVMClass (org.jikesrvm.classloader.RVMClass)2 CodeArray (org.jikesrvm.compilers.common.CodeArray)2 CallSiteTreeNode (org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode)2 CollectorThread (org.jikesrvm.mm.mminterface.CollectorThread)2 Extent (org.vmmagic.unboxed.Extent)2 EventAttribute (com.ibm.tuningfork.tracegen.types.EventAttribute)1 Atom (org.jikesrvm.classloader.Atom)1 TypeReference (org.jikesrvm.classloader.TypeReference)1 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)1 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)1