use of org.mmtk.plan.CollectorContext 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.mmtk.plan.CollectorContext 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