001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Eclipse Public License (EPL);
005 * You may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013 package org.mmtk.plan.refcount.generational;
014
015 import org.mmtk.plan.TransitiveClosure;
016 import org.mmtk.plan.refcount.RCHeader;
017 import org.mmtk.policy.Space;
018
019 import org.vmmagic.pragma.*;
020 import org.vmmagic.unboxed.*;
021
022 /**
023 * This class is the fundamental mechanism for performing a
024 * transitive closure over an object graph.<p>
025 *
026 * @see org.mmtk.plan.TraceLocal
027 */
028 @Uninterruptible
029 public final class GenRCModifiedProcessor extends TransitiveClosure {
030
031 private final GenRCFindRootSetTraceLocal trace;
032
033 public GenRCModifiedProcessor(GenRCFindRootSetTraceLocal trace) {
034 this.trace = trace;
035 }
036
037 @Override
038 @Inline
039 public void processEdge(ObjectReference source, Address slot) {
040 ObjectReference object = slot.loadObjectReference();
041 if (!object.isNull()) {
042 if (Space.isInSpace(GenRC.NURSERY, object)) {
043 object = GenRC.nurserySpace.traceObject(trace, object, GenRC.ALLOC_RC);
044 RCHeader.incRC(object);
045 slot.store(object);
046 } else if (GenRC.isRCObject(object)) {
047 RCHeader.incRC(object);
048 }
049 }
050 }
051 }