xo-interpreter2: work towards utest w/ vsm+reader [WIP]
This commit is contained in:
parent
dcc42d08a2
commit
e1d19aaea7
4 changed files with 16 additions and 4 deletions
|
|
@ -62,6 +62,10 @@ namespace xo {
|
|||
|
||||
/** 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.
|
||||
* does not recover memory.
|
||||
**/
|
||||
virtual void _drop(Opaque d) const noexcept = 0;
|
||||
/** optional name for allocator @p d .
|
||||
* Allows labeling allocators, for diagnostics/instrumentation.
|
||||
**/
|
||||
|
|
@ -142,10 +146,12 @@ namespace xo {
|
|||
virtual value_type alloc_copy(Opaque d, value_type src) const = 0;
|
||||
/** reset allocator @p d to empty state. **/
|
||||
virtual void clear(Opaque d) const = 0;
|
||||
#ifdef OBSOLETE
|
||||
/** Destruct allocator @p d.
|
||||
* Releases allocator memory to operating system.
|
||||
**/
|
||||
virtual void destruct_data(Opaque d) const = 0;
|
||||
#endif
|
||||
|
||||
///@}
|
||||
}; /*AAllocator*/
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@ namespace xo {
|
|||
const AAllocator * iface() const { return std::launder(this); }
|
||||
|
||||
// from AAllocator
|
||||
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
void _drop(Opaque) const noexcept override { _fatal(); }
|
||||
|
||||
// const methods
|
||||
[[noreturn]] std::string_view name(Copaque) const noexcept override { _fatal(); }
|
||||
|
|
@ -55,7 +58,6 @@ namespace xo {
|
|||
[[noreturn]] value_type sub_alloc(Opaque, std::size_t, bool) const override { _fatal(); }
|
||||
[[noreturn]] value_type alloc_copy(Opaque, value_type) const override { _fatal(); }
|
||||
[[noreturn]] void clear(Opaque) const override { _fatal(); }
|
||||
[[noreturn]] void destruct_data(Opaque) const override { _fatal(); }
|
||||
|
||||
private:
|
||||
[[noreturn]] static void _fatal();
|
||||
|
|
|
|||
|
|
@ -36,10 +36,14 @@ namespace xo {
|
|||
|
||||
// from AAllocator
|
||||
|
||||
// const methods
|
||||
|
||||
// builtin methods
|
||||
/** return typeseq for @tparam DRepr **/
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
/** invoke native c++ dtor **/
|
||||
void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); }
|
||||
|
||||
// const methods
|
||||
|
||||
std::string_view name(Copaque d) const noexcept override { return I::name(_dcast(d)); }
|
||||
size_type reserved(Copaque d) const noexcept override { return I::reserved(_dcast(d)); }
|
||||
size_type size(Copaque d) const noexcept override { return I::size(_dcast(d)); }
|
||||
|
|
@ -73,7 +77,6 @@ namespace xo {
|
|||
value_type alloc_copy(Opaque d,
|
||||
value_type src) const override { return I::alloc_copy(_dcast(d), src); }
|
||||
void clear(Opaque d) const override { return I::clear(_dcast(d)); }
|
||||
void destruct_data(Opaque d) const override { return I::destruct_data(_dcast(d)); }
|
||||
///@}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ namespace xo {
|
|||
RAllocator(Object::DataPtr data) : Object{std::move(data)} {}
|
||||
|
||||
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()); }
|
||||
size_type reserved() const noexcept { return O::iface()->reserved(O::data()); }
|
||||
size_type size() const noexcept { return O::iface()->size(O::data()); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue