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.BumpPointer; 016 import org.vmmagic.pragma.Uninterruptible; 017 import org.vmmagic.unboxed.Extent; 018 019 /** 020 * This class implements unsynchronized (local) elements of a 021 * sliding mark-compact collector. Allocation is via the bump pointer 022 * (@see BumpPointer). 023 * 024 * @see BumpPointer 025 * @see MarkCompactSpace 026 */ 027 @Uninterruptible 028 public final class MarkCompactLocal extends BumpPointer { 029 030 /** 031 * Constructor 032 * 033 * @param space The space to bump point into. 034 */ 035 public MarkCompactLocal(MarkCompactSpace space) { 036 super(space, true); 037 } 038 039 private MarkCompactSpace mcSpace() { 040 return (MarkCompactSpace)space; 041 } 042 043 /** 044 * Prepare for collection: update the metadata for the current region, and flush 045 * this bump-pointer's allocations to the global page list. 046 */ 047 public void prepare() { 048 if (!initialRegion.isZero()) { 049 setDataEnd(region,cursor); 050 mcSpace().append(initialRegion); 051 } 052 reset(); 053 } 054 055 /** 056 * Flush this thread-local component in preparation for the mutator thread 057 * to die. 058 */ 059 public void flush() { 060 prepare(); 061 } 062 063 @Override 064 protected Extent maximumRegionSize() { return Extent.fromIntZeroExtend(4 << LOG_BLOCK_SIZE) ; } 065 066 }