/** * Pop an address from the address stack, return zero if the stack is empty. * * @return The next address in the address stack, or zero if the stack is empty */ @Inline public final ObjectReference pop() { if (checkDequeue(1)) { return uncheckedDequeue().toObjectReference(); } else { return ObjectReference.nullReference(); } }
/** * 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(); }