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