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.immix;
014
015import static org.mmtk.policy.immix.ImmixConstants.MARK_LINE_AT_SCAN_TIME;
016
017import org.mmtk.plan.generational.GenCollector;
018import org.mmtk.plan.generational.GenMatureTraceLocal;
019import org.mmtk.plan.Trace;
020import org.mmtk.policy.Space;
021
022import org.vmmagic.unboxed.*;
023import org.vmmagic.pragma.*;
024
025/**
026 * This class implements the core functionality for a transitive
027 * closure over the heap graph, specifically in a generational immix
028 * collector.
029 */
030@Uninterruptible
031public final class GenImmixMatureTraceLocal extends GenMatureTraceLocal{
032
033  /**
034   * @param global the global trace class to use
035   * @param plan the state of the generational collector
036   */
037  public GenImmixMatureTraceLocal(Trace global, GenCollector plan) {
038    super(GenImmix.SCAN_IMMIX, global, plan);
039  }
040
041  @Override
042  @Inline
043  public ObjectReference traceObject(ObjectReference object) {
044    if (object.isNull()) return object;
045
046    if (Space.isInSpace(GenImmix.IMMIX, object)) {
047      return GenImmix.immixSpace.fastTraceObject(this, object);
048    }
049    return super.traceObject(object);
050  }
051
052  @Override
053  public boolean isLive(ObjectReference object) {
054    if (object.isNull()) return false;
055    if (Space.isInSpace(GenImmix.IMMIX, object)) {
056      return GenImmix.immixSpace.isLive(object);
057    }
058    return super.isLive(object);
059  }
060
061  @Override
062  public boolean willNotMoveInCurrentCollection(ObjectReference object) {
063    if (Space.isInSpace(GenImmix.IMMIX, object)) {
064      return true;
065    }
066    return super.willNotMoveInCurrentCollection(object);
067  }
068
069  @Inline
070  @Override
071  protected void scanObject(ObjectReference object) {
072    super.scanObject(object);
073    if (MARK_LINE_AT_SCAN_TIME && Space.isInSpace(GenImmix.IMMIX, object))
074      GenImmix.immixSpace.markLines(object);
075  }
076}