Skip to content

Commit

Permalink
GC diagnostics.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Nov 11, 2023
1 parent 13d57cd commit 87d3511
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions source/common/objects/dobjgc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,15 @@ static cycle_t GCTime; // Track time spent in GC
//
//==========================================================================

TArray<DObject*> allObjects;

void CheckGC()
{
allObjects.Clear();
for (auto obj = GC::Root; obj; obj = obj->ObjNext)
{
allObjects.Push(obj);
}
AllocHistory.AddAlloc(RunningAllocBytes);
RunningAllocBytes = 0;
if (State > GCS_Pause || AllocBytes >= Threshold)
Expand Down Expand Up @@ -219,6 +226,7 @@ void SetThreshold()
size_t PropagateMark()
{
DObject *obj = Gray;
assert(!obj || allObjects.Find(obj) < allObjects.Size());
assert(obj->IsGray());
obj->Gray2Black();
Gray = obj->GCNext;
Expand Down Expand Up @@ -319,6 +327,8 @@ void Mark(DObject **obj)
{
DObject *lobj = *obj;

assert(!lobj || allObjects.Find(lobj) < allObjects.Size());

//assert(lobj == nullptr || !(lobj->ObjectFlags & OF_Released));
if (lobj != nullptr && !(lobj->ObjectFlags & OF_Released))
{
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/player_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ static void movement(DDukePlayer* const p, ESyncBits actions, sectortype* psect,
if (pact->getOffsetZ() + p->vel.Z >= floorz - i) // hit the ground
{
S_StopSound(DUKE_SCREAM, pact);
if (!p->insector() || p->cursector->lotag != 1)
if (!p->insector() || p->cursector->lotag != ST_1_ABOVE_WATER)
{
if (isRRRA()) p->MotoOnGround = 1;
if ((p->falling_counter > 62 || (isRRRA() && p->falling_counter > 2 && p->insector() && p->cursector->lotag == 802)) && !ud.god)
Expand Down

0 comments on commit 87d3511

Please sign in to comment.