|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.vm.gcspy.Util org.jikesrvm.mm.mmtk.gcspy.Util
public class Util
This class provides generally useful methods.
Field Summary | |
---|---|
private static boolean |
DEBUG_
|
static int |
KILOBYTE
|
static int |
MEGABYTE
|
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
Object |
createDataArray(Object templ,
int numElements)
Create an array of a particular type. |
void |
formatSize(Address buffer,
int size)
Pretty print a size, converting from bytes to kilo- or mega-bytes as appropriate |
Address |
formatSize(String format,
int bufsize,
int size)
Pretty print a size, converting from bytes to kilo- or mega-bytes as appropriate |
void |
free(Address addr)
Free an array of bytes previously allocated with malloc |
Address |
getBytes(String str)
Convert a String to a 0-terminated array of bytes WARNING: we call out to String.length and String.charAt, both of which are interruptible. |
Address |
malloc(int size)
Allocate an array of bytes with malloc |
int |
sprintf(Address str,
Address format,
Address value)
sprintf(char *str, char *format, char* value) |
Methods inherited from class org.mmtk.vm.gcspy.Util |
---|
dumpRange, numToBytes, numToBytes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG_
public static final int KILOBYTE
public static final int MEGABYTE
Constructor Detail |
---|
public Util()
Method Detail |
---|
public final Address malloc(int size)
Util
malloc
in class Util
size
- The size to allocate
Util.free(org.vmmagic.unboxed.Address)
public final void free(Address addr)
Util
free
in class Util
addr
- The address of some memory previously allocated with mallocUtil.malloc(int)
public final Address getBytes(String str)
WARNING: we call out to String.length and String.charAt, both of which are interruptible. We protect these calls with a swLock/swUnlock mechanism, as per VM.sysWrite on String.
getBytes
in class Util
str
- The string to convert
public final void formatSize(Address buffer, int size)
Util
formatSize
in class Util
buffer
- The buffer (in C space) in which to place the formatted sizesize
- The size in bytespublic final Address formatSize(String format, int bufsize, int size)
Util
formatSize
in class Util
format
- A format stringbufsize
- The size of a buffer large enough to hold the formatted resultsize
- The size in bytespublic Object createDataArray(Object templ, int numElements)
Util
Foo[] x = (Foo [])Stream.createDataArray(new Foo[0], numElements);
createDataArray
in class Util
templ
- a data array to use as a templatenumElements
- number of elements in new array
public final int sprintf(Address str, Address format, Address value)
Util
sprintf(char *str, char *format, char* value)
sprintf
in class Util
str
- The destination 'string' (memory in C space)format
- The format 'string' (memory in C space)value
- The value 'string' (memory in C space)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |