|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.mm.mminterface.MemoryManager
public final class MemoryManager
The interface that the MMTk memory manager presents to Jikes RVM
Field Summary | |
---|---|
private static boolean |
booted
Has the interface been booted yet? |
private static boolean |
CHECK_MEMORY_IS_ZEROED
true if checking of allocated memory to ensure it is
zeroed is desired. |
private static boolean |
collectionEnabled
Has garbage collection been enabled yet? |
private static boolean |
traceAllocator
|
Fields inherited from interface org.jikesrvm.HeapLayoutConstants |
---|
BAD_MAP_COMPRESSION, BOOT_IMAGE_CODE_END, BOOT_IMAGE_CODE_SIZE, BOOT_IMAGE_CODE_START, BOOT_IMAGE_DATA_END, BOOT_IMAGE_DATA_SIZE, BOOT_IMAGE_DATA_START, BOOT_IMAGE_END, BOOT_IMAGE_RMAP_END, BOOT_IMAGE_RMAP_START, MAX_BOOT_IMAGE_RMAP_SIZE, MAXIMUM_MAPPABLE |
Constructor Summary | |
---|---|
private |
MemoryManager()
Suppress default constructor to enforce noninstantiability. |
Method Summary | |
---|---|
static void |
addFinalizer(Object object)
Adds an object to the list of objects to have their finalize method called when they are reclaimed. |
static void |
addPhantomReference(PhantomReference<?> obj,
Object referent)
Add a phantom reference to the list of phantom references. |
static boolean |
addressInVM(Address address)
Checks if an address refers to an in-use area of memory. |
static void |
addSoftReference(SoftReference<?> obj,
Object referent)
Add a soft reference to the list of soft references. |
static void |
addWeakReference(WeakReference<?> obj,
Object referent)
Add a weak reference to the list of weak references. |
static Offset |
alignAllocation(Offset initialOffset,
int align,
int offset)
Align an allocation using some modulo arithmetic to guarantee the following property: (region + offset) % alignment == 0 |
static Object |
allocateArray(int numElements,
int logElementSize,
int headerSize,
TIB tib,
int allocator,
int align,
int offset,
int site)
Allocate an array object. |
private static Object |
allocateArrayInternal(int numElements,
int size,
TIB tib,
int allocator,
int align,
int offset,
int site)
Allocate an array object. |
static ArchitectureSpecific.CodeArray |
allocateCode(int numInstrs,
boolean isHot)
Allocate a CodeArray into a code space. |
static Object |
allocateScalar(int size,
TIB tib,
int allocator,
int align,
int offset,
int site)
Allocate a scalar object. |
static Address |
allocateSpace(CollectorContext context,
int bytes,
int align,
int offset,
int allocator,
ObjectReference from)
Allocate space for GC-time copying of an object |
private static Address |
allocateSpace(Selected.Mutator mutator,
int bytes,
int align,
int offset,
int allocator,
int site)
Allocate space for runtime allocation of an object |
static void |
boot(BootRecord theBootRecord)
Initialization that occurs at boot time (runtime initialization). |
static Word |
bootTimeWriteBarrier(Word value)
Install a reference into the boot image. |
static boolean |
collectionEnabled()
Is collection enabled? |
static SpecializedMethod |
createSpecializedMethod(int id)
Initialize a specified specialized method. |
static void |
dumpRef(ObjectReference ref)
Logs information about a reference to the error output. |
static void |
enableCollection()
Allow collection (assumes threads can be created). |
static void |
flushMutatorContext()
Flush the mutator context. |
static Extent |
freeMemory()
Returns the amount of free memory. |
static void |
fullyBootedVM()
Notify the MM that the host VM is now fully booted. |
static void |
gc()
External call to force a garbage collection. |
static boolean |
gcInProgress()
Returns true if GC is in progress. |
static int |
getAllocationSite(boolean compileTime)
Return an allocation site upon request. |
static Object |
getFinalizedObject()
Gets an object from the list of objects that are to be reclaimed and need to have their finalize method called. |
static int |
getMaxHeaps()
Returns the maximum number of heaps that can be managed. |
static Extent |
getMaxHeapSize()
Return the max heap size in bytes (as set by -Xmx). |
static void |
initializeHeader(BootImageInterface bootImage,
Address ref,
TIB tib,
int size,
boolean isScalar)
Override the boot-time initialization method here, so that the core JMTk code doesn't need to know about the BootImageInterface type. |
static boolean |
isImmortal(Object obj)
Will this object move (allows us to optimize some JNI calls) |
private static boolean |
isPrefix(String a,
byte[] b)
Is string a a prefix of string
b . |
static Extent |
maxMemory()
Returns the maximum amount of memory VM will attempt to use. |
static boolean |
mightBeFP(Address address)
Return true if address is in a space which may contain stacks |
static boolean |
mightBeTIB(ObjectReference obj)
Check if object might be a TIB. |
static void |
modifyCheck(Object object)
Checks that if a garbage collection is in progress then the given object is not movable. |
static int[] |
newContiguousIntArray(int n)
Allocate a contiguous int array |
static IMT |
newIMT()
Allocate a new interface method table (IMT). |
static ITable |
newITable(int size)
Allocate a new ITable |
static ITableArray |
newITableArray(int size)
Allocate a new ITableArray |
static double[] |
newNonMovingDoubleArray(int size)
Allocate a non moving double array |
static int[] |
newNonMovingIntArray(int size)
Allocate a non moving int array |
static short[] |
newNonMovingShortArray(int size)
Allocate a non moving int array |
static WordArray |
newNonMovingWordArray(int size)
Allocate a non moving word array |
static Object |
newRuntimeTable(int size,
RVMType type)
Allocate a new runtime table (at runtime) |
static byte[] |
newStack(int bytes)
Allocate a stack |
static TIB |
newTIB(int numVirtualMethods,
int alignCode)
Allocate a new type information block (TIB). |
static void |
notifyClassResolved(RVMType vmType)
A new type has been resolved by the VM. |
static int |
numSpecializedMethods()
Return the number of specialized methods. |
static boolean |
objectInVM(ObjectReference object)
Checks if a reference refers to an object in an in-use area of memory. |
static int |
pickAllocator(RVMType type)
Returns the appropriate allocation scheme/area for the given type. |
static int |
pickAllocator(RVMType type,
RVMMethod method)
Returns the appropriate allocation scheme/area for the given type and given method requesting the allocation. |
private static int |
pickAllocatorForType(RVMType type)
Determine the default allocator to be used for a given type. |
static void |
postBoot()
Perform postBoot operations such as dealing with command line options (this is called as soon as options have been parsed, which is necessarily after the basic allocator boot). |
static void |
processCommandLineArg(String arg)
Process GC parameters. |
static void |
startGCspyServer()
Start the GCspy server |
private static void |
throwLargeArrayOutOfMemoryError()
Throw an out of memory error due to an array allocation request that is larger than the maximum allowed value. |
static Extent |
totalMemory()
Returns the amount of total memory. |
static boolean |
validRef(ObjectReference ref)
Checks if a reference is valid. |
static boolean |
willNeverMove(Object obj)
Will this object move (allows us to optimize some JNI calls) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean CHECK_MEMORY_IS_ZEROED
true
if checking of allocated memory to ensure it is
zeroed is desired.
private static final boolean traceAllocator
private static boolean booted
private static boolean collectionEnabled
Constructor Detail |
---|
private MemoryManager()
Method Detail |
---|
public static void boot(BootRecord theBootRecord)
theBootRecord
- the boot record. Contains information about
the heap size.public static void postBoot()
public static void enableCollection()
public static boolean collectionEnabled()
public static void fullyBootedVM()
public static void processCommandLineArg(String arg)
public static void modifyCheck(Object object)
object
- the object to checkpublic static Extent freeMemory()
public static Extent totalMemory()
public static Extent maxMemory()
public static void gc()
public static void dumpRef(ObjectReference ref)
ref
- the address to log information aboutpublic static boolean validRef(ObjectReference ref)
ref
- the address to be checked
true
if the reference is validpublic static boolean addressInVM(Address address)
address
- the address to be checked
true
if the address refers to an in use areapublic static boolean objectInVM(ObjectReference object)
References may be addresses just outside the memory region allocated to the object.
object
- the reference to be checked
true
if the object refered to is in an
in-use areapublic static boolean mightBeFP(Address address)
address
- The address to be checked
public static int getAllocationSite(boolean compileTime)
compileTime
- true
if this request is being made in the
context of a compilation.
public static int pickAllocator(RVMType type)
type
- the type of the object to be allocated
private static boolean isPrefix(String a, byte[] b)
a
a prefix of string
b
. String b
is encoded as an ASCII byte
array.
a
- prefix stringb
- string which may contain prefix, encoded as an ASCII
byte array.
true
if a
is a prefix of
b
public static int pickAllocator(RVMType type, RVMMethod method)
type
- the type of the object to be allocatedmethod
- the method requesting the allocation
private static int pickAllocatorForType(RVMType type)
type
- The type in question
type
.public static Object allocateScalar(int size, TIB tib, int allocator, int align, int offset, int site)
size
- Size in bytes of the object, including any headers
that need space.tib
- Type of the object (pointer to TIB).allocator
- Specify which allocation scheme/area JMTk should
allocate the memory from.align
- the alignment requested; must be a power of 2.offset
- the offset at which the alignment is desired.site
- allocation site.
public static Object allocateArray(int numElements, int logElementSize, int headerSize, TIB tib, int allocator, int align, int offset, int site)
numElements
- number of array elementslogElementSize
- size in bytes of an array element, log base 2.headerSize
- size in bytes of array headertib
- type information block for array objectallocator
- int that encodes which allocator should be usedalign
- the alignment requested; must be a power of 2.offset
- the offset at which the alignment is desired.site
- allocation site.
private static void throwLargeArrayOutOfMemoryError()
private static Object allocateArrayInternal(int numElements, int size, TIB tib, int allocator, int align, int offset, int site)
numElements
- The number of element bytessize
- size in bytes of array headertib
- type information block for array objectallocator
- int that encodes which allocator should be usedalign
- the alignment requested; must be a power of 2.offset
- the offset at which the alignment is desired.site
- allocation site.
null
See also: bytecode 0xbc ("newarray") and 0xbd ("anewarray")private static Address allocateSpace(Selected.Mutator mutator, int bytes, int align, int offset, int allocator, int site)
mutator
- The mutator instance to be used for this allocationbytes
- The size of the allocation in bytesalign
- The alignment requested; must be a power of 2.offset
- The offset at which the alignment is desired.allocator
- The MMTk allocator to be used (if allocating)site
- Allocation site.
public static Address allocateSpace(CollectorContext context, int bytes, int align, int offset, int allocator, ObjectReference from)
context
- The collector context to be used for this allocationbytes
- The size of the allocation in bytesalign
- The alignment requested; must be a power of 2.offset
- The offset at which the alignment is desired.from
- The source object from which this is to be copied
public static Offset alignAllocation(Offset initialOffset, int align, int offset)
(region + offset) % alignment == 0
initialOffset
- The initial (unaligned) start value of the
allocated region of memory.align
- The alignment requested, must be a power of twooffset
- The offset at which the alignment is desired
initialOffset
plus some delta (possibly 0) such
that the return value is aligned according to the above
constraints.public static ArchitectureSpecific.CodeArray allocateCode(int numInstrs, boolean isHot)
numInstrs
- number of instructionsisHot
- is this a request for hot code space allocation?
public static byte[] newStack(int bytes)
bytes
- The number of bytes to allocate
public static WordArray newNonMovingWordArray(int size)
size
- The size of the arraypublic static double[] newNonMovingDoubleArray(int size)
size
- The size of the arraypublic static int[] newNonMovingIntArray(int size)
size
- The size of the arraypublic static short[] newNonMovingShortArray(int size)
size
- The size of the arraypublic static TIB newTIB(int numVirtualMethods, int alignCode)
numVirtualMethods
- the number of virtual method slots in the TIBalignCode
- TODO
public static IMT newIMT()
public static ITable newITable(int size)
size
- the number of slots in the ITable
public static ITableArray newITableArray(int size)
size
- the number of slots in the ITableArray
public static Object newRuntimeTable(int size, RVMType type)
size
- The size of the table.
public static boolean willNeverMove(Object obj)
public static boolean isImmortal(Object obj)
public static void addFinalizer(Object object)
finalize
method called when they are reclaimed.
object
- the object to be added to the finalizer's listpublic static Object getFinalizedObject()
finalize
method called.
public static void addSoftReference(SoftReference<?> obj, Object referent)
obj
- the soft reference to be added to the listpublic static void addWeakReference(WeakReference<?> obj, Object referent)
obj
- the weak reference to be added to the listpublic static void addPhantomReference(PhantomReference<?> obj, Object referent)
obj
- the phantom reference to be added to the listpublic static Extent getMaxHeapSize()
public static void notifyClassResolved(RVMType vmType)
vmType
- The newly resolved typepublic static boolean mightBeTIB(ObjectReference obj)
obj
- address of object to check
false
if the object is in the wrong
allocation scheme/area for a TIB, true
otherwisepublic static boolean gcInProgress()
public static void startGCspyServer()
public static void flushMutatorContext()
public static int numSpecializedMethods()
public static SpecializedMethod createSpecializedMethod(int id)
id
- the specializedMethodpublic static void initializeHeader(BootImageInterface bootImage, Address ref, TIB tib, int size, boolean isScalar)
public static Word bootTimeWriteBarrier(Word value)
public static int getMaxHeaps()
public static int[] newContiguousIntArray(int n)
n
- The number of ints
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |