Пример #1
0
 /**
  * Trace a reference to an object under a mark sweep collection policy. If the object header is
  * not already marked, mark the object in either the bitmap or by moving it off the treadmill, and
  * enqueue the object for subsequent processing. The object is marked as (an atomic) side-effect
  * of checking whether already marked.
  *
  * @param trace The trace being conducted.
  * @param object The object to be traced.
  * @return The object (there is no object forwarding in this collector, so we always return the
  *     same object: this could be a void method but for compliance to a more general interface).
  */
 @Inline
 public ObjectReference traceObject(TransitiveClosure trace, ObjectReference object) {
   boolean nurseryObject = isInNursery(object);
   if (!inNurseryGC || nurseryObject) {
     if (testAndMark(object, markState)) {
       internalMarkObject(object, nurseryObject);
       trace.processNode(object);
     }
   }
   return object;
 }