Exemplo n.º 1
0
 /**
  * Given a slot (ie the address of an ObjectReference), ensure that the referent will not move for
  * the rest of the GC. This is achieved by calling the precopyObject method.
  *
  * @param slot The slot to check
  */
 @Inline
 public final void processPrecopyEdge(Address slot) {
   ObjectReference child = slot.loadObjectReference();
   if (!child.isNull()) {
     child = precopyObject(child);
     slot.store(child);
   }
 }
Exemplo n.º 2
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.º 3
0
 /**
  * This method is the core method during the trace of the object graph. The role of this method is
  * to:
  *
  * <p>1. Ensure the traced object is not collected. 2. If this is the first visit to the object
  * enqueue it to be scanned. 3. Return the forwarded reference to the object.
  *
  * @param object The object to be traced.
  * @return The new reference to the same object instance.
  */
 @Inline
 public ObjectReference traceObject(ObjectReference object) {
   if (Space.isInSpace(Plan.VM_SPACE, object))
     return (Plan.SCAN_BOOT_IMAGE) ? object : Plan.vmSpace.traceObject(this, object);
   if (Space.isInSpace(Plan.IMMORTAL, object)) return Plan.immortalSpace.traceObject(this, object);
   if (Space.isInSpace(Plan.LOS, object)) return Plan.loSpace.traceObject(this, object);
   if (Space.isInSpace(Plan.PLOS, object)) return Plan.ploSpace.traceObject(this, object);
   if (Plan.USE_CODE_SPACE && Space.isInSpace(Plan.SMALL_CODE, object))
     return Plan.smallCodeSpace.traceObject(this, object);
   if (Plan.USE_CODE_SPACE && Space.isInSpace(Plan.LARGE_CODE, object))
     return Plan.largeCodeSpace.traceObject(this, object);
   if (VM.VERIFY_ASSERTIONS)
     VM.assertions._assert(false, "No special case for space in traceObject");
   return ObjectReference.nullReference();
 }
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());
 }