|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.utility.heap.PageResource org.mmtk.utility.heap.FreeListPageResource
public final class FreeListPageResource
This class manages the allocation of pages for a space. When a page is requested by the space both a page budget and the use of virtual address space are checked. If the request for space can't be satisfied (for either reason) a GC may be triggered.
Field Summary | |
---|---|
private GenericFreeList |
freeList
|
private int |
highWaterMark
|
private int |
metaDataPagesPerRegion
|
private int |
pagesCurrentlyOnFreeList
|
Fields inherited from class org.mmtk.utility.heap.PageResource |
---|
committed, contiguous, reserved, space, start, ZERO_ON_RELEASE, zeroConcurrent, zeroingContext, zeroNT |
Constructor Summary | |
---|---|
FreeListPageResource(Space space,
Address start,
Extent bytes)
Constructor Contiguous free list resource. |
|
FreeListPageResource(Space space,
Address start,
Extent bytes,
int metaDataPagesPerRegion)
Constructor Contiguous free list resource. |
|
FreeListPageResource(Space space,
int metaDataPagesPerRegion)
Constructor Discontiguous monotone resource. |
Method Summary | |
---|---|
int |
adjustForMetaData(int pages)
Adjust a page request to include metadata requirements for a request of the given size. |
private int |
allocateContiguousChunks(int pages)
Allocate sufficient contiguous chunks within a discontiguous region to satisfy the pending request. |
protected Address |
allocPages(int reservedPages,
int requiredPages,
boolean zeroed)
Allocate pages pages from this resource. |
private void |
freeContiguousChunk(Address chunk)
Release a single chunk from a discontiguous region. |
int |
getAvailablePhysicalPages()
Return the number of available physical pages for this resource. |
Address |
getHighWater()
|
Extent |
getSize(Address first)
Return the size of the super page |
private void |
releaseFreeChunks(Address freedPage,
int pagesFreed)
The release of a page may have freed up an entire chunk or set of chunks. |
void |
releasePages(Address first)
Release a group of pages, associated with this page resource, that were allocated together, optionally zeroing on release and optionally memory protecting on release. |
private void |
reserveMetaData(Extent extent)
Reserve virtual address space for meta-data. |
void |
resizeFreeList(Address startAddress)
Resize the free list associated with this resource and nail down its start address. |
Methods inherited from class org.mmtk.utility.heap.PageResource |
---|
clearRequest, commitPages, committedPages, concurrentZeroing, cumulativeCommittedPages, getNewPages, lock, reservedPages, reservePages, skipConcurrentZeroing, triggerConcurrentZeroing, unlock, updateZeroingApproach |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final GenericFreeList freeList
private int highWaterMark
private final int metaDataPagesPerRegion
private int pagesCurrentlyOnFreeList
Constructor Detail |
---|
public FreeListPageResource(Space space, Address start, Extent bytes)
space
- The space to which this resource is attachedstart
- The start of the address range allocated to this resourcebytes
- The size of the address rage allocated to this resourcepublic FreeListPageResource(Space space, Address start, Extent bytes, int metaDataPagesPerRegion)
space
- The space to which this resource is attachedstart
- The start of the address range allocated to this resourcebytes
- The size of the address rage allocated to this resourcemetaDataPagesPerRegion
- The number of pages of meta data
that are embedded in each region.public FreeListPageResource(Space space, int metaDataPagesPerRegion)
space
- The space to which this resource is attachedMethod Detail |
---|
public int getAvailablePhysicalPages()
Note: This just considers physical pages (ie virtual memory pages allocated for use by this resource). This calculation is orthogonal to and does not consider any restrictions on the number of pages this resource may actually use at any time (ie the number of committed and reserved pages).
Note: The calculation is made on the assumption that all space that could be assigned to this resource would be assigned to this resource (ie the unused discontiguous space could just as likely be assigned to another competing resource).
getAvailablePhysicalPages
in class PageResource
protected Address allocPages(int reservedPages, int requiredPages, boolean zeroed)
pages
pages from this resource.If the request can be satisfied, then ensure the pages are mmpapped and zeroed before returning the address of the start of the region. If the request cannot be satisfied, return zero.
allocPages
in class PageResource
reservedPages
- The number of pages reserved due to the initial request.requiredPages
- The number of pages required to be allocated.zeroed
- If true allocated pages are zeroed.
public void releasePages(Address first)
first
- The first page in the group of pages that were
allocated together.private void releaseFreeChunks(Address freedPage, int pagesFreed)
freedPage
- The address of the page that was just freed.pagesFreed
- The number of pages made available when the page was freed.private int allocateContiguousChunks(int pages)
pages
- The number of pages currently being requested
private void freeContiguousChunk(Address chunk)
chunk
- The chunk to be freedprivate void reserveMetaData(Extent extent)
extent
- The size of this spacepublic int adjustForMetaData(int pages)
In the case of a free-list allocator, meta-data is pre-allocated, so simply return the un-adjusted request size.
adjustForMetaData
in class PageResource
pages
- The size of the pending allocation in pages
public Address getHighWater()
public Extent getSize(Address first)
first
- the Address of the first word in the superpage
public void resizeFreeList(Address startAddress)
startAddress
- The final start address for the discontiguous space.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |