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.backuptrace;
014
015 import org.mmtk.plan.TransitiveClosure;
016 import org.mmtk.plan.refcount.RCBase;
017 import org.mmtk.plan.refcount.RCHeader;
018 import org.mmtk.policy.Space;
019 import org.mmtk.vm.VM;
020
021 import org.vmmagic.pragma.*;
022 import org.vmmagic.unboxed.*;
023
024 /**
025 * This class is the fundamental mechanism for performing a
026 * transitive closure over an object graph.<p>
027 *
028 * @see org.mmtk.plan.TraceLocal
029 */
030 @Uninterruptible
031 public final class BTDecMarkedAndZero extends TransitiveClosure {
032
033 /**
034 * Trace an edge during GC.
035 *
036 * @param source The source of the reference.
037 * @param slot The location containing the object reference.
038 */
039 @Inline
040 public void processEdge(ObjectReference source, Address slot) {
041 ObjectReference object = slot.loadObjectReference();
042 slot.store(ObjectReference.nullReference());
043 if (!object.isNull()) {
044 if ((Space.isInSpace(RCBase.REF_COUNT, object) && RCBase.rcSpace.isLive(object)) ||
045 Space.isInSpace(RCBase.REF_COUNT_LOS, object) ||
046 Space.isInSpace(RCBase.IMMORTAL, object)) {
047 int result = RCHeader.decRC(object);
048 if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(result != RCHeader.DEC_KILL || !RCHeader.isMarked(object));
049 }
050 }
051 }
052 }