org.mmtk.vm
Class Memory

java.lang.Object
  extended by org.mmtk.vm.Memory
Direct Known Subclasses:
Memory

public abstract class Memory
extends Object


Constructor Summary
Memory()
           
 
Method Summary
(package private) static int alignmentValueTrapdoor(Memory m)
           
(package private) static Address availableEndTrapdoor(Memory m)
           
(package private) static Address availableStartTrapdoor(Memory m)
           
abstract  void collectorPrepareVMSpace()
          Per-collector preparation for a collection.
abstract  void collectorReleaseVMSpace()
          Per-collector post-collection work.
abstract  void dumpMemory(Address start, int beforeBytes, int afterBytes)
          Logs the contents of an address and the surrounding memory to the error output.
abstract  int dzmmap(Address start, int size)
          Demand zero mmaps an area of virtual memory.
protected abstract  int getAlignmentValueConstant()
           
protected abstract  Address getAvailableEndConstant()
           
protected abstract  Address getAvailableStartConstant()
           
protected abstract  Address getHeapEndConstant()
           
protected abstract  Address getHeapStartConstant()
           
protected abstract  byte getLogBytesInAddressConstant()
           
protected abstract  byte getLogBytesInPageConstant()
           
protected abstract  byte getLogBytesInWordConstant()
           
protected abstract  byte getLogMinAlignmentConstant()
           
protected abstract  byte getMaxAlignmentShiftConstant()
           
protected abstract  int getMaxBytesPaddingConstant()
           
abstract  ImmortalSpace getVMSpace()
          Return the space associated with/reserved for the VM.
abstract  void globalPrepareVMSpace()
          Global preparation for a collection.
abstract  void globalReleaseVMSpace()
          Global post-collection work.
(package private) static Address heapEndTrapdoor(Memory m)
           
(package private) static Address heapStartTrapdoor(Memory m)
           
abstract  void isync()
          Wait for all preceeding instructions to complete and discard any prefetched instructions on this processor.
(package private) static byte logBytesInAddressTrapdoor(Memory m)
           
(package private) static byte logBytesInPageTrapdoor(Memory m)
           
(package private) static byte logBytesInWordTrapdoor(Memory m)
           
(package private) static byte logMinAlignmentTrapdoor(Memory m)
           
(package private) static byte maxAlignmentShiftTrapdoor(Memory m)
           
(package private) static int maxBytesPaddingTrapdoor(Memory m)
           
abstract  boolean mprotect(Address start, int size)
          Protects access to an area of virtual memory.
abstract  boolean munprotect(Address start, int size)
          Allows access to an area of virtual memory.
abstract  void setHeapRange(int id, Address start, Address end)
          Sets the range of addresses associated with a heap.
abstract  void sync()
          Wait for preceeding cache flush/invalidate instructions to complete on all processors.
abstract  void zero(boolean useNT, Address start, Extent len)
          Zero a region of memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Memory

public Memory()
Method Detail

getVMSpace

public abstract ImmortalSpace getVMSpace()
Return the space associated with/reserved for the VM. In the case of Jikes RVM this is the boot image space.

Returns:
The space managed by the virtual machine.

globalPrepareVMSpace

public abstract void globalPrepareVMSpace()
Global preparation for a collection.


collectorPrepareVMSpace

public abstract void collectorPrepareVMSpace()
Per-collector preparation for a collection.


collectorReleaseVMSpace

public abstract void collectorReleaseVMSpace()
Per-collector post-collection work.


globalReleaseVMSpace

public abstract void globalReleaseVMSpace()
Global post-collection work.


setHeapRange

public abstract void setHeapRange(int id,
                                  Address start,
                                  Address end)
Sets the range of addresses associated with a heap.

Parameters:
id - the heap identifier
start - the address of the start of the heap
end - the address of the end of the heap

dzmmap

public abstract int dzmmap(Address start,
                           int size)
Demand zero mmaps an area of virtual memory.

Parameters:
start - the address of the start of the area to be mapped
size - the size, in bytes, of the area to be mapped
Returns:
0 if successful, otherwise the system errno

mprotect

public abstract boolean mprotect(Address start,
                                 int size)
Protects access to an area of virtual memory.

Parameters:
start - the address of the start of the area to be mapped
size - the size, in bytes, of the area to be mapped
Returns:
true if successful, otherwise false

munprotect

public abstract boolean munprotect(Address start,
                                   int size)
Allows access to an area of virtual memory.

Parameters:
start - the address of the start of the area to be mapped
size - the size, in bytes, of the area to be mapped
Returns:
true if successful, otherwise false

zero

public abstract void zero(boolean useNT,
                          Address start,
                          Extent len)
Zero a region of memory.

Parameters:
useNT - Use non temporal instructions (if available)
start - Start of address range (inclusive)
len - Length in bytes of range to zero

dumpMemory

public abstract void dumpMemory(Address start,
                                int beforeBytes,
                                int afterBytes)
Logs the contents of an address and the surrounding memory to the error output.

Parameters:
start - the address of the memory to be dumped
beforeBytes - the number of bytes before the address to be included
afterBytes - the number of bytes after the address to be included

sync

public abstract void sync()
Wait for preceeding cache flush/invalidate instructions to complete on all processors. Ensures that all memory writes before this point are visible to all processors.


isync

public abstract void isync()
Wait for all preceeding instructions to complete and discard any prefetched instructions on this processor. Also prevents the compiler from performing code motion across this point.


getHeapStartConstant

protected abstract Address getHeapStartConstant()
Returns:
The lowest address in the virtual address space known to MMTk

getHeapEndConstant

protected abstract Address getHeapEndConstant()
Returns:
The highest address in the virtual address space known to MMTk

getAvailableStartConstant

protected abstract Address getAvailableStartConstant()
Returns:
The lowest address in the contiguous address space available to MMTk

getAvailableEndConstant

protected abstract Address getAvailableEndConstant()
Returns:
The highest address in the contiguous address space available to MMTk

getLogBytesInAddressConstant

protected abstract byte getLogBytesInAddressConstant()
Returns:
The log base two of the size of an address

getLogBytesInWordConstant

protected abstract byte getLogBytesInWordConstant()
Returns:
The log base two of the size of a word

getLogBytesInPageConstant

protected abstract byte getLogBytesInPageConstant()
Returns:
The log base two of the size of an OS page

getLogMinAlignmentConstant

protected abstract byte getLogMinAlignmentConstant()
Returns:
The log base two of the minimum allocation alignment

getMaxAlignmentShiftConstant

protected abstract byte getMaxAlignmentShiftConstant()
Returns:
The log base two of (MAX_ALIGNMENT/MIN_ALIGNMENT)

getMaxBytesPaddingConstant

protected abstract int getMaxBytesPaddingConstant()
Returns:
The maximum number of bytes of padding to prepend to an object

getAlignmentValueConstant

protected abstract int getAlignmentValueConstant()
Returns:
The value to store in alignment holes

heapStartTrapdoor

static Address heapStartTrapdoor(Memory m)

heapEndTrapdoor

static Address heapEndTrapdoor(Memory m)

availableStartTrapdoor

static Address availableStartTrapdoor(Memory m)

availableEndTrapdoor

static Address availableEndTrapdoor(Memory m)

logBytesInAddressTrapdoor

static byte logBytesInAddressTrapdoor(Memory m)

logBytesInWordTrapdoor

static byte logBytesInWordTrapdoor(Memory m)

logBytesInPageTrapdoor

static byte logBytesInPageTrapdoor(Memory m)

logMinAlignmentTrapdoor

static byte logMinAlignmentTrapdoor(Memory m)

maxAlignmentShiftTrapdoor

static byte maxAlignmentShiftTrapdoor(Memory m)

maxBytesPaddingTrapdoor

static int maxBytesPaddingTrapdoor(Memory m)

alignmentValueTrapdoor

static int alignmentValueTrapdoor(Memory m)