xo-interpreter2 stack: work on VSM for apply -> closure action [WIP]
This commit is contained in:
parent
60b8fda134
commit
e9413abbd6
19 changed files with 312 additions and 7 deletions
|
|
@ -34,6 +34,7 @@ xo_add_genfacet(
|
|||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-symboltable-localsymtab
|
||||
FACET_PKG xo_expression2
|
||||
|
|
@ -45,6 +46,19 @@ xo_add_genfacetimpl(
|
|||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-gcobject-localsymtab
|
||||
FACET_PKG xo_gc
|
||||
FACET GCObject
|
||||
REPR LocalSymtab
|
||||
INPUT idl/IGCObject_DLocalSymtab.json5
|
||||
OUTPUT_HPP_DIR include/xo/expression2
|
||||
OUTPUT_IMPL_SUBDIR symtab
|
||||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-printable-localsymtab
|
||||
FACET_PKG xo_printable2
|
||||
|
|
@ -260,6 +274,18 @@ xo_add_genfacetimpl(
|
|||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-gcobject-lambdaexpr
|
||||
FACET_PKG xo_gc
|
||||
FACET GCObject
|
||||
REPR LambdaExpr
|
||||
INPUT idl/IGCObject_DLambdaExpr.json5
|
||||
OUTPUT_HPP_DIR include/xo/expression2
|
||||
OUTPUT_IMPL_SUBDIR detail
|
||||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-printable-lambdaexpr
|
||||
|
|
|
|||
15
idl/IGCObject_DLambdaExpr.json5
Normal file
15
idl/IGCObject_DLambdaExpr.json5
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
includes: [
|
||||
"<xo/gc/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>"
|
||||
],
|
||||
local_types: [ ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/GCObject.json5",
|
||||
brief: "provide AGCObject interface for DLambdaExpr",
|
||||
using_doxygen: true,
|
||||
repr: "DLambdaExpr",
|
||||
doc: [ "implement AGCObject for DLambdaExpr" ],
|
||||
}
|
||||
15
idl/IGCObject_DLocalSymtab.json5
Normal file
15
idl/IGCObject_DLocalSymtab.json5
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
includes: [
|
||||
"<xo/gc/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>"
|
||||
],
|
||||
local_types: [ ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/GCObject.json5",
|
||||
brief: "provide AGCObject interface for DLocalSymtab",
|
||||
using_doxygen: true,
|
||||
repr: "DLocalSymtab",
|
||||
doc: [ "implement AGCObject for DLocalSymtab" ],
|
||||
}
|
||||
|
|
@ -56,4 +56,5 @@
|
|||
// // Variable gives both {name, type}
|
||||
// void upsert_local(DVariable * target) = 0;
|
||||
],
|
||||
router_facet_explicit_content: [ ],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace xo {
|
|||
// using typeseq = xo::reflect::typeseq;
|
||||
|
||||
using ppindentinfo = xo::print::ppindentinfo;
|
||||
using ACollector = xo::mm::ACollector;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
/* note: uint16_t would be fine too */
|
||||
using size_type = std::uint32_t;
|
||||
|
|
@ -90,6 +91,14 @@ namespace xo {
|
|||
/** lookup binding for variable @p sym **/
|
||||
Binding lookup_binding(const DUniqueString * sym) const noexcept;
|
||||
|
||||
///@}
|
||||
/** @defgroup xo-localsymtab-gcobject-facet gcobject facet **/
|
||||
///@{
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DLocalSymtab * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
///@}
|
||||
/** @defgroup xo-localsymtab-printable-facet printable facet **/
|
||||
///@{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "DLambdaExpr.hpp"
|
||||
#include "detail/IExpression_DLambdaExpr.hpp"
|
||||
//#include "detail/IGCObject_DLambdaExpr.hpp"
|
||||
#include "detail/IGCObject_DLambdaExpr.hpp"
|
||||
#include "detail/IPrintable_DLambdaExpr.hpp"
|
||||
|
||||
/* end LambdaExpr.hpp */
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "DLocalSymtab.hpp"
|
||||
#include "symtab/ISymbolTable_DLocalSymtab.hpp"
|
||||
#include "symtab/IGCObject_DLocalSymtab.hpp"
|
||||
#include "symtab/IPrintable_DLocalSymtab.hpp"
|
||||
|
||||
/* end LocalSymtab.hpp */
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ public:
|
|||
// const methods
|
||||
/** RTTI: unique id# for actual runtime data representation **/
|
||||
virtual typeseq _typeseq() const noexcept = 0;
|
||||
/** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/
|
||||
virtual void _drop(Opaque d) const noexcept = 0;
|
||||
/** expression type (constant | apply | ..) **/
|
||||
virtual exprtype extype(Copaque data) const noexcept = 0;
|
||||
/** placeholder for type giving possible values for this expression **/
|
||||
|
|
|
|||
|
|
@ -54,8 +54,11 @@ namespace scm {
|
|||
|
||||
// from AExpression
|
||||
|
||||
// const methods
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
[[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); }
|
||||
|
||||
// const methods
|
||||
[[noreturn]] exprtype extype(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] TypeRef typeref(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] TypeDescr valuetype(Copaque) const noexcept override { _fatal(); }
|
||||
|
|
|
|||
|
|
@ -41,8 +41,11 @@ namespace scm {
|
|||
|
||||
// from AExpression
|
||||
|
||||
// const methods
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); }
|
||||
|
||||
// const methods
|
||||
exprtype extype(Copaque data) const noexcept override {
|
||||
return I::extype(_dcast(data));
|
||||
}
|
||||
|
|
|
|||
67
include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp
Normal file
67
include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/** @file IGCObject_DLambdaExpr.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DLambdaExpr.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DLambdaExpr.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GCObject.hpp"
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include "DLambdaExpr.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IGCObject_DLambdaExpr; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DLambdaExpr>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DLambdaExpr,
|
||||
xo::scm::IGCObject_DLambdaExpr>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IGCObject_DLambdaExpr
|
||||
**/
|
||||
class IGCObject_DLambdaExpr {
|
||||
public:
|
||||
/** @defgroup scm-gcobject-dlambdaexpr-type-traits **/
|
||||
///@{
|
||||
using size_type = xo::mm::AGCObject::size_type;
|
||||
using AAllocator = xo::mm::AGCObject::AAllocator;
|
||||
using ACollector = xo::mm::AGCObject::ACollector;
|
||||
using Copaque = xo::mm::AGCObject::Copaque;
|
||||
using Opaque = xo::mm::AGCObject::Opaque;
|
||||
///@}
|
||||
/** @defgroup scm-gcobject-dlambdaexpr-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DLambdaExpr & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DLambdaExpr & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DLambdaExpr & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -46,8 +46,13 @@ public:
|
|||
/** @defgroup scm-expression-router-methods **/
|
||||
///@{
|
||||
|
||||
// const methods
|
||||
// explicit injected content
|
||||
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
|
||||
void _drop() const noexcept { O::iface()->_drop(O::data()); }
|
||||
|
||||
// const methods
|
||||
exprtype extype() const noexcept {
|
||||
return O::iface()->extype(O::data());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ public:
|
|||
// const methods
|
||||
/** RTTI: unique id# for actual runtime data representation **/
|
||||
virtual typeseq _typeseq() const noexcept = 0;
|
||||
/** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/
|
||||
virtual void _drop(Opaque d) const noexcept = 0;
|
||||
/** true iff this is toplevel (global) symbol table. **/
|
||||
virtual bool is_global_symtab(Copaque data) const noexcept = 0;
|
||||
/** report ingredients needed to address variable at runtime. **/
|
||||
|
|
|
|||
67
include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp
Normal file
67
include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/** @file IGCObject_DLocalSymtab.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DLocalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DLocalSymtab.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GCObject.hpp"
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include "DLocalSymtab.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IGCObject_DLocalSymtab; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DLocalSymtab>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DLocalSymtab,
|
||||
xo::scm::IGCObject_DLocalSymtab>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IGCObject_DLocalSymtab
|
||||
**/
|
||||
class IGCObject_DLocalSymtab {
|
||||
public:
|
||||
/** @defgroup scm-gcobject-dlocalsymtab-type-traits **/
|
||||
///@{
|
||||
using size_type = xo::mm::AGCObject::size_type;
|
||||
using AAllocator = xo::mm::AGCObject::AAllocator;
|
||||
using ACollector = xo::mm::AGCObject::ACollector;
|
||||
using Copaque = xo::mm::AGCObject::Copaque;
|
||||
using Opaque = xo::mm::AGCObject::Opaque;
|
||||
///@}
|
||||
/** @defgroup scm-gcobject-dlocalsymtab-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DLocalSymtab & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DLocalSymtab & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DLocalSymtab & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -53,8 +53,11 @@ namespace scm {
|
|||
|
||||
// from ASymbolTable
|
||||
|
||||
// const methods
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
[[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); }
|
||||
|
||||
// const methods
|
||||
[[noreturn]] bool is_global_symtab(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] Binding lookup_binding(Copaque, const DUniqueString *) const noexcept override { _fatal(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,11 @@ namespace scm {
|
|||
|
||||
// from ASymbolTable
|
||||
|
||||
// const methods
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); }
|
||||
|
||||
// const methods
|
||||
bool is_global_symtab(Copaque data) const noexcept override {
|
||||
return I::is_global_symtab(_dcast(data));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,13 @@ public:
|
|||
/** @defgroup scm-symboltable-router-methods **/
|
||||
///@{
|
||||
|
||||
// const methods
|
||||
// explicit injected content
|
||||
|
||||
// builtin methods
|
||||
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
|
||||
void _drop() const noexcept { O::iface()->_drop(O::data()); }
|
||||
|
||||
// const methods
|
||||
bool is_global_symtab() const noexcept {
|
||||
return O::iface()->is_global_symtab(O::data());
|
||||
}
|
||||
|
|
|
|||
39
src/expression2/IGCObject_DLambdaExpr.cpp
Normal file
39
src/expression2/IGCObject_DLambdaExpr.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IGCObject_DLambdaExpr.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DLambdaExpr.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DLambdaExpr.json5]
|
||||
**/
|
||||
|
||||
#include "detail/IGCObject_DLambdaExpr.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DLambdaExpr::shallow_size(const DLambdaExpr & self) noexcept -> size_type
|
||||
{
|
||||
return self.shallow_size();
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLambdaExpr::shallow_copy(const DLambdaExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLambdaExpr::forward_children(DLambdaExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
return self.forward_children(gc);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DLambdaExpr.cpp */
|
||||
39
src/expression2/IGCObject_DLocalSymtab.cpp
Normal file
39
src/expression2/IGCObject_DLocalSymtab.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IGCObject_DLocalSymtab.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DLocalSymtab.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DLocalSymtab.json5]
|
||||
**/
|
||||
|
||||
#include "symtab/IGCObject_DLocalSymtab.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DLocalSymtab::shallow_size(const DLocalSymtab & self) noexcept -> size_type
|
||||
{
|
||||
return self.shallow_size();
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLocalSymtab::shallow_copy(const DLocalSymtab & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLocalSymtab::forward_children(DLocalSymtab & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
return self.forward_children(gc);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DLocalSymtab.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue