xo-gc: move DX1Collector.generation_of() impl -> GCObjectStore
This commit is contained in:
parent
52776bde0d
commit
9efb214bfd
3 changed files with 19 additions and 8 deletions
|
|
@ -26,6 +26,11 @@ namespace xo {
|
|||
DArena * to_space(Generation g) noexcept { return get_space(role::to_space(), g); }
|
||||
DArena * new_space() noexcept { return to_space(Generation{0}); }
|
||||
|
||||
/** generation to which pointer @p addr belongs, given role @p r;
|
||||
* sentinel if not found in this collector
|
||||
**/
|
||||
Generation generation_of(role r, const void * addr) const noexcept;
|
||||
|
||||
/** Call @p visitor for each memory pool owned by this store **/
|
||||
void visit_pools(const MemorySizeVisitor & visitor) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -145,14 +145,7 @@ namespace xo {
|
|||
Generation
|
||||
DX1Collector::generation_of(role r, const void * addr) const noexcept
|
||||
{
|
||||
for (Generation gi{0}; gi < config_.n_generation_; ++gi) {
|
||||
const DArena * arena = this->get_space(r, gi);
|
||||
|
||||
if (arena->contains(addr))
|
||||
return gi;
|
||||
}
|
||||
|
||||
return Generation::sentinel();
|
||||
return gco_store_.generation_of(r, addr);
|
||||
}
|
||||
|
||||
AllocError
|
||||
|
|
|
|||
|
|
@ -62,6 +62,19 @@ namespace xo {
|
|||
}
|
||||
}
|
||||
|
||||
Generation
|
||||
GCObjectStore::generation_of(role r, const void * addr) const noexcept
|
||||
{
|
||||
for (Generation gi{0}; gi < n_generation_; ++gi) {
|
||||
const DArena * arena = this->get_space(r, gi);
|
||||
|
||||
if (arena->contains(addr))
|
||||
return gi;
|
||||
}
|
||||
|
||||
return Generation::sentinel();
|
||||
}
|
||||
|
||||
void
|
||||
GCObjectStore::visit_pools(const MemorySizeVisitor & visitor) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue