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.immix;
014    
015    import static org.mmtk.policy.immix.ImmixConstants.MARK_LINE_AT_SCAN_TIME;
016    
017    import org.mmtk.plan.generational.GenCollector;
018    import org.mmtk.plan.generational.GenMatureTraceLocal;
019    import org.mmtk.plan.Trace;
020    import org.mmtk.policy.Space;
021    
022    import org.vmmagic.unboxed.*;
023    import 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
031    public final class GenImmixMatureTraceLocal extends GenMatureTraceLocal{
032    
033      /**
034       * Constructor
035       */
036      public GenImmixMatureTraceLocal(Trace global, GenCollector plan) {
037        super(GenImmix.SCAN_IMMIX, global, plan);
038      }
039    
040      @Override
041      @Inline
042      public ObjectReference traceObject(ObjectReference object) {
043        if (object.isNull()) return object;
044    
045        if (Space.isInSpace(GenImmix.IMMIX, object)) {
046          return GenImmix.immixSpace.fastTraceObject(this, object);
047        }
048        return super.traceObject(object);
049      }
050    
051      @Override
052      public boolean isLive(ObjectReference object) {
053        if (object.isNull()) return false;
054        if (Space.isInSpace(GenImmix.IMMIX, object)) {
055          return GenImmix.immixSpace.isLive(object);
056        }
057        return super.isLive(object);
058      }
059    
060      @Override
061      public boolean willNotMoveInCurrentCollection(ObjectReference object) {
062        if (Space.isInSpace(GenImmix.IMMIX, object)) {
063          return true;
064        }
065        return super.willNotMoveInCurrentCollection(object);
066      }
067    
068      @Inline
069      @Override
070      protected void scanObject(ObjectReference object) {
071        super.scanObject(object);
072        if (MARK_LINE_AT_SCAN_TIME && Space.isInSpace(GenImmix.IMMIX, object))
073          GenImmix.immixSpace.markLines(object);
074      }
075    }