Search in sources :

Example 56 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class HeapEntry method toString.

@Override
public String toString() {
    String result = String.format("Heap entry: id=%s, ", id, ObjectModel.getString(object));
    result += String.format("incoming pointers: %n");
    for (ObjectReference ref : getReferrers()) {
        result += String.format(" %s%n", ref);
    }
    return result;
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference)

Example 57 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class ObjectTable method trimToLiveSet.

/**
 * After the first pass of the sanity checker, we know exactly which objects are live.
 * Use this set to trim the set of valid objects after a full-heap collection.
 *
 * @param liveSet The known live objects
 */
public void trimToLiveSet(Set<ObjectReference> liveSet) {
    int removed = 0;
    Iterator<ObjectReference> iterator = objects.keySet().iterator();
    while (iterator.hasNext()) {
        ObjectReference current = iterator.next();
        if (!liveSet.contains(current)) {
            Entry entry = objects.get(current);
            if (VERBOSE || ObjectModel.isWatched(current)) {
                Trace.printf(Item.SANITY, "Object death: %s", entry.formatHistory());
            }
            entry.kill();
        }
        removed++;
    }
    Trace.trace(Item.SANITY, "Trimmed %d dead objects from object table", removed);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference)

Example 58 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class Traversal method scan.

/**
 * Scan an object, calling the appropriate visitor method
 * @param object
 */
private void scan(ObjectReference object) {
    if (VERBOSE) {
        Trace.trace(Item.SANITY, "scanning object %s", ObjectModel.getString(object));
    }
    for (int i = 0; i < ObjectModel.getRefs(object); i++) {
        Address slot = ObjectModel.getRefSlot(object, i);
        ObjectReference ref = loadReferenceSlot(slot);
        if (!ref.isNull()) {
            visitor.visitPointer(object, slot, ref);
            traceObject(ref, false);
        }
    }
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference)

Example 59 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class AllocOp method exec.

@Override
public void exec(Env env) {
    StackFrame frame = env.top();
    ObjectReference object;
    try {
        object = env.alloc(getRefCount(frame), getDataCount(frame), getDoubleAlign(frame), site);
    } catch (OutOfMemory e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException("Error allocating object id:" + ObjectModel.lastObjectId() + " refs:" + getRefCount(frame) + " ints: " + getDataCount(frame) + " align:" + getDoubleAlign(frame) + " site:" + site, e);
    }
    setResult(frame, new ObjectValue(object));
    if (Harness.gcEveryAlloc()) {
        env.gc();
    }
}
Also used : OutOfMemory(org.mmtk.harness.exception.OutOfMemory) ObjectValue(org.mmtk.harness.lang.runtime.ObjectValue) ObjectReference(org.vmmagic.unboxed.ObjectReference) StackFrame(org.mmtk.harness.lang.runtime.StackFrame)

Example 60 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class Barriers method booleanFieldWrite.

/**
 * Barrier for writes of booleans into fields of instances (i.e. putfield).
 *
 * @param ref the object which is the subject of the putfield
 * @param value the new value for the field
 * @param offset the offset of the field to be modified
 * @param locationMetadata an int that encodes the source location being modified
 */
@Inline
@Entrypoint
public static void booleanFieldWrite(Object ref, boolean value, Offset offset, int locationMetadata) {
    if (NEEDS_BOOLEAN_GC_WRITE_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(ref);
        Selected.Mutator.get().booleanWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Entrypoint(org.vmmagic.pragma.Entrypoint) 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