| 602 | //========================================================================== |
| 603 | |
| 604 | void 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 | |
| 626 | void DelSoftRootHead() |
| 627 | { |
no test coverage detected