Search in sources :

Example 51 with ObjectReference

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

the class ReferenceValue method processReference.

/**
 * GC-time processing of the contained object.
 * <p>
 * Corresponds to the core of the processReference method of the MMTk ReferenceProcessor
 * for the WEAK reference type.
 *
 * @param trace The MMTk trace
 */
public void processReference(TraceLocal trace) {
    if (cleared)
        return;
    ObjectReference newRef = trace.getForwardedReferent(ref);
    if (Trace.isEnabled(Item.REFERENCES)) {
        Clock.stop();
        Trace.trace(Item.REFERENCES, "Forwarded reference %x: %s reference (%s -> %s)", id, semantics, ObjectModel.getString(ref), ObjectModel.getString(newRef));
        Clock.start();
    }
    ref = newRef;
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference)

Example 52 with ObjectReference

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

the class StackFrame method dumpRoots.

/**
 * Debug printing support: dump this stack frame and return roots.
 * @param width Output field width
 * @return The collection of roots in this frame
 */
public Collection<ObjectReference> dumpRoots(int width) {
    List<ObjectReference> roots = new ArrayList<ObjectReference>();
    for (int i = 0; i < values.length; i++) {
        Value value = get(i);
        String name = method.getSlotName(i);
        if (value != null && value instanceof ObjectValue) {
            ObjectReference ref = ((ObjectValue) value).getObjectValue();
            System.err.printf(" %s=%s", name, ObjectModel.formatObject(width, ref));
            if (!ref.isNull())
                roots.add(ref);
        }
    }
    return roots;
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) ArrayList(java.util.ArrayList)

Example 53 with ObjectReference

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

the class StackFrame method objectShadowMap.

/**
 * @return The set of (variable,object-id) pairs
 */
@SuppressWarnings("unused")
private Map<String, Integer> objectShadowMap() {
    Map<String, Integer> result = new HashMap<String, Integer>();
    for (int i = 0; i < size; i++) {
        if (values[i] != null && values[i] instanceof ObjectValue) {
            ObjectReference obj = slotAddress(i).loadObjectReference();
            result.put(method.getSlotName(i), obj.isNull() ? 0 : ObjectModel.getId(obj));
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) ObjectReference(org.vmmagic.unboxed.ObjectReference)

Example 54 with ObjectReference

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

the class StackFrame method objectMap.

/**
 * @return The set of (variable,object-id) pairs
 */
@SuppressWarnings("unused")
private Map<String, Integer> objectMap() {
    Map<String, Integer> result = new HashMap<String, Integer>();
    for (int i = 0; i < size; i++) {
        if (values[i] != null && values[i] instanceof ObjectValue) {
            ObjectReference obj = values[i].getObjectValue();
            result.put(method.getSlotName(i), obj.isNull() ? 0 : ObjectModel.getId(obj));
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) ObjectReference(org.vmmagic.unboxed.ObjectReference)

Example 55 with ObjectReference

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

the class Env method dumpThreadRoots.

/**
 * Print the thread roots and add them to a stack for processing.
 */
@Override
public Collection<ObjectReference> dumpThreadRoots(int width) {
    int frameId = 0;
    List<ObjectReference> roots = new ArrayList<ObjectReference>();
    for (StackFrame frame : stack) {
        System.err.printf("  Frame %5d [", frameId++);
        roots.addAll(frame.dumpRoots(width));
        System.err.println(" ]");
    }
    System.err.println();
    return roots;
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) StackFrame(org.mmtk.harness.lang.runtime.StackFrame) ArrayList(java.util.ArrayList)

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