/** Fallback */
 public static void fallback(Object object, TransitiveClosure trace) {
   ObjectReference objectRef = ObjectReference.fromObject(object);
   RVMType type = ObjectModel.getObjectType(objectRef.toObject());
   if (type.isClassType()) {
     RVMClass klass = type.asClass();
     int[] offsets = klass.getReferenceOffsets();
     for (int i = 0; i < offsets.length; i++) {
       trace.processEdge(objectRef, objectRef.toAddress().plus(offsets[i]));
     }
   } else if (type.isArrayType() && type.asArray().getElementType().isReferenceType()) {
     for (int i = 0; i < ObjectModel.getArrayLength(objectRef.toObject()); i++) {
       trace.processEdge(objectRef, objectRef.toAddress().plus(i << LOG_BYTES_IN_ADDRESS));
     }
   }
 }
 /**
  * Push an address onto the address stack.
  *
  * @param object the object to be pushed onto the object queue
  */
 @Inline
 public final void push(ObjectReference object) {
   Address addr = object.toAddress();
   if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!addr.isZero());
   checkHeadInsert(1);
   uncheckedHeadInsert(addr);
 }
Exemplo n.º 3
0
 /**
  * Trace a reference during GC. This involves determining which collection policy applies and
  * calling the appropriate <code>trace</code> method.
  *
  * @param target The object the interior edge points within.
  * @param slot The location of the interior edge.
  * @param root True if this is a root edge.
  */
 public final void processInteriorEdge(ObjectReference target, Address slot, boolean root) {
   Address interiorRef = slot.loadAddress();
   Offset offset = interiorRef.diff(target.toAddress());
   ObjectReference newTarget = traceObject(target, root);
   if (VM.VERIFY_ASSERTIONS) {
     if (offset.sLT(Offset.zero()) || offset.sGT(Offset.fromIntSignExtend(1 << 24))) {
       // There is probably no object this large
       Log.writeln("ERROR: Suspiciously large delta to interior pointer");
       Log.write("       object base = ");
       Log.writeln(target);
       Log.write("       interior reference = ");
       Log.writeln(interiorRef);
       Log.write("       delta = ");
       Log.writeln(offset);
       VM.assertions._assert(false);
     }
   }
   slot.store(newTarget.toAddress().plus(offset));
 }
Exemplo n.º 4
0
 /**
  * Return true if the object resides within the nursery
  *
  * @param obj The object to be tested
  * @return true if the object resides within the nursery
  */
 @Inline
 static boolean inNursery(ObjectReference obj) {
   return inNursery(obj.toAddress());
 }