xo-gc: refactor: move some aux method impls to GCObjectStore

This commit is contained in:
Roland Conybeare 2026-04-02 21:56:12 -04:00
commit 08b313f25c
9 changed files with 131 additions and 34 deletions

View file

@ -5,6 +5,7 @@
#pragma once
#include "object_age.hpp"
#include "generation.hpp"
#include <cstddef>
#include <cstdint>
@ -16,10 +17,25 @@ namespace xo {
class MutationLogConfig {
public:
MutationLogConfig(std::uint32_t ngen,
#ifdef OBSOLETE // in GCObjectStore
std::uint32_t survive,
#endif
std::size_t mlog_z,
bool debug_flag);
#ifdef OBSOLETE
/** generation that would contain an object that has survived
* @p age collections. Equals the number of times object
* has been promoted.
*
* Must be consistent
**/
Generation age2gen(object_age age) const noexcept {
return Generation(age % n_survive_threshold_);
}
#endif
#ifdef OBSOLETE
/** age threshold for promotion to generation @p g **/
uint32_t promotion_threshold(Generation g) const noexcept {
@ -29,7 +45,7 @@ namespace xo {
return g * n_survive_threshold_;
}
#endif
public:
/** number of generations in use.
@ -37,11 +53,13 @@ namespace xo {
**/
std::uint32_t n_generation_ = 0;
#ifdef OBSOLETE
/** Number of promotion steps.
* An object that survives this number of collections
* advances to the next generation.
**/
uint32_t n_survive_threshold_ = 2;
#endif
/** storage for xgen pointer bookkeeping (aka remembered sets).
* Use 3x this value per generation