|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jikesrvm.runtime.Memory
public class Memory
Low level memory management functions. Note that this class is "uninterruptible" - calling its methods will never cause the current thread to yield the cpu to another thread (one that might cause a gc, for example).
| Field Summary | |
|---|---|
private static int |
BYTES_IN_COPY
Number of bytes used when copying larger chunks of memory. |
static int |
MAP_ANONYMOUS
|
static int |
MAP_FIXED
|
static int |
MAP_PRIVATE
|
private static int |
NATIVE_THRESHOLD
How many bytes is considered large enough to justify the transition to C code to use memcpy? |
private static int |
pagesize
|
private static int |
pagesizeLog
|
static int |
PROT_EXEC
|
static int |
PROT_NONE
|
static int |
PROT_READ
|
static int |
PROT_WRITE
|
private static boolean |
USE_NATIVE
Allow the use of C based memcpy |
| Constructor Summary | |
|---|---|
Memory()
|
|
| Method Summary | |
|---|---|
static Address |
alignDown(Address address,
int alignment)
|
static int |
alignDown(int address,
int alignment)
|
static void |
aligned32Copy(Address dst,
Address src,
int numBytes)
|
static void |
aligned32Copy(Address dst,
Address src,
Offset numBytes)
Copy numbytes from src to dst. |
static void |
alignedWordCopy(Address dst,
Address src,
int numBytes)
Copy numbytes from src to dst. |
static Address |
alignUp(Address address,
int alignment)
|
static int |
alignUp(int address,
int alignment)
|
static void |
arraycopy16Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
Low level copy of copyBytes bytes from src[srcPos] to dst[dstPos]. |
static void |
arraycopy16Bit(Object src,
int srcPos,
Object dst,
int dstPos,
int len)
Low level copy of len elements from src[srcPos] to dst[dstPos]. |
static void |
arraycopy32Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
Low level copy of copyBytes bytes from src[srcPos] to dst[dstPos]. |
static void |
arraycopy32Bit(Object src,
int srcIdx,
Object dst,
int dstIdx,
int len)
Low level copy of len elements from src[srcPos] to dst[dstPos]. |
static void |
arraycopy64Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
Low level copy of copyBytes bytes from src[srcPos] to dst[dstPos]. |
static void |
arraycopy64Bit(Object src,
int srcIdx,
Object dst,
int dstIdx,
int len)
Low level copy of len elements from src[srcPos] to dst[dstPos]. |
static void |
arraycopy8Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
Low level copy of copyBytes bytes from src[srcPos] to dst[dstPos]. |
static void |
arraycopy8Bit(Object src,
int srcPos,
Object dst,
int dstPos,
int len)
Low level copy of len elements from src[srcPos] to dst[dstPos]. |
private static void |
copy1Bytes(Address dstPtr,
Address srcPtr)
|
private static void |
copy2Bytes(Address dstPtr,
Address srcPtr)
|
private static void |
copy4Bytes(Address dstPtr,
Address srcPtr)
|
private static void |
copy8Bytes(Address dstPtr,
Address srcPtr)
|
static void |
dumpMemory(Address start,
int beforeBytes,
int afterBytes)
|
static Address |
dzmmap(Address address,
Extent size)
Do mmap demand zero fixed address memory mapping call |
static int |
getPagesize()
Do getpagesize call |
private static void |
internalAlignedWordCopy(Address dst,
Address src,
int numBytes)
Copy numbytes from src to dst. |
static boolean |
isPageAligned(Address addr)
|
static boolean |
isPageMultiple(Extent val)
|
static boolean |
isPageMultiple(int val)
|
static boolean |
isPageMultiple(Offset val)
|
static void |
memcopy(Address dst,
Address src,
Extent cnt)
Copy a region of memory. |
static void |
memcopy(Address dst,
Address src,
int cnt)
|
static Address |
mmap(Address address,
Extent size,
int prot,
int flags)
Do generic mmap non-file memory mapping call |
static boolean |
mprotect(Address address,
Extent size,
int prot)
Do mprotect system call |
static void |
sync(Address address,
int size)
Synchronize a region of memory: force data in dcache to be written out to main memory so that it will be seen by icache when instructions are fetched back. |
static void |
zero(Address start,
Extent len)
Zero a region of memory. |
static void |
zeroPages(Address start,
int len)
Zero a range of pages of memory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int NATIVE_THRESHOLD
private static final boolean USE_NATIVE
private static final int BYTES_IN_COPY
public static final int PROT_NONE
public static final int PROT_READ
public static final int PROT_WRITE
public static final int PROT_EXEC
public static final int MAP_PRIVATE
public static final int MAP_FIXED
public static final int MAP_ANONYMOUS
private static int pagesize
private static int pagesizeLog
| Constructor Detail |
|---|
public Memory()
| Method Detail |
|---|
private static void copy8Bytes(Address dstPtr,
Address srcPtr)
private static void copy4Bytes(Address dstPtr,
Address srcPtr)
private static void copy2Bytes(Address dstPtr,
Address srcPtr)
private static void copy1Bytes(Address dstPtr,
Address srcPtr)
public static void arraycopy8Bit(Object src,
int srcPos,
Object dst,
int dstPos,
int len)
src != dst || (scrPos >= dstPos + 4)
and src and dst are 8Bit arrays.
src - the source arraysrcPos - index in the source array to begin copydst - the destination arraydstPos - index in the destination array to being copylen - number of array elements to copy
public static void arraycopy8Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
copyBytes bytes from src[srcPos] to dst[dstPos].
Assumption src != dst || (srcPos >= dstPos) and element size is 4 bytes.
srcPtr - The source start addressdstPtr - The destination start addresscopyBytes - The number of bytes to be copied
public static void arraycopy16Bit(Object src,
int srcPos,
Object dst,
int dstPos,
int len)
src - the source arraysrcPos - index in the source array to begin copydst - the destination arraydstPos - index in the destination array to being copylen - number of array elements to copy
public static void arraycopy16Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
copyBytes bytes from src[srcPos] to dst[dstPos].
Assumption src != dst || (srcPos >= dstPos) and element size is 2 bytes.
srcPtr - The source start addressdstPtr - The destination start addresscopyBytes - The number of bytes to be copied
public static void arraycopy32Bit(Object src,
int srcIdx,
Object dst,
int dstIdx,
int len)
len elements from src[srcPos] to dst[dstPos].
Assumption: src != dst || (srcPos >= dstPos) and element size is 4 bytes.
src - the source arraysrcIdx - index in the source array to begin copydst - the destination arraydstIdx - index in the destination array to being copylen - number of array elements to copy
public static void arraycopy32Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
copyBytes bytes from src[srcPos] to dst[dstPos].
Assumption src != dst || (srcPos >= dstPos) and element size is 4 bytes.
srcPtr - The source start addressdstPtr - The destination start addresscopyBytes - The number of bytes to be copied
public static void arraycopy64Bit(Object src,
int srcIdx,
Object dst,
int dstIdx,
int len)
len elements from src[srcPos] to dst[dstPos].
Assumption src != dst || (srcPos >= dstPos) and element size is 8 bytes.
src - the source arraysrcIdx - index in the source array to begin copydst - the destination arraydstIdx - index in the destination array to being copylen - number of array elements to copy
public static void arraycopy64Bit(Address srcPtr,
Address dstPtr,
int copyBytes)
copyBytes bytes from src[srcPos] to dst[dstPos].
Assumption src != dst || (srcPos >= dstPos) and element size is 8 bytes.
srcPtr - The source start addressdstPtr - The destination start addresscopyBytes - The number of bytes to be copied
public static void aligned32Copy(Address dst,
Address src,
Offset numBytes)
dst - the destination addrsrc - the source addrnumBytes - the number of bytes top copy
public static void aligned32Copy(Address dst,
Address src,
int numBytes)
public static void alignedWordCopy(Address dst,
Address src,
int numBytes)
dst - the destination addrsrc - the source addrnumBytes - the number of bytes top copy
private static void internalAlignedWordCopy(Address dst,
Address src,
int numBytes)
numbytes from src to dst.
Assumption either the ranges are non overlapping, or src >= dst + BYTES_IN_ADDRESS.
dst - The destination addrsrc - The source addrnumBytes - The number of bytes to copy
public static void memcopy(Address dst,
Address src,
Extent cnt)
dst - Destination addresssrc - Source addresscnt - Number of bytes to copy
Assumption: source and destination regions do not overlap
public static void memcopy(Address dst,
Address src,
int cnt)
public static void zero(Address start,
Extent len)
start - of address range (inclusive)len - extent to zero.
public static void zeroPages(Address start,
int len)
start - Starting address (must be a page address)len - Number of bytes (must be multiple of page size)
public static void sync(Address address,
int size)
address - Start of address rangesize - Size of address range (bytes)public static boolean isPageMultiple(int val)
public static boolean isPageMultiple(Extent val)
public static boolean isPageMultiple(Offset val)
public static boolean isPageAligned(Address addr)
public static Address mmap(Address address,
Extent size,
int prot,
int flags)
address - Start of address range (Address)size - Size of address rangeprot - Protection (int)flags - (int)
public static Address dzmmap(Address address,
Extent size)
address - Start of address rangesize - Size of address range
public static boolean mprotect(Address address,
Extent size,
int prot)
address - Start of address range (Address)size - Size of address rangeprot - Protection (int)
public static int getPagesize()
public static void dumpMemory(Address start,
int beforeBytes,
int afterBytes)
public static Address alignUp(Address address,
int alignment)
public static Address alignDown(Address address,
int alignment)
public static int alignUp(int address,
int alignment)
public static int alignDown(int address,
int alignment)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||