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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations