MCPcopy Create free account
hub / github.com/ZDoom/Raze / Barrier

Function Barrier

source/common/objects/dobjgc.cpp:604–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602//==========================================================================
603
604void Barrier(DObject *pointing, DObject *pointed)
605{
606 assert(pointing == nullptr || (pointing->IsBlack() && !pointing->IsDead()));
607 assert(pointed->IsWhite() && !pointed->IsDead());
608 assert(State != GCS_Destroy && State != GCS_Pause);
609 assert(!(pointed->ObjectFlags & OF_Released)); // if a released object gets here, something must be wrong.
610 if (pointed->ObjectFlags & OF_Released) return; // don't do anything with non-GC'd objects.
611 // The invariant only needs to be maintained in the propagate state.
612 if (State == GCS_Propagate)
613 {
614 pointed->White2Gray();
615 pointed->GCNext = Gray;
616 Gray = pointed;
617 }
618 // In other states, we can mark the pointing object white so this
619 // barrier won't be triggered again, saving a few cycles in the future.
620 else if (pointing != nullptr)
621 {
622 pointing->MakeWhite();
623 }
624}
625
626void DelSoftRootHead()
627{

Callers 1

WriteBarrierMethod · 0.85

Calls 5

IsBlackMethod · 0.80
IsDeadMethod · 0.80
IsWhiteMethod · 0.80
White2GrayMethod · 0.80
MakeWhiteMethod · 0.45

Tested by

no test coverage detected