Modifier and Type | Field and Description |
---|---|
private static int |
SMALL_REGION_THRESHOLD
zero operations greater than this size are done using the
underlying OS implementation of zero()
|
Constructor and Description |
---|
Memory() |
Modifier and Type | Method and Description |
---|---|
private static void |
assertAligned(Address value) |
private static void |
assertAligned(Extent value) |
private static void |
assertAligned(int value)
Assert appropriate alignment, triggering an assertion failure if
the value does not satisfy the alignment requirement of the
memory operations.
|
private static void |
assertAligned(Word value) |
static void |
assertIsZeroed(Address start,
int bytes)
Assert that a memory range is zeroed.
|
static void |
dumpMemory(Address addr,
int beforeBytes,
int afterBytes)
Dump the contents of memory around a given address
|
private static boolean |
isSet(Address start,
int bytes,
boolean verbose,
int value)
Test whether a memory range is set to a given integer value
|
static boolean |
isSet(Address start,
int bytes,
int value)
Verbosely check and return
true if a memory range is set to some
integer value |
static boolean |
isZeroed(Address start,
int bytes)
Check that a memory range is zeroed
|
static void |
set(Address start,
int bytes,
int value)
Set a region of memory
|
static void |
zero(Address start,
Extent bytes)
Zero a region of memory
|
static void |
zeroSmall(Address start,
Extent bytes)
Zero a small region of memory
|
private static final int SMALL_REGION_THRESHOLD
public Memory()
public static void zero(Address start, Extent bytes)
start
- The start of the region to be zeroed (must be 4-byte aligned)bytes
- The number of bytes to be zeroed (must be 4-byte aligned)public static void zeroSmall(Address start, Extent bytes)
start
- The start of the region to be zeroed (must be 4-byte aligned)bytes
- The number of bytes to be zeroed (must be 4-byte aligned)public static void set(Address start, int bytes, int value)
start
- The start of the region to be zeroed (must be 4-byte aligned)bytes
- The number of bytes to be zeroed (must be 4-byte aligned)value
- The value to which the integers in the region should be setpublic static boolean isZeroed(Address start, int bytes)
start
- The start address of the range to be checkedbytes
- The size of the region to be checked, in bytestrue
if the region is zeroedpublic static void assertIsZeroed(Address start, int bytes)
this is in the inline allocation sequence when
VM.VERIFY_ASSERTIONS is true
, it is carefully written to
reduce the impact on code space.
start
- The start address of the range to be checkedbytes
- The size of the region to be checked, in bytespublic static boolean isSet(Address start, int bytes, int value)
true
if a memory range is set to some
integer valuestart
- The start address of the range to be checkedbytes
- The size of the region to be checked, in bytesvalue
- The value to which this region should be settrue
if the region has been correctly setprivate static void assertAligned(int value)
value
- The value to be testedprivate static void assertAligned(Word value)
private static void assertAligned(Extent value)
private static void assertAligned(Address value)
private static boolean isSet(Address start, int bytes, boolean verbose, int value)
start
- The address to start checking atbytes
- The size of the region to check, in bytesverbose
- If true
, produce verbose outputvalue
- The value to which the memory should be settrue
if the memory range is set to the given value,
false
if there's at least one address where another value
is savedpublic static void dumpMemory(Address addr, int beforeBytes, int afterBytes)
addr
- The address around which the memory should be dumpedbeforeBytes
- The number of bytes before the address to be
included in the dumpafterBytes
- The number of bytes after the address to be
included in the dump