| 449 | //========================================================================== |
| 450 | |
| 451 | static size_t SingleStep() |
| 452 | { |
| 453 | switch (State) |
| 454 | { |
| 455 | case GCS_Pause: |
| 456 | MarkRoot(); // Start a new collection |
| 457 | return 0; |
| 458 | |
| 459 | case GCS_Propagate: |
| 460 | if (Gray != nullptr) |
| 461 | { |
| 462 | return PropagateMark(); |
| 463 | } |
| 464 | else |
| 465 | { // no more gray objects |
| 466 | Atomic(); // finish mark phase |
| 467 | return 0; |
| 468 | } |
| 469 | |
| 470 | case GCS_Sweep: { |
| 471 | RunningDeallocBytes = 0; |
| 472 | size_t swept = SweepObjects(GCSWEEPGRANULARITY); |
| 473 | Estimate -= RunningDeallocBytes; |
| 474 | if (*SweepPos == nullptr) |
| 475 | { // Nothing more to sweep? |
| 476 | SweepDone(); |
| 477 | } |
| 478 | return swept; |
| 479 | } |
| 480 | |
| 481 | case GCS_Destroy: { |
| 482 | size_t destroy_size; |
| 483 | destroy_size = DestroyObjects(GCSWEEPGRANULARITY); |
| 484 | Estimate -= destroy_size; |
| 485 | if (ToDestroy == nullptr) |
| 486 | { // Nothing more to destroy? |
| 487 | State = GCS_Done; |
| 488 | } |
| 489 | return destroy_size; |
| 490 | } |
| 491 | |
| 492 | case GCS_Done: |
| 493 | State = GCS_Pause; // end collection |
| 494 | SetThreshold(); |
| 495 | return 0; |
| 496 | |
| 497 | default: |
| 498 | assert(0); |
| 499 | return 0; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | //========================================================================== |
| 504 | // |
no test coverage detected