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