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.plan.generational.marksweep;
014
015import org.mmtk.plan.generational.GenCollector;
016import org.mmtk.plan.generational.GenMatureTraceLocal;
017import org.mmtk.plan.Trace;
018import org.mmtk.policy.Space;
019
020import org.vmmagic.unboxed.*;
021import org.vmmagic.pragma.*;
022
023/**
024 * This class implements the core functionality for a transitive
025 * closure over the heap graph, specifically in a Generational Mark-Sweep
026 * collector.
027 */
028@Uninterruptible
029public final class GenMSMatureTraceLocal extends GenMatureTraceLocal{
030
031  /**
032   * @param global the global trace class to use
033   * @param plan the state of the generational collector
034   */
035  public GenMSMatureTraceLocal(Trace global, GenCollector plan) {
036    super(global, plan);
037  }
038
039  @Override
040  @Inline
041  public ObjectReference traceObject(ObjectReference object) {
042    if (object.isNull()) return object;
043
044    if (Space.isInSpace(GenMS.MS, object)) {
045      return GenMS.msSpace.traceObject(this, object);
046    }
047    return super.traceObject(object);
048  }
049
050  @Override
051  public boolean isLive(ObjectReference object) {
052    if (object.isNull()) return false;
053    if (Space.isInSpace(GenMS.MS, object)) {
054      return GenMS.msSpace.isLive(object);
055    }
056    return super.isLive(object);
057  }
058
059  @Override
060  public boolean willNotMoveInCurrentCollection(ObjectReference object) {
061    if (Space.isInSpace(GenMS.MS, object)) {
062      return true;
063    }
064    return super.willNotMoveInCurrentCollection(object);
065  }
066}