use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class StoreFieldOp method exec.
@Override
public void exec(Env env) {
Clock.assertStarted();
StackFrame frame = env.top();
int fieldIndex = getIndex(frame);
ObjectReference object = getObjectObj(frame);
if (fieldType == Type.INT) {
env.storeDataField(object, fieldIndex, getValInt(frame));
} else if (fieldType == Type.OBJECT) {
env.storeReferenceField(object, fieldIndex, getValObject(frame));
}
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class StoreFixedFieldOp method exec.
@Override
public void exec(Env env) {
StackFrame frame = env.top();
ObjectReference object = getObjectObj(frame);
if (fieldType == Type.INT) {
env.storeDataField(object, index, getValInt(frame));
} else if (fieldType == Type.OBJECT) {
env.storeReferenceField(object, index, getValObject(frame));
}
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class BumpPointer method scanRegion.
/**
* Perform a linear scan through a single contiguous region
*
* @param scanner The scan object to delegate to.
* @param start The start of this region
*/
@Inline
private void scanRegion(LinearScan scanner, Address start) {
/* Get the end of this region */
Address dataEnd = start.plus(DATA_END_OFFSET).loadAddress();
/* dataEnd = zero represents the current region. */
Address currentLimit = (dataEnd.isZero() ? cursor : dataEnd);
if (currentLimit.EQ(start.plus(DATA_END_OFFSET).plus(BYTES_IN_ADDRESS))) {
/* Empty region, so we can not call getObjectFromStartAddress() */
return;
}
ObjectReference current = VM.objectModel.getObjectFromStartAddress(start.plus(DATA_START_OFFSET));
/* Loop through each object up to the limit */
do {
/* Read end address first, as scan may be destructive */
Address currentObjectEnd = VM.objectModel.getObjectEndAddress(current);
scanner.scan(current);
if (currentObjectEnd.GE(currentLimit)) {
/* We have scanned the last object */
break;
}
/* Find the next object from the start address (dealing with alignment gaps, etc.) */
ObjectReference next = VM.objectModel.getObjectFromStartAddress(currentObjectEnd);
if (VM.VERIFY_ASSERTIONS) {
/* Must be monotonically increasing */
VM.assertions._assert(next.toAddress().GT(current.toAddress()));
}
current = next;
} while (true);
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class ObjectModel method copyScalar.
@Inline
private ObjectReference copyScalar(ObjectReference from, TIB tib, RVMClass type, int allocator) {
int bytes = org.jikesrvm.objectmodel.ObjectModel.bytesRequiredWhenCopied(from.toObject(), type);
int align = org.jikesrvm.objectmodel.ObjectModel.getAlignment(type, from.toObject());
int offset = org.jikesrvm.objectmodel.ObjectModel.getOffsetForAlignment(type, from);
CollectorContext context = VM.activePlan.collector();
allocator = context.copyCheckAllocator(from, bytes, align, allocator);
Address region = MemoryManager.allocateSpace(context, bytes, align, offset, allocator, from);
Object toObj = org.jikesrvm.objectmodel.ObjectModel.moveObject(region, from.toObject(), bytes, type);
ObjectReference to = ObjectReference.fromObject(toObj);
context.postCopy(to, ObjectReference.fromObject(tib), bytes, allocator);
return to;
}
use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.
the class ObjectModel method copyArray.
@Inline
private ObjectReference copyArray(ObjectReference from, TIB tib, RVMArray type, int allocator) {
int elements = Magic.getArrayLength(from.toObject());
int bytes = org.jikesrvm.objectmodel.ObjectModel.bytesRequiredWhenCopied(from.toObject(), type, elements);
int align = org.jikesrvm.objectmodel.ObjectModel.getAlignment(type, from.toObject());
int offset = org.jikesrvm.objectmodel.ObjectModel.getOffsetForAlignment(type, from);
CollectorContext context = VM.activePlan.collector();
allocator = context.copyCheckAllocator(from, bytes, align, allocator);
Address region = MemoryManager.allocateSpace(context, bytes, align, offset, allocator, from);
Object toObj = org.jikesrvm.objectmodel.ObjectModel.moveObject(region, from.toObject(), bytes, type);
ObjectReference to = ObjectReference.fromObject(toObj);
context.postCopy(to, ObjectReference.fromObject(tib), bytes, allocator);
if (type == RVMType.CodeArrayType) {
// sync all moved code arrays to get icache and dcache in sync
// immediately.
int dataSize = bytes - org.jikesrvm.objectmodel.ObjectModel.computeHeaderSize(Magic.getObjectType(toObj));
org.jikesrvm.runtime.Memory.sync(to.toAddress(), dataSize);
}
return to;
}
Aggregations