/** * An object has been marked (identifiged as live). Large objects are added to the to-space * treadmill, while all other objects will have a mark bit set in the superpage header. * * @param object The object which has been marked. */ @Inline private void internalMarkObject(ObjectReference object, boolean nurseryObject) { Address cell = VM.objectModel.objectStartRef(object); Address node = Treadmill.midPayloadToNode(cell); treadmill.copy(node, nurseryObject); }
/** Sweep through the large pages, releasing all superpages on the "from space" treadmill. */ private void sweepLargePages(boolean sweepNursery) { while (true) { Address cell = sweepNursery ? treadmill.popNursery() : treadmill.pop(); if (cell.isZero()) break; release(getSuperPage(cell)); } if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(sweepNursery ? treadmill.nurseryEmpty() : treadmill.fromSpaceEmpty()); }
/** * Prepare for a new collection increment. For the mark-sweep collector we must flip the state of * the mark bit between collections. */ public void prepare(boolean fullHeap) { if (fullHeap) { if (VM.VERIFY_ASSERTIONS) { VM.assertions._assert(treadmill.fromSpaceEmpty()); } markState = MARK_BIT.minus(markState); } treadmill.flip(fullHeap); inNurseryGC = !fullHeap; }
/** * Perform any required initialization of the GC portion of the header. * * @param object the object ref to the storage to be initialized * @param alloc is this initialization occuring due to (initial) allocation (true) or due to * copying (false)? */ @Inline public void initializeHeader(ObjectReference object, boolean alloc) { Word oldValue = VM.objectModel.readAvailableBitsWord(object); Word newValue = oldValue.and(LOS_BIT_MASK.not()).or(markState); if (alloc) newValue = newValue.or(NURSERY_BIT); if (Plan.NEEDS_LOG_BIT_IN_HEADER) newValue = newValue.or(Plan.UNLOGGED_BIT); VM.objectModel.writeAvailableBitsWord(object, newValue); Address cell = VM.objectModel.objectStartRef(object); treadmill.addToTreadmill(Treadmill.midPayloadToNode(cell), alloc); }
/** * A new collection increment has completed. For the mark-sweep collector this means we can * perform the sweep phase. */ public void release(boolean fullHeap) { // sweep the large objects sweepLargePages(true); // sweep the nursery if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(treadmill.nurseryEmpty()); if (fullHeap) sweepLargePages(false); // sweep the mature space }
/** * Return the size of the per-superpage header required by this system. In this case it is just * the underlying superpage header size. * * @return The size of the per-superpage header required by this system. */ @Inline protected int superPageHeaderSize() { return Treadmill.headerSize(); }