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.policy;
014    
015    import org.mmtk.utility.alloc.SegregatedFreeListLocal;
016    import org.mmtk.utility.Constants;
017    
018    import org.vmmagic.pragma.*;
019    
020    /**
021     * This class implements unsynchronized (local) elements of a
022     * mark-sweep collector.  Allocation is via the segregated free list
023     * (@see SegregatedFreeList).  Marking is done using both a bit in
024     * each header's object word, and a mark bitmap.  Sweeping is
025     * performed lazily.<p>
026     *
027     * A free list block is a contiguous region of memory containing cells
028     * of a single size class, and is a construct of the
029     * SegregatedFreeList.  This class extends the block to include a mark
030     * bitmap.  During the mark phase, if an object is encountered with
031     * the mark bit in its header unset, it is set and the mark bit in the
032     * block header corresponding to that object is set.  The rationale
033     * behind this approach is that testing (and setting) the mark bit in
034     * the object header is cheap, while using a bitmap makes sweeping
035     * more efficient.  This approach maximizes the speed of the common
036     * case when marking, while also allowing for fast sweeping, with
037     * minimal space overhead (2 bits per object).
038     *
039     * @see org.mmtk.utility.alloc.SegregatedFreeList
040     * @see MarkSweepSpace
041     */
042    @Uninterruptible
043    public final class MarkSweepLocal extends SegregatedFreeListLocal<MarkSweepSpace> implements Constants {
044    
045      /****************************************************************************
046       *
047       * Initialization
048       */
049    
050      /**
051       * Constructor
052       *
053       * @param space The mark-sweep space to which this allocator
054       * instances is bound.
055       */
056      public MarkSweepLocal(MarkSweepSpace space) {
057        super(space);
058      }
059    
060      /****************************************************************************
061       *
062       * Collection
063       */
064    
065      /**
066       * Prepare for a collection. If paranoid, perform a sanity check.
067       */
068      public void prepare() {
069        flush();
070      }
071    
072      /**
073       * Finish up after a collection.
074       */
075      public void release() {}
076    }