#include <MemorySegment.hpp>
Public Types | |
enum | SegmentSetID { SET_UNINITIALIZED , SET_NORMAL , SET_LARGEBLOCK , SET_OLDSPACE } |
Public Member Functions | |
MemorySegmentSet (RexxMemory *memObject, SegmentSetID id, const char *setName) | |
MemorySegmentSet () | |
virtual | ~MemorySegmentSet () |
void * | operator new (size_t size, void *segment) |
void | operator delete (void *size) |
void | operator delete (void *size, void *segment) |
void | removeSegment (MemorySegment *segment) |
void | removeSegmentAndStorage (MemorySegment *segment) |
void | add (MemorySegment *segment) |
MemorySegment * | first () |
MemorySegment * | next (MemorySegment *segment) |
bool | isInSegmentSet (RexxObject *object) |
void | dumpSegments (FILE *keyfile, FILE *dumpfile) |
void | addSegment (MemorySegment *segment, bool createDeadObject=1) |
void | sweep () |
bool | is (SegmentSetID id) |
void | gatherStats (MemoryStats *memStats, SegmentStats *stats) |
virtual void | dumpMemoryProfile (FILE *outfile) |
virtual DeadObject * | donateObject (size_t allocationLength) |
virtual MemorySegment * | donateSegment (size_t allocationLength) |
Protected Member Functions | |
virtual void | collectEmptySegments () |
virtual void | addDeadObject (DeadObject *object) |
virtual void | addDeadObject (char *object, size_t length) |
RexxObject * | splitDeadObject (DeadObject *object, size_t allocationLength, size_t splitMinimum) |
void | insertSegment (MemorySegment *segment) |
MemorySegment * | findEmptySegment (size_t allocationLength) |
MemorySegment * | splitSegment (size_t allocationLength) |
void | mergeSegments (size_t allocationLength) |
void | combineEmptySegments (MemorySegment *front, MemorySegment *back) |
virtual size_t | suggestMemoryExpansion () |
virtual size_t | suggestMemoryContraction () |
virtual void | prepareForSweep () |
virtual void | completeSweepOperation () |
MemorySegment * | largestActiveSegment () |
MemorySegment * | largestEmptySegment () |
void | adjustMemorySize () |
void | releaseEmptySegments (size_t releaseSize) |
void | releaseSegment (MemorySegment *segment) |
bool | newSegment (size_t requestLength, size_t minimumLength) |
virtual MemorySegment * | allocateSegment (size_t requestLength, size_t minimumLength) |
float | freeMemoryPercentage () |
size_t | totalFreeMemory () |
size_t | calculateSegmentAllocation (size_t n) |
void | addSegments (size_t requiredSpace) |
MemorySegment * | getSegment (size_t requestLength, size_t minimumLength) |
void | activateEmptySegments () |
void | validateObject (size_t bytes) |
Protected Attributes | |
MemorySegment | anchor |
MemorySegment | emptySegments |
size_t | count |
size_t | liveObjectBytes |
size_t | deadObjectBytes |
SegmentSetID | owner |
const char * | name |
RexxMemory * | memory |
Friends | |
class | RexxMemory |
Definition at line 227 of file MemorySegment.hpp.
Enumerator | |
---|---|
SET_UNINITIALIZED | |
SET_NORMAL | |
SET_LARGEBLOCK | |
SET_OLDSPACE |
Definition at line 231 of file MemorySegment.hpp.
|
inline |
|
inline |
Definition at line 243 of file MemorySegment.hpp.
References count, memory, owner, and SET_UNINITIALIZED.
|
inlinevirtual |
Definition at line 251 of file MemorySegment.hpp.
|
protected |
Definition at line 310 of file MemorySegment.cpp.
References addSegment(), emptySegments, MemorySegment::isReal(), MemorySegmentHeader::next, and MemorySegment::remove().
Referenced by LargeSegmentSet::expandOrCollect().
|
inline |
Definition at line 273 of file MemorySegment.hpp.
References anchor, count, and MemorySegment::insertBefore().
|
protectedvirtual |
Reimplemented in NormalSegmentSet, LargeSegmentSet, and OldSpaceSegmentSet.
Definition at line 408 of file MemorySegment.cpp.
|
protectedvirtual |
Reimplemented in NormalSegmentSet, LargeSegmentSet, and OldSpaceSegmentSet.
Definition at line 350 of file MemorySegment.cpp.
Referenced by addSegment(), combineEmptySegments(), mergeSegments(), RexxMemory::scavengeSegmentSets(), splitDeadObject(), and sweep().
void MemorySegmentSet::addSegment | ( | MemorySegment * | segment, |
bool | createDeadObject = 1 |
||
) |
Definition at line 473 of file MemorySegment.cpp.
References addDeadObject(), anchor, MemorySegment::combine(), MemorySegment::createDeadObject(), MemorySegment::insertBefore(), MemorySegment::isAdjacentTo(), MemorySegment::isReal(), memory, MemorySegmentHeader::next, MemorySegmentHeader::previous, MemorySegment::realSize(), MemorySegment::size(), and RexxMemory::verboseMessage().
Referenced by activateEmptySegments(), addSegments(), LargeSegmentSet::expandOrCollect(), NormalSegmentSet::handleAllocationFailure(), newSegment(), RexxMemory::scavengeSegmentSets(), and splitSegment().
|
protected |
Definition at line 956 of file MemorySegment.cpp.
References addSegment(), allocateSegment(), calculateSegmentAllocation(), LargeSegmentDeadSpace, SegmentDeadSpace, and MemorySegment::size().
Referenced by adjustMemorySize(), NormalSegmentSet::getInitialSet(), and NormalSegmentSet::handleAllocationFailure().
|
protected |
Definition at line 872 of file MemorySegment.cpp.
References addSegments(), memory, suggestMemoryExpansion(), and RexxMemory::verboseMessage().
Referenced by NormalSegmentSet::handleAllocationFailure().
|
protectedvirtual |
Reimplemented in LargeSegmentSet.
Definition at line 249 of file MemorySegment.cpp.
References memory, and RexxMemory::newSegment().
Referenced by addSegments(), getSegment(), and newSegment().
|
inlineprotected |
Definition at line 346 of file MemorySegment.hpp.
References MemorySegmentOverhead, roundSegmentBoundary(), and SegmentSize.
Referenced by addSegments().
|
protectedvirtual |
Definition at line 1181 of file MemorySegment.cpp.
|
protected |
Definition at line 1672 of file MemorySegment.cpp.
References addDeadObject(), MemorySegment::combine(), MemorySegment::createDeadObject(), MemorySegment::firstObject(), memory, DeadObject::remove(), removeSegment(), MemorySegment::size(), and RexxMemory::verboseMessage().
Referenced by mergeSegments().
|
protectedvirtual |
Reimplemented in NormalSegmentSet, and LargeSegmentSet.
Definition at line 1046 of file MemorySegment.cpp.
Referenced by sweep().
|
virtual |
Reimplemented in NormalSegmentSet, and LargeSegmentSet.
Definition at line 518 of file MemorySegment.cpp.
Referenced by RexxMemory::scavengeSegmentSets().
|
virtual |
Definition at line 558 of file MemorySegment.cpp.
References findEmptySegment(), and splitSegment().
Referenced by RexxMemory::scavengeSegmentSets().
|
virtual |
Reimplemented in NormalSegmentSet, and LargeSegmentSet.
Definition at line 134 of file MemorySegment.cpp.
void MemorySegmentSet::dumpSegments | ( | FILE * | keyfile, |
FILE * | dumpfile | ||
) |
Definition at line 120 of file MemorySegment.cpp.
References MemorySegment::dump(), first(), name, and next().
Referenced by RexxMemory::dump().
|
protected |
Definition at line 289 of file MemorySegment.cpp.
References emptySegments, MemorySegment::isReal(), MemorySegmentHeader::next, MemorySegment::remove(), and MemorySegment::size().
Referenced by donateSegment(), LargeSegmentSet::expandOrCollect(), and getSegment().
|
inline |
Definition at line 278 of file MemorySegment.hpp.
References anchor, MemorySegment::isReal(), and MemorySegmentHeader::next.
Referenced by dumpSegments(), gatherStats(), isInSegmentSet(), OldSpaceSegmentSet::markOldSpaceObjects(), releaseEmptySegments(), splitSegment(), and sweep().
|
inlineprotected |
Definition at line 342 of file MemorySegment.hpp.
References deadObjectBytes, and liveObjectBytes.
Referenced by NormalSegmentSet::suggestMemoryContraction(), and NormalSegmentSet::suggestMemoryExpansion().
void MemorySegmentSet::gatherStats | ( | MemoryStats * | memStats, |
SegmentStats * | stats | ||
) |
Definition at line 1756 of file MemorySegment.cpp.
References count, SegmentStats::count, first(), MemorySegment::gatherObjectStats(), SegmentStats::largestSegment, Numerics::maxVal(), next(), MemorySegment::size(), and SegmentStats::smallestSegment.
Referenced by RexxMemory::dumpImageStats().
|
protected |
Definition at line 267 of file MemorySegment.cpp.
References allocateSegment(), and findEmptySegment().
|
protected |
|
inline |
Definition at line 311 of file MemorySegment.hpp.
References owner.
Referenced by RexxMemory::scavengeSegmentSets().
|
inline |
Definition at line 296 of file MemorySegment.hpp.
References first(), MemorySegment::isInSegment(), and next().
Referenced by RexxMemory::inSharedObjectStorage().
|
protected |
Definition at line 1429 of file MemorySegment.cpp.
References anchor, MemorySegment::isReal(), MemorySegmentHeader::next, and MemorySegment::size().
Referenced by LargeSegmentSet::expandOrCollect(), and mergeSegments().
|
protected |
Definition at line 1451 of file MemorySegment.cpp.
References emptySegments, MemorySegment::isReal(), MemorySegmentHeader::next, and MemorySegment::size().
Referenced by LargeSegmentSet::expandOrCollect().
|
protected |
Definition at line 1533 of file MemorySegment.cpp.
References addDeadObject(), anchor, MemorySegment::combine(), combineEmptySegments(), MemorySegment::firstDeadObject(), DeadObject::getObjectSize(), MemorySegment::isAdjacentTo(), MemorySegment::isEmpty(), MemorySegment::isReal(), largestActiveSegment(), MemorySegment::lastDeadObject(), memory, MemorySegmentOverhead, MemorySegmentHeader::next, MemorySegmentHeader::previous, MemorySegment::realSize(), DeadObject::remove(), MemorySegment::removeAll(), removeSegment(), DeadObject::setObjectSize(), MemorySegment::size(), and RexxMemory::verboseMessage().
Referenced by LargeSegmentSet::expandOrCollect(), and LargeSegmentSet::handleAllocationFailure().
|
protected |
Definition at line 332 of file MemorySegment.cpp.
References addSegment(), and allocateSegment().
Referenced by OldSpaceSegmentSet::allocateObject(), and LargeSegmentSet::expandSegmentSet().
|
inline |
Definition at line 287 of file MemorySegment.hpp.
References MemorySegment::isReal(), and MemorySegmentHeader::next.
Referenced by dumpSegments(), gatherStats(), isInSegmentSet(), OldSpaceSegmentSet::markOldSpaceObjects(), releaseEmptySegments(), splitSegment(), and sweep().
|
inline |
Definition at line 253 of file MemorySegment.hpp.
|
inline |
Definition at line 254 of file MemorySegment.hpp.
|
inline |
Definition at line 252 of file MemorySegment.hpp.
|
protectedvirtual |
Reimplemented in NormalSegmentSet, and LargeSegmentSet.
Definition at line 1003 of file MemorySegment.cpp.
References deadObjectBytes, and liveObjectBytes.
Referenced by NormalSegmentSet::prepareForSweep(), LargeSegmentSet::prepareForSweep(), and sweep().
|
protected |
Definition at line 915 of file MemorySegment.cpp.
References first(), MemorySegment::isEmpty(), next(), MemorySegmentHeader::previous, releaseSegment(), removeSegmentAndStorage(), roundSegmentBoundary(), and MemorySegment::size().
|
protected |
Definition at line 947 of file MemorySegment.cpp.
References count, emptySegments, and MemorySegment::insertBefore().
Referenced by releaseEmptySegments().
|
inline |
Definition at line 259 of file MemorySegment.hpp.
References count, and MemorySegment::remove().
Referenced by combineEmptySegments(), mergeSegments(), and splitSegment().
|
inline |
Definition at line 266 of file MemorySegment.hpp.
References count, and MemorySegment::removeAll().
Referenced by releaseEmptySegments().
|
protected |
Definition at line 1190 of file MemorySegment.cpp.
References addDeadObject(), and RexxInternalObject::getObjectSize().
Referenced by LargeSegmentSet::allocateObject(), NormalSegmentSet::findLargeDeadObject(), and OldSpaceSegmentSet::findObject().
|
protected |
Definition at line 578 of file MemorySegment.cpp.
References addSegment(), MemorySegment::end(), first(), RexxInternalObject::getObjectSize(), MemorySegment::isFirstBlock(), MemorySegment::isLastBlock(), RexxMemory::markWord, MaximumObjectSize, memoryObject, MemorySegmentOverhead, MinimumSegmentSize, next(), MemorySegment::realSize(), DeadObject::remove(), removeSegment(), MemorySegment::shrink(), MemorySegment::size(), and MemorySegment::start().
Referenced by donateSegment().
|
protectedvirtual |
Reimplemented in NormalSegmentSet.
Definition at line 831 of file MemorySegment.cpp.
|
protectedvirtual |
Reimplemented in NormalSegmentSet.
Definition at line 817 of file MemorySegment.cpp.
Referenced by adjustMemorySize().
void MemorySegmentSet::sweep | ( | ) |
Definition at line 1106 of file MemorySegment.cpp.
References addDeadObject(), completeSweepOperation(), deadObjectBytes, MemorySegment::end(), first(), liveObjectBytes, MemorySegmentHeader::liveObjects, RexxMemory::markWord, memoryObject, next(), objectIsLive(), objectIsNotLive(), prepareForSweep(), MemorySegment::start(), and validateObject().
Referenced by RexxMemory::collect().
|
inlineprotected |
Definition at line 343 of file MemorySegment.hpp.
References deadObjectBytes, and liveObjectBytes.
Referenced by NormalSegmentSet::suggestMemoryContraction().
|
inlineprotected |
Definition at line 361 of file MemorySegment.hpp.
Referenced by sweep().
|
friend |
Definition at line 228 of file MemorySegment.hpp.
|
protected |
Definition at line 368 of file MemorySegment.hpp.
Referenced by add(), addSegment(), first(), largestActiveSegment(), and mergeSegments().
|
protected |
Definition at line 370 of file MemorySegment.hpp.
Referenced by add(), gatherStats(), MemorySegmentSet(), releaseSegment(), removeSegment(), and removeSegmentAndStorage().
|
protected |
Definition at line 372 of file MemorySegment.hpp.
Referenced by freeMemoryPercentage(), prepareForSweep(), NormalSegmentSet::suggestMemoryExpansion(), sweep(), and totalFreeMemory().
|
protected |
Definition at line 369 of file MemorySegment.hpp.
Referenced by activateEmptySegments(), findEmptySegment(), largestEmptySegment(), and releaseSegment().
|
protected |
Definition at line 371 of file MemorySegment.hpp.
Referenced by freeMemoryPercentage(), prepareForSweep(), NormalSegmentSet::recommendedMaximumMemorySize(), NormalSegmentSet::recommendedMemorySize(), NormalSegmentSet::suggestMemoryExpansion(), sweep(), and totalFreeMemory().
|
protected |
Definition at line 375 of file MemorySegment.hpp.
Referenced by addSegment(), adjustMemorySize(), allocateSegment(), LargeSegmentSet::allocateSegment(), combineEmptySegments(), LargeSegmentSet::completeSweepOperation(), LargeSegmentSet::expandOrCollect(), LargeSegmentSet::expandSegmentSet(), NormalSegmentSet::handleAllocationFailure(), LargeSegmentSet::handleAllocationFailure(), MemorySegmentSet(), mergeSegments(), NormalSegmentSet::NormalSegmentSet(), and NormalSegmentSet::suggestMemoryExpansion().
|
protected |
Definition at line 374 of file MemorySegment.hpp.
Referenced by dumpSegments(), and MemorySegmentSet().
|
protected |
Definition at line 373 of file MemorySegment.hpp.
Referenced by is(), and MemorySegmentSet().