xo-gc stack: fix mutation setup + xo-reader2 utest
This commit is contained in:
parent
b1d2ae6f19
commit
f56b01e7b6
11 changed files with 234 additions and 23 deletions
|
|
@ -64,6 +64,16 @@ namespace xo {
|
|||
/** @defgroup mm-allocator-methods Allocator methods **/
|
||||
///@{
|
||||
|
||||
/** An uninitialized AAllocator instance will have zero vtable pointer
|
||||
* (per {linux,osx} abi).
|
||||
* Use case for this is narrow.
|
||||
* We go to some lengths to avoid null vtable pointers.
|
||||
* For example obj<AFacet> will have non-null vtable (via IFacet_Any)
|
||||
* with all methods terminating.
|
||||
**/
|
||||
bool _has_null_vptr() const noexcept {
|
||||
return (*reinterpret_cast<const void * const *>(this) == nullptr);
|
||||
}
|
||||
/** RTTI: unique id# for actual runtime data representation **/
|
||||
virtual typeseq _typeseq() const noexcept = 0;
|
||||
/** destroy instance @p d. Calls c++ destructor for actual runtime type.
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ namespace xo {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool _has_null_vptr() const noexcept { return O::iface()->_has_null_vptr(); }
|
||||
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
|
||||
void _drop() const noexcept { O::iface()->_drop(O::data()); }
|
||||
std::string_view name() const noexcept { return O::iface()->name(O::data()); }
|
||||
|
|
|
|||
|
|
@ -33,9 +33,14 @@ namespace xo {
|
|||
obj<AGCObject> * p_lhs,
|
||||
obj<AGCObject> rhs) noexcept
|
||||
{
|
||||
this->barrier_assign_aux(parent,
|
||||
p_lhs->iface(), p_lhs->opaque_data_addr(),
|
||||
rhs.iface(), rhs.opaque_data());
|
||||
if (this->data()) {
|
||||
this->barrier_assign_aux(parent,
|
||||
p_lhs->iface(), p_lhs->opaque_data_addr(),
|
||||
rhs.iface(), rhs.opaque_data());
|
||||
} else {
|
||||
// special case: for null allocator want no write-barrier
|
||||
*p_lhs = rhs;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Object>
|
||||
|
|
@ -48,11 +53,16 @@ namespace xo {
|
|||
// need to get AGCObject i/face that goes with DRepr.
|
||||
obj<AGCObject,DRepr> rhs_gco(rhs_data);
|
||||
|
||||
this->barrier_assign_aux(parent,
|
||||
nullptr /*not needed*/,
|
||||
lhs_data,
|
||||
rhs_gco.iface(),
|
||||
rhs_data);
|
||||
if (this->data()) {
|
||||
this->barrier_assign_aux(parent,
|
||||
nullptr /*not needed*/,
|
||||
lhs_data,
|
||||
rhs_gco.iface(),
|
||||
rhs_data);
|
||||
} else {
|
||||
// special case: for null allocator want no write-barrier
|
||||
*lhs_data = rhs_data;
|
||||
}
|
||||
}
|
||||
|
||||
} /*namespace mm*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue