/** {@inheritDoc} */ @Override public boolean isLive(ObjectReference object) { if (object.isNull()) return false; if (Space.isInSpace(SS.SS0, object)) return SS.hi ? SS.copySpace0.isLive(object) : true; if (Space.isInSpace(SS.SS1, object)) return SS.hi ? true : SS.copySpace1.isLive(object); return super.isLive(object); }
@Override @Inline public ObjectReference traceObject(ObjectReference object) { if (object.isNull()) return object; if (Space.isInSpace(SS.SS0, object)) return SS.copySpace0.traceObject(this, object, SS.ALLOC_SS); if (Space.isInSpace(SS.SS1, object)) return SS.copySpace1.traceObject(this, object, SS.ALLOC_SS); return super.traceObject(object); }
/** * Ensure that the referenced object will not move from this point through to the end of the * collection. This can involve forwarding the object if necessary. * * <p><i>Non-copying collectors do nothing, copying collectors must override this method in each * of their trace classes.</i> * * @param object The object that must not move during the collection. * @return True If the object will not move during collection */ public boolean willNotMoveInCurrentCollection(ObjectReference object) { if (!VM.activePlan.constraints().movesObjects()) return true; if (Space.isInSpace(Plan.LOS, object)) return true; if (Space.isInSpace(Plan.IMMORTAL, object)) return true; if (Space.isInSpace(Plan.VM_SPACE, object)) return true; if (Plan.USE_CODE_SPACE && Space.isInSpace(Plan.SMALL_CODE, object)) return true; if (Plan.USE_CODE_SPACE && Space.isInSpace(Plan.LARGE_CODE, object)) return true; if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false, "willNotMove not defined properly in subclass"); return false; }
/** * 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. * * <p>In this instance, we refer objects in the mark-sweep space to the immixSpace for tracing, * and defer to the superclass for all others. * * @param object The object to be traced. * @return The new reference to the same object instance. */ @Inline public ObjectReference traceObject(ObjectReference object) { if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(Immix.immixSpace.inImmixDefragCollection()); if (object.isNull()) return object; if (Space.isInSpace(Immix.IMMIX, object)) return Immix.immixSpace.traceObject(this, object, Plan.ALLOC_DEFAULT); return super.traceObject(object); }
/** * Is the specified object live? * * @param object The object. * @return True if the object is live. */ public boolean isLive(ObjectReference object) { if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(Immix.immixSpace.inImmixDefragCollection()); if (object.isNull()) return false; if (Space.isInSpace(Immix.IMMIX, object)) { return Immix.immixSpace.isLive(object); } return super.isLive(object); }
/** * Collectors that move objects <b>must</b> override this method. It performs the deferred * scanning of objects which are forwarded during bootstrap of each copying collection. Because of * the complexities of the collection bootstrap (such objects are generally themselves * gc-critical), the forwarding and scanning of the objects must be dislocated. It is an error for * a non-moving collector to call this method. * * @param object The forwarded object to be scanned */ @Inline @Override protected void scanObject(ObjectReference object) { if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(Immix.immixSpace.inImmixDefragCollection()); super.scanObject(object); if (MARK_LINE_AT_SCAN_TIME && Space.isInSpace(Immix.IMMIX, object)) Immix.immixSpace.markLines(object); }
/** * Can this object ever move. Used by the VM to make decisions about whether it needs to copy IO * buffers etc. * * @param object The object in question * @return True if it is not possible that the object will ever move. */ public boolean willNeverMove(ObjectReference object) { if (!VM.activePlan.constraints().movesObjects()) return true; if (Space.isInSpace(LOS, object)) return true; if (Space.isInSpace(IMMORTAL, object)) return true; if (Space.isInSpace(VM_SPACE, object)) return true; if (Space.isInSpace(NON_MOVING, object)) return true; if (USE_CODE_SPACE && Space.isInSpace(SMALL_CODE, object)) return true; if (USE_CODE_SPACE && Space.isInSpace(LARGE_CODE, object)) return true; /* * Default to false- this preserves correctness over efficiency. * Individual plans should override for non-moving spaces they define. */ return false; }
/** * 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(); }
/** * Will this object move from this point on, during the current trace ? * * @param object The object to query. * @return True if the object will not move. */ @Override public boolean willNotMoveInCurrentCollection(ObjectReference object) { return (SS.hi && !Space.isInSpace(SS.SS0, object)) || (!SS.hi && !Space.isInSpace(SS.SS1, object)); }
/** * @see org.mmtk.plan.Plan#willNeverMove * @param object Object in question * @return True if the object will never move */ @Override public boolean willNeverMove(ObjectReference object) { if (Space.isInSpace(NURSERY, object)) return false; return super.willNeverMove(object); }
/** * Return true if this object is guaranteed not to move during this collection (i.e. this object * is defintely not an unforwarded object). * * @param object * @return True if this object is guaranteed not to move during this collection. */ @Override public boolean willNotMoveInCurrentCollection(ObjectReference object) { if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(Immix.immixSpace.inImmixDefragCollection()); if (Space.isInSpace(Immix.IMMIX, object)) return Immix.immixSpace.willNotMoveThisGC(object); return true; }