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.plan.TransitiveClosure; 016import org.mmtk.utility.heap.FreeListPageResource; 017import org.mmtk.utility.heap.VMRequest; 018 019import org.mmtk.vm.VM; 020 021import org.vmmagic.pragma.*; 022import org.vmmagic.unboxed.*; 023 024/** 025 * Each instance of this class corresponds to one raw page space.<p> 026 * 027 * This class provides access to raw memory for managing internal meta 028 * data. 029 */ 030@Uninterruptible 031public final class RawPageSpace extends Space { 032 033 /** 034 * The caller specifies the region of virtual memory to be used for 035 * this space. If this region conflicts with an existing space, 036 * then the constructor will fail. 037 * 038 * @param name The name of this space (used when printing error messages etc) 039 * @param vmRequest An object describing the virtual memory requested. 040 */ 041 public RawPageSpace(String name, VMRequest vmRequest) { 042 super(name, false, false, true, vmRequest); 043 if (vmRequest.isDiscontiguous()) { 044 pr = new FreeListPageResource(this, 0); 045 } else { 046 pr = new FreeListPageResource(this, start, extent); 047 } 048 } 049 050 public void prepare() { } 051 public void release() { } 052 053 /** 054 * Release a group of pages that were allocated together. 055 * 056 * @param first The first page in the group of pages that were 057 * allocated together. 058 */ 059 @Override 060 @Inline 061 public void release(Address first) { 062 ((FreeListPageResource) pr).releasePages(first); 063 } 064 065 /** 066 * Trace an object.<p> 067 * 068 * This makes no sense for a raw page space and should never be 069 * called. 070 * 071 * @param object The object to be traced. 072 * @return <code>zero</code>: calling this is an error. 073 */ 074 @Override 075 @Inline 076 public ObjectReference traceObject(TransitiveClosure trace, ObjectReference object) { 077 if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); 078 return ObjectReference.nullReference(); 079 } 080 081 @Override 082 public boolean isLive(ObjectReference object) { 083 return true; 084 } 085}