Search in sources :

Example 41 with ObjectReference

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));
    }
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) StackFrame(org.mmtk.harness.lang.runtime.StackFrame)

Example 42 with ObjectReference

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));
    }
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) StackFrame(org.mmtk.harness.lang.runtime.StackFrame)

Example 43 with ObjectReference

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);
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 44 with ObjectReference

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;
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) CollectorContext(org.mmtk.plan.CollectorContext) Inline(org.vmmagic.pragma.Inline)

Example 45 with ObjectReference

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;
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) CollectorContext(org.mmtk.plan.CollectorContext) Inline(org.vmmagic.pragma.Inline)

Aggregations

ObjectReference (org.vmmagic.unboxed.ObjectReference)74 Inline (org.vmmagic.pragma.Inline)35 Entrypoint (org.vmmagic.pragma.Entrypoint)33 Offset (org.vmmagic.unboxed.Offset)21 Address (org.vmmagic.unboxed.Address)12 StackFrame (org.mmtk.harness.lang.runtime.StackFrame)5 RVMType (org.jikesrvm.classloader.RVMType)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 OutOfMemory (org.mmtk.harness.exception.OutOfMemory)2 ObjectValue (org.mmtk.harness.lang.runtime.ObjectValue)2 CollectorContext (org.mmtk.plan.CollectorContext)2 Uninterruptible (org.vmmagic.pragma.Uninterruptible)2 ArrayDeque (java.util.ArrayDeque)1 HashSet (java.util.HashSet)1 AbstractRegisters (org.jikesrvm.architecture.AbstractRegisters)1 RVMMethod (org.jikesrvm.classloader.RVMMethod)1 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)1 TIB (org.jikesrvm.objectmodel.TIB)1 NoInline (org.vmmagic.pragma.NoInline)1