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.generational.marksweep;
014    
015    import org.mmtk.plan.generational.GenCollector;
016    import org.mmtk.plan.generational.GenMatureTraceLocal;
017    import org.mmtk.plan.Trace;
018    import org.mmtk.policy.Space;
019    
020    import org.vmmagic.unboxed.*;
021    import 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
029    public final class GenMSMatureTraceLocal extends GenMatureTraceLocal{
030    
031      /**
032       * Constructor
033       */
034      public GenMSMatureTraceLocal(Trace global, GenCollector plan) {
035        super(global, plan);
036      }
037    
038      @Override
039      @Inline
040      public ObjectReference traceObject(ObjectReference object) {
041        if (object.isNull()) return object;
042    
043        if (Space.isInSpace(GenMS.MS, object)) {
044          return GenMS.msSpace.traceObject(this, object);
045        }
046        return super.traceObject(object);
047      }
048    
049      @Override
050      public boolean isLive(ObjectReference object) {
051        if (object.isNull()) return false;
052        if (Space.isInSpace(GenMS.MS, object)) {
053          return GenMS.msSpace.isLive(object);
054        }
055        return super.isLive(object);
056      }
057    
058      @Override
059      public boolean willNotMoveInCurrentCollection(ObjectReference object) {
060        if (Space.isInSpace(GenMS.MS, object)) {
061          return true;
062        }
063        return super.willNotMoveInCurrentCollection(object);
064      }
065    }