/** * 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); } }
/** * Load and return the value of a reference field of an object. * * @param object The object to load the field of. * @param index The field index. */ public ObjectReference loadReferenceField(ObjectReference object, int index) { int limit = ObjectModel.getRefs(object); check(!object.isNull(), "Object can not be null"); check(index >= 0, "Index must be non-negative"); check(index < limit, "Index " + index + " out of bounds " + limit); Address referenceSlot = ObjectModel.getRefSlot(object, index); ObjectReference result; if (ActivePlan.constraints.needsReadBarrier()) { result = context.readBarrier(object, referenceSlot, null, null, Plan.AASTORE_WRITE_BARRIER); } else { result = referenceSlot.loadObjectReference(); } Trace.trace( Item.LOAD, "[%s].object[%d] returned [%s]", ObjectModel.getString(object), index, result.toString()); return result; }
/** * Load an object reference * * @param slot The location of the reference * @return the object reference loaded from slot */ @Inline public ObjectReference loadObjectReference(Address slot) { return slot.loadObjectReference(); }
/** * Trace a reference during GC. This involves determining which collection policy applies and * calling the appropriate <code>trace</code> method. * * @param source The source of the reference. * @param slot The location containing the object reference to be traced. The object reference is * <i>NOT</i> an interior pointer. * @param root True if <code>objLoc</code> is within a root. */ @Inline public final void processEdge(ObjectReference source, Address slot) { ObjectReference object = slot.loadObjectReference(); ObjectReference newObject = traceObject(object, false); slot.store(newObject); }
/** * Trace a reference during GC. This involves determining which collection policy applies and * calling the appropriate <code>trace</code> method. * * @param slot The location containing the object reference to be traced. The object reference is * <i>NOT</i> an interior pointer. * @param root True if <code>objLoc</code> is within a root. */ @Inline public final void processRootEdge(Address slot) { ObjectReference object = slot.loadObjectReference(); ObjectReference newObject = traceObject(object, true); slot.store(newObject); }