Search in sources :

Example 6 with Interruptible

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

the class MemoryManager method newTIB.

/**
 * Allocates a new type information block (TIB).
 *
 * @param numVirtualMethods the number of virtual method slots in the TIB
 * @param alignCode alignment encoding for the TIB
 * @return the new TIB
 * @see AlignmentEncoding
 */
@NoInline
@Interruptible
public static TIB newTIB(int numVirtualMethods, int alignCode) {
    int elements = TIB.computeSize(numVirtualMethods);
    if (!VM.runningVM) {
        return TIB.allocate(elements, alignCode);
    }
    if (alignCode == AlignmentEncoding.ALIGN_CODE_NONE) {
        return (TIB) newRuntimeTable(elements, RVMType.TIBType);
    }
    RVMType type = RVMType.TIBType;
    if (VM.VerifyAssertions)
        VM._assert(VM.runningVM);
    TIB realTib = type.getTypeInformationBlock();
    RVMArray fakeType = RVMType.WordArrayType;
    TIB fakeTib = fakeType.getTypeInformationBlock();
    int headerSize = ObjectModel.computeArrayHeaderSize(fakeType);
    int align = ObjectModel.getAlignment(fakeType);
    int offset = ObjectModel.getOffsetForAlignment(fakeType, false);
    int width = fakeType.getLogElementSize();
    int elemBytes = elements << width;
    if (elemBytes < 0 || (elemBytes >>> width) != elements) {
        /* asked to allocate more than Integer.MAX_VALUE bytes */
        throwLargeArrayOutOfMemoryError();
    }
    int size = elemBytes + headerSize + AlignmentEncoding.padding(alignCode);
    Selected.Mutator mutator = Selected.Mutator.get();
    Address region = allocateSpace(mutator, size, align, offset, type.getMMAllocator(), Plan.DEFAULT_SITE);
    region = AlignmentEncoding.adjustRegion(alignCode, region);
    Object result = ObjectModel.initializeArray(region, fakeTib, elements, size);
    mutator.postAlloc(ObjectReference.fromObject(result), ObjectReference.fromObject(fakeTib), size, type.getMMAllocator());
    /* Now we replace the TIB */
    ObjectModel.setTIB(result, realTib);
    return (TIB) result;
}
Also used : Address(org.vmmagic.unboxed.Address) RVMArray(org.jikesrvm.classloader.RVMArray) RVMType(org.jikesrvm.classloader.RVMType) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 7 with Interruptible

use of org.vmmagic.pragma.Interruptible 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 8 with Interruptible

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

the class ObjectHolder method handinRefs.

/*
   * TODO add better documentation and turn this into a JavaDoc comment.
   *
   * The VM scope descriptor extractor can hand in an object here
   */
@Interruptible
public static int handinRefs(Object[] objs) {
    int n = refs.length;
    for (int i = 0; i < n; i++) {
        if (refs[i] == null) {
            refs[i] = objs;
            return i;
        }
    }
    // grow the array
    Object[][] newRefs = new Object[2 * n][];
    System.arraycopy(refs, 0, newRefs, 0, n);
    newRefs[n] = objs;
    refs = newRefs;
    return n;
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 9 with Interruptible

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

the class OptEncodedCallSiteTree method getEncoding.

@Interruptible
static int getEncoding(CallSiteTreeNode current, int offset, int parent, int[] encoding) {
    int i = offset;
    if (parent != -1) {
        encoding[i++] = parent - offset;
    }
    CallSiteTreeNode x = current;
    int j = i;
    while (x != null) {
        x.encodedOffset = j;
        int byteCodeIndex = x.callSite.getBcIndex();
        encoding[j++] = (byteCodeIndex >= 0) ? byteCodeIndex : -1;
        encoding[j++] = x.callSite.getMethod().getId();
        x = (CallSiteTreeNode) x.getRightSibling();
    }
    x = current;
    int thisParent = i;
    while (x != null) {
        if (x.getLeftChild() != null) {
            j = getEncoding((CallSiteTreeNode) x.getLeftChild(), j, thisParent, encoding);
        }
        thisParent += 2;
        x = (CallSiteTreeNode) x.getRightSibling();
    }
    return j;
}
Also used : CallSiteTreeNode(org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode) Interruptible(org.vmmagic.pragma.Interruptible)

Example 10 with Interruptible

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

the class OptSaveVolatile method resolve.

/**
 * Wrapper to save/restore volatile registers when a class needs to be
 * dynamically loaded/resolved/etc.
 */
@Entrypoint
@Interruptible
public static void resolve() throws NoClassDefFoundError {
    VM.disableGC();
    // (1) Get the compiled method & compilerInfo for the (opt)
    // compiled method that called resolve
    Address fp = Magic.getCallerFramePointer(Magic.getFramePointer());
    int cmid = Magic.getCompiledMethodID(fp);
    OptCompiledMethod cm = (OptCompiledMethod) CompiledMethods.getCompiledMethod(cmid);
    // (2) Get the return address
    Address ip = Magic.getReturnAddressUnchecked(Magic.getFramePointer());
    Offset offset = cm.getInstructionOffset(ip);
    VM.enableGC();
    // (3) Call the routine in OptLinker that does all the real work.
    OptLinker.resolveDynamicLink(cm, offset);
}
Also used : Address(org.vmmagic.unboxed.Address) Entrypoint(org.vmmagic.pragma.Entrypoint) Offset(org.vmmagic.unboxed.Offset) Interruptible(org.vmmagic.pragma.Interruptible) Entrypoint(org.vmmagic.pragma.Entrypoint)

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