xo-gc: streamline: drop .visit_child methods
no longer needed, thanks to DGCObjectStoreVisitor
This commit is contained in:
parent
9e74e35c68
commit
134f5614a3
5 changed files with 29 additions and 87 deletions
|
|
@ -274,14 +274,6 @@ namespace xo {
|
|||
/** Execute gc immediately, for all generations < @p upto **/
|
||||
void execute_gc(Generation upto) noexcept;
|
||||
|
||||
/** Supports GCObjectVisitor facet.
|
||||
* During gc phase (@p reason is 'forward')
|
||||
* 1. evacuate object at @p *lhs_data to to-space.
|
||||
* 2. replace @p *lhs_data with forwarding pointer
|
||||
* to new location.
|
||||
**/
|
||||
void visit_child(VisitReason reason, AGCObject * lhs_iface, void ** lhs_data);
|
||||
|
||||
// ----- allocation -----
|
||||
|
||||
/** simple allocation. allocate @p z bytes of memory
|
||||
|
|
|
|||
|
|
@ -169,37 +169,6 @@ namespace xo {
|
|||
void * from_src,
|
||||
Generation upto);
|
||||
|
||||
/** Target for GCObjectVisitor facet
|
||||
* During gc phase (@p reason is 'forward')
|
||||
* 1. evacuate object at @p *lhs_data to to-space.
|
||||
* 2. replace @p *lhs_data with forwarding pointer
|
||||
* to new location.
|
||||
**/
|
||||
void visit_child_aux(VisitReason reason,
|
||||
AGCObject * lhs_iface,
|
||||
void ** lhs_data,
|
||||
Generation upto);
|
||||
|
||||
/** Evacuate object at @p *lhs_data to to-space, during collection phase
|
||||
* acting on generations g in [0 ,.., upto).
|
||||
* Need @p gc to pass to invoke AGCObject methods shallow_copy() and
|
||||
* forward_children()
|
||||
*
|
||||
* Replace original with forwarding pointer to new location
|
||||
**/
|
||||
void forward_inplace_aux(obj<AGCObjectVisitor> gc,
|
||||
AGCObject * lhs_iface,
|
||||
void ** lhs_data,
|
||||
Generation upto);
|
||||
|
||||
/** categorize fop {@p lhs_iface, @p lhs_data}
|
||||
* based on location of @p lhs_data.
|
||||
* Update @ref p_verify_stats_ based on the result:
|
||||
* increment exactly one of {n_from_, n_to_, n_ext_}
|
||||
**/
|
||||
void verify_aux(AGCObject * lhs_iface,
|
||||
void * lhs_data);
|
||||
|
||||
/** Cleanup at the end of a gc cycle.
|
||||
* Reset from-space
|
||||
* (current from-space is former to-space,
|
||||
|
|
@ -252,6 +221,28 @@ namespace xo {
|
|||
AGCObject * iface,
|
||||
void * from_src);
|
||||
|
||||
/** Evacuate object at @p *lhs_data to to-space, during collection phase
|
||||
* acting on generations g in [0 ,.., upto).
|
||||
* Need @p gc to pass to invoke AGCObject methods shallow_copy() and
|
||||
* forward_children()
|
||||
*
|
||||
* Replace original with forwarding pointer to new location
|
||||
**/
|
||||
void _forward_inplace_aux(obj<AGCObjectVisitor> gc,
|
||||
AGCObject * lhs_iface,
|
||||
void ** lhs_data,
|
||||
Generation upto);
|
||||
|
||||
/** categorize fop {@p lhs_iface, @p lhs_data}
|
||||
* based on location of @p lhs_data.
|
||||
* Update @ref p_verify_stats_ based on the result:
|
||||
* increment exactly one of {n_from_, n_to_, n_ext_}
|
||||
**/
|
||||
void _verify_aux(AGCObject * lhs_iface,
|
||||
void * lhs_data);
|
||||
|
||||
friend class DGCObjectStoreVisitor;
|
||||
|
||||
private:
|
||||
/** configuration for gc-aware object store **/
|
||||
GCObjectStoreConfig config_;
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ namespace xo {
|
|||
{
|
||||
switch (reason.code()) {
|
||||
case VisitReason::code::forward:
|
||||
p_gco_store_->forward_inplace_aux
|
||||
p_gco_store_->_forward_inplace_aux
|
||||
(this->ref<AGCObjectVisitor>(), lhs_iface, lhs_data, upto_);
|
||||
break;
|
||||
case VisitReason::code::verify:
|
||||
p_gco_store_->verify_aux(lhs_iface, *lhs_data);
|
||||
p_gco_store_->_verify_aux(lhs_iface, *lhs_data);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
|
|
|
|||
|
|
@ -587,19 +587,6 @@ namespace xo {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
DX1Collector::visit_child(VisitReason reason,
|
||||
AGCObject * lhs_iface,
|
||||
void ** lhs_data)
|
||||
{
|
||||
// MAYBE: adapter distinct from DX1Collector that supports GCObjectVisitor facet,
|
||||
// calls DX1Collector::_verify_aux()
|
||||
|
||||
Generation upto = runstate_.gc_upto();
|
||||
|
||||
gco_store_.visit_child_aux(reason, lhs_iface, lhs_data, upto);
|
||||
}
|
||||
|
||||
auto
|
||||
DX1Collector::alloc(typeseq t, size_type z) noexcept -> value_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -477,35 +477,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
GCObjectStore::visit_child_aux(VisitReason reason,
|
||||
AGCObject * lhs_iface,
|
||||
void ** lhs_data,
|
||||
Generation upto)
|
||||
{
|
||||
switch (reason.code()) {
|
||||
case VisitReason::code::forward:
|
||||
{
|
||||
DGCObjectStoreVisitor gcos_visitor(this, upto);
|
||||
auto gcos_visitor_obj
|
||||
= obj<AGCObjectVisitor,DGCObjectStoreVisitor>(&gcos_visitor);
|
||||
|
||||
// called during collection phase
|
||||
this->forward_inplace_aux
|
||||
(gcos_visitor_obj, lhs_iface, lhs_data, upto);
|
||||
break;
|
||||
}
|
||||
case VisitReason::code::verify:
|
||||
// called during verify_ok
|
||||
this->verify_aux(lhs_iface, *lhs_data);
|
||||
break;
|
||||
default:
|
||||
// should be unreachable
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GCObjectStore::forward_inplace_aux(obj<AGCObjectVisitor> gc,
|
||||
GCObjectStore::_forward_inplace_aux(obj<AGCObjectVisitor> gc,
|
||||
AGCObject * lhs_iface,
|
||||
void ** lhs_data,
|
||||
Generation upto)
|
||||
|
|
@ -693,7 +665,7 @@ namespace xo {
|
|||
} /*_forward_inplace_aux*/
|
||||
|
||||
void
|
||||
GCObjectStore::verify_aux(AGCObject * iface,
|
||||
GCObjectStore::_verify_aux(AGCObject * iface,
|
||||
void * data)
|
||||
{
|
||||
scope log(XO_DEBUG(config_.debug_flag_));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue