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.utility.sanitychecker;
014
015 import org.mmtk.plan.TraceLocal;
016 import org.mmtk.plan.Trace;
017
018 import org.vmmagic.pragma.*;
019 import org.vmmagic.unboxed.*;
020
021 /**
022 * This class implements the simply sanity closure.
023 */
024 @Uninterruptible
025 public final class SanityTraceLocal extends TraceLocal {
026
027 private final SanityChecker sanityChecker;
028
029 /**
030 * Constructor
031 */
032 public SanityTraceLocal(Trace trace, SanityChecker sanityChecker) {
033 super(trace);
034 this.sanityChecker = sanityChecker;
035 }
036
037 /****************************************************************************
038 *
039 * Object processing and tracing
040 */
041
042 /**
043 * {@inheritDoc}
044 */
045 @Override
046 @Inline
047 public ObjectReference traceObject(ObjectReference object, boolean root) {
048 sanityChecker.processObject(this, object, root);
049 return object;
050 }
051
052 /**
053 * Will this object move from this point on, during the current trace?
054 *
055 * @param object The object to query.
056 * @return {@code true} if the object will not move.
057 */
058 @Override
059 public boolean willNotMoveInCurrentCollection(ObjectReference object) {
060 // We never move objects!
061 return true;
062 }
063 }