mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
- Fixed: DACSThinker::ActiveThinker was missing a read barrier.
- Loading a save game now initiates a collection. - Added a finalization cost to the sweep stage. SVN r801 (trunk)
This commit is contained in:
parent
ff387a952c
commit
6715b84d0d
7 changed files with 26 additions and 7 deletions
|
@ -1,4 +1,7 @@
|
||||||
March 12, 2008
|
March 12, 2008
|
||||||
|
- Fixed: DACSThinker::ActiveThinker was missing a read barrier.
|
||||||
|
- Loading a save game now initiates a collection.
|
||||||
|
- Added a finalization cost to the sweep stage.
|
||||||
- Fixed: D_dehacked.cpp/PatchThing() allocated an actor on the stack.
|
- Fixed: D_dehacked.cpp/PatchThing() allocated an actor on the stack.
|
||||||
- Changed the sentinels in the thinker lists into a proper thinker. The old
|
- Changed the sentinels in the thinker lists into a proper thinker. The old
|
||||||
way wasn't playing well with the write barriers.
|
way wasn't playing well with the write barriers.
|
||||||
|
|
|
@ -1842,7 +1842,6 @@ void TryRunTics (void)
|
||||||
M_Ticker ();
|
M_Ticker ();
|
||||||
I_GetTime (true);
|
I_GetTime (true);
|
||||||
G_Ticker ();
|
G_Ticker ();
|
||||||
GC::CheckGC ();
|
|
||||||
gametic++;
|
gametic++;
|
||||||
|
|
||||||
NetUpdate (); // check for new console commands
|
NetUpdate (); // check for new console commands
|
||||||
|
|
|
@ -309,6 +309,12 @@ namespace GC
|
||||||
Step();
|
Step();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Forces a collection to start now.
|
||||||
|
static inline void StartCollection()
|
||||||
|
{
|
||||||
|
Threshold = AllocBytes;
|
||||||
|
}
|
||||||
|
|
||||||
// Marks a white object gray. If the object wants to die, the pointer
|
// Marks a white object gray. If the object wants to die, the pointer
|
||||||
// is NULLed instead.
|
// is NULLed instead.
|
||||||
void Mark(DObject **obj);
|
void Mark(DObject **obj);
|
||||||
|
|
|
@ -185,11 +185,11 @@ static size_t PropagateAll()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static DObject **SweepList(DObject **p, size_t count)
|
static DObject **SweepList(DObject **p, size_t count, size_t *finalize_count)
|
||||||
{
|
{
|
||||||
static int scount;
|
|
||||||
DObject *curr;
|
DObject *curr;
|
||||||
int deadmask = OtherWhite();
|
int deadmask = OtherWhite();
|
||||||
|
size_t finalized = 0;
|
||||||
|
|
||||||
while ((curr = *p) != NULL && count-- > 0)
|
while ((curr = *p) != NULL && count-- > 0)
|
||||||
{
|
{
|
||||||
|
@ -210,8 +210,13 @@ static DObject **SweepList(DObject **p, size_t count)
|
||||||
}
|
}
|
||||||
curr->ObjectFlags |= OF_Cleanup;
|
curr->ObjectFlags |= OF_Cleanup;
|
||||||
delete curr;
|
delete curr;
|
||||||
|
finalized++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (finalize_count != NULL)
|
||||||
|
{
|
||||||
|
*finalize_count = finalized;
|
||||||
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,14 +355,15 @@ static size_t SingleStep()
|
||||||
|
|
||||||
case GCS_Sweep: {
|
case GCS_Sweep: {
|
||||||
size_t old = AllocBytes;
|
size_t old = AllocBytes;
|
||||||
SweepPos = SweepList(SweepPos, GCSWEEPMAX);
|
size_t finalize_count;
|
||||||
|
SweepPos = SweepList(SweepPos, GCSWEEPMAX, &finalize_count);
|
||||||
if (*SweepPos == NULL)
|
if (*SweepPos == NULL)
|
||||||
{ // Nothing more to sweep?
|
{ // Nothing more to sweep?
|
||||||
State = GCS_Finalize;
|
State = GCS_Finalize;
|
||||||
}
|
}
|
||||||
assert(old >= AllocBytes);
|
assert(old >= AllocBytes);
|
||||||
Estimate -= old - AllocBytes;
|
Estimate -= old - AllocBytes;
|
||||||
return GCSWEEPMAX * GCSWEEPCOST;
|
return (GCSWEEPMAX - finalize_count) * GCSWEEPCOST + finalize_count * GCFINALIZECOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GCS_Finalize:
|
case GCS_Finalize:
|
||||||
|
|
|
@ -1823,6 +1823,11 @@ void G_DoLoadGame ()
|
||||||
|
|
||||||
delete png;
|
delete png;
|
||||||
fclose (stdfile);
|
fclose (stdfile);
|
||||||
|
|
||||||
|
// At this point, the GC threshold is likely a lot higher than the
|
||||||
|
// amount of memory in use, so bring it down now by starting a
|
||||||
|
// collection.
|
||||||
|
GC::StartCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1562,7 +1562,7 @@ IMPLEMENT_POINTY_CLASS (DACSThinker)
|
||||||
DECLARE_POINTER(Scripts)
|
DECLARE_POINTER(Scripts)
|
||||||
END_POINTERS
|
END_POINTERS
|
||||||
|
|
||||||
DACSThinker *DACSThinker::ActiveThinker = NULL;
|
TObjPtr<DACSThinker> DACSThinker::ActiveThinker;
|
||||||
|
|
||||||
DACSThinker::DACSThinker ()
|
DACSThinker::DACSThinker ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -710,7 +710,7 @@ public:
|
||||||
void Tick ();
|
void Tick ();
|
||||||
|
|
||||||
DLevelScript *RunningScripts[1000]; // Array of all synchronous scripts
|
DLevelScript *RunningScripts[1000]; // Array of all synchronous scripts
|
||||||
static DACSThinker *ActiveThinker;
|
static TObjPtr<DACSThinker> ActiveThinker;
|
||||||
|
|
||||||
void DumpScriptStatus();
|
void DumpScriptStatus();
|
||||||
void StopScriptsFor (AActor *actor);
|
void StopScriptsFor (AActor *actor);
|
||||||
|
|
Loading…
Reference in a new issue