public abstract class GenericHeap extends java.lang.Object implements Heap, java.lang.Iterable<ElementInfo>
| Modifier and Type | Class and Description |
|---|---|
protected class |
GenericHeap.ElementInfoMarker |
| Modifier and Type | Field and Description |
|---|---|
protected int |
attributes |
protected GenericHeap.ElementInfoMarker |
elementInfoMarker |
protected java.util.Map<java.lang.Integer,IntTable<java.lang.String>> |
internStringsMap |
protected boolean |
liveBitValue |
protected ObjectQueue<ElementInfo> |
markQueue |
protected int |
nLiveObjects |
protected IntVector |
pinDownList |
protected VM |
vm |
protected java.util.ArrayList<ElementInfo> |
weakRefs |
| Constructor and Description |
|---|
GenericHeap(Config config,
KernelState ks) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addToInternStrings(java.lang.String str,
int objref,
int prcId) |
protected void |
addToPinDownList(int objref) |
void |
checkConsistency(boolean isStateStore) |
void |
cleanUpDanglingReferences()
clean up reference values that are stored outside of reference fields
called from KernelState to process live ElementInfos after GC has finished
and only live objects remain in the heap.
|
protected void |
cleanupWeakRefs()
reset all weak references that now point to collected objects to 'null'
NOTE: this implementation requires our own Reference/WeakReference implementation, to
make sure the 'ref' field is the first one
|
protected ElementInfo |
createArray(java.lang.String elementType,
int nElements,
ClassInfo ci,
ThreadInfo ti,
int objref) |
protected DynamicElementInfo |
createElementInfo(int objref,
ClassInfo ci,
Fields f,
Monitor m,
ThreadInfo ti) |
protected ElementInfo |
createObject(ClassInfo ci,
ThreadInfo ti,
int objref) |
void |
gc() |
abstract ElementInfo |
get(int ref)
public getter to access but not change ElementInfos
|
protected ClassInfo |
getArrayClassInfo(ThreadInfo ti,
java.lang.String elementType) |
abstract Memento<Heap> |
getMemento() |
abstract Memento<Heap> |
getMemento(MementoFactory factory) |
abstract ElementInfo |
getModifiable(int ref)
public getter to access modifiable ElementInfos;
|
protected abstract int |
getNewElementInfoIndex(AllocationContext ctx)
this is called for newXX(..) allocations that are SUT thread specific, i.e.
|
protected abstract AllocationContext |
getSUTAllocationContext(ClassInfo ci,
ThreadInfo ti) |
protected abstract AllocationContext |
getSystemAllocationContext(ClassInfo ci,
ThreadInfo ti,
int anchor) |
boolean |
hasChanged() |
protected ElementInfo |
initializeStringObject(java.lang.String str,
int index,
int vref) |
boolean |
isAlive(ElementInfo ei)
check if object is alive.
|
boolean |
isGcEnabled() |
boolean |
isOutOfMemory() |
abstract java.util.Iterator<ElementInfo> |
iterator()
return Iterator for all non-null ElementInfo entries
|
abstract java.lang.Iterable<ElementInfo> |
liveObjects() |
protected void |
mark() |
void |
markChanged(int objref) |
protected void |
markFinalizableObjects() |
void |
markStaticRoot(int objref)
called during non-recursive phase1 marking of all objects reachable
from static fields
|
void |
markThreadRoot(int objref,
int tid)
called during non-recursive phase1 marking of all objects reachable
from Thread roots
|
ElementInfo |
newArray(java.lang.String elementType,
int nElements,
ThreadInfo ti) |
ElementInfo |
newInternString(java.lang.String str,
ThreadInfo ti) |
ElementInfo |
newObject(ClassInfo ci,
ThreadInfo ti) |
protected ElementInfo |
newString(ClassInfo ciString,
ClassInfo ciChars,
java.lang.String str,
ThreadInfo ti,
AllocationContext ctx) |
ElementInfo |
newString(java.lang.String str,
ThreadInfo ti) |
ElementInfo |
newSystemArray(java.lang.String elementType,
int nElements,
ThreadInfo ti,
int anchor) |
ElementInfo |
newSystemObject(ClassInfo ci,
ThreadInfo ti,
int anchor) |
ElementInfo |
newSystemString(java.lang.String str,
ThreadInfo ti,
int anchor) |
ElementInfo |
newSystemThrowable(ClassInfo ciThrowable,
java.lang.String details,
int[] stackSnapshot,
int causeRef,
ThreadInfo ti,
int anchor) |
void |
queueMark(int objref)
add a non-null, not yet marked reference to the markQueue
called from ElementInfo.markRecursive().
|
void |
registerPinDown(int objref) |
void |
registerWeakReference(ElementInfo ei) |
void |
releasePinDown(int objref) |
protected abstract void |
remove(int ref)
internal remover used by generic sweep
|
protected void |
removeFromPinDownList(int objref) |
abstract void |
resetVolatiles() |
abstract void |
restoreVolatiles() |
protected abstract void |
set(int index,
ElementInfo ei)
internal setter used during allocation
|
void |
setGcEnabled(boolean doGC) |
void |
setOutOfMemory(boolean isOutOfMemory) |
void |
setStored() |
protected void |
sweep()
this implementation uses a generic ElementInfo iterator, it can be replaced
with a more efficient container specific version
|
void |
unmarkAll() |
protected VM vm
protected IntVector pinDownList
protected java.util.Map<java.lang.Integer,IntTable<java.lang.String>> internStringsMap
protected int attributes
protected java.util.ArrayList<ElementInfo> weakRefs
protected ObjectQueue<ElementInfo> markQueue
protected boolean liveBitValue
protected GenericHeap.ElementInfoMarker elementInfoMarker
protected int nLiveObjects
public GenericHeap(Config config, KernelState ks)
protected DynamicElementInfo createElementInfo(int objref, ClassInfo ci, Fields f, Monitor m, ThreadInfo ti)
protected void addToPinDownList(int objref)
protected void removeFromPinDownList(int objref)
public void registerPinDown(int objref)
registerPinDown in interface Heappublic void releasePinDown(int objref)
releasePinDown in interface Heappublic void registerWeakReference(ElementInfo ei)
registerWeakReference in interface Heapprotected void cleanupWeakRefs()
protected abstract AllocationContext getSUTAllocationContext(ClassInfo ci, ThreadInfo ti)
protected abstract AllocationContext getSystemAllocationContext(ClassInfo ci, ThreadInfo ti, int anchor)
protected abstract int getNewElementInfoIndex(AllocationContext ctx)
protected ElementInfo createObject(ClassInfo ci, ThreadInfo ti, int objref)
public ElementInfo newObject(ClassInfo ci, ThreadInfo ti)
public ElementInfo newSystemObject(ClassInfo ci, ThreadInfo ti, int anchor)
newSystemObject in interface Heapprotected ElementInfo createArray(java.lang.String elementType, int nElements, ClassInfo ci, ThreadInfo ti, int objref)
protected ClassInfo getArrayClassInfo(ThreadInfo ti, java.lang.String elementType)
public ElementInfo newArray(java.lang.String elementType, int nElements, ThreadInfo ti)
public ElementInfo newSystemArray(java.lang.String elementType, int nElements, ThreadInfo ti, int anchor)
newSystemArray in interface Heapprotected ElementInfo initializeStringObject(java.lang.String str, int index, int vref)
protected ElementInfo newString(ClassInfo ciString, ClassInfo ciChars, java.lang.String str, ThreadInfo ti, AllocationContext ctx)
public ElementInfo newString(java.lang.String str, ThreadInfo ti)
public ElementInfo newSystemString(java.lang.String str, ThreadInfo ti, int anchor)
newSystemString in interface Heappublic ElementInfo newInternString(java.lang.String str, ThreadInfo ti)
newInternString in interface Heapprotected void addToInternStrings(java.lang.String str,
int objref,
int prcId)
public ElementInfo newSystemThrowable(ClassInfo ciThrowable, java.lang.String details, int[] stackSnapshot, int causeRef, ThreadInfo ti, int anchor)
newSystemThrowable in interface Heapprotected abstract void set(int index,
ElementInfo ei)
index - ei - public abstract ElementInfo get(int ref)
public abstract ElementInfo getModifiable(int ref)
getModifiable in interface Heapprotected abstract void remove(int ref)
public abstract java.util.Iterator<ElementInfo> iterator()
iterator in interface java.lang.Iterable<ElementInfo>public abstract java.lang.Iterable<ElementInfo> liveObjects()
liveObjects in interface Heappublic boolean isGcEnabled()
public void setGcEnabled(boolean doGC)
public void queueMark(int objref)
public void markStaticRoot(int objref)
markStaticRoot in interface Heappublic void markThreadRoot(int objref,
int tid)
markThreadRoot in interface Heapprotected void sweep()
protected void markFinalizableObjects()
protected void mark()
public void cleanUpDanglingReferences()
cleanUpDanglingReferences in interface Heappublic boolean isAlive(ElementInfo ei)
public abstract void resetVolatiles()
resetVolatiles in interface Heappublic abstract void restoreVolatiles()
restoreVolatiles in interface Heappublic boolean hasChanged()
hasChanged in interface Heappublic void markChanged(int objref)
markChanged in interface Heappublic void setStored()
public abstract Memento<Heap> getMemento(MementoFactory factory)
getMemento in interface Heappublic abstract Memento<Heap> getMemento()
getMemento in interface Heappublic boolean isOutOfMemory()
isOutOfMemory in interface Heappublic void setOutOfMemory(boolean isOutOfMemory)
setOutOfMemory in interface Heappublic void checkConsistency(boolean isStateStore)
checkConsistency in interface Heap