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.concurrent.marksweep;
014
015 import org.mmtk.plan.TraceLocal;
016 import org.mmtk.plan.Trace;
017 import org.mmtk.policy.Space;
018
019 import org.vmmagic.pragma.*;
020 import org.vmmagic.unboxed.*;
021
022 /**
023 * This class implements the thread-local functionality for a transitive
024 * closure over a mark-sweep space.
025 */
026 @Uninterruptible
027 public final class CMSTraceLocal extends TraceLocal {
028 /**
029 * Constructor
030 */
031 public CMSTraceLocal(Trace trace) {
032 super(trace);
033 }
034
035 /****************************************************************************
036 *
037 * Externally visible Object processing and tracing
038 */
039
040 /**
041 * {@inheritDoc}
042 */
043 @Override
044 protected boolean overwriteReferenceDuringTrace() {
045 return false;
046 }
047
048 @Override
049 public boolean isLive(ObjectReference object) {
050 if (object.isNull()) return false;
051 if (Space.isInSpace(CMS.MARK_SWEEP, object)) {
052 return CMS.msSpace.isLive(object);
053 }
054 return super.isLive(object);
055 }
056
057 /**
058 * {@inheritDoc}<p>
059 *
060 * In this instance, we refer objects in the mark-sweep space to the
061 * msSpace for tracing, and defer to the superclass for all others.
062 */
063 @Override
064 @Inline
065 public ObjectReference traceObject(ObjectReference object) {
066 if (object.isNull()) return object;
067 if (Space.isInSpace(CMS.MARK_SWEEP, object))
068 return CMS.msSpace.traceObject(this, object);
069 return super.traceObject(object);
070 }
071 }