xo-interpreter2 stack: plumbing for aux_mm and use opportunistically
This commit is contained in:
parent
8ff02d52c1
commit
2191eec0f8
4 changed files with 133 additions and 141 deletions
|
|
@ -14,7 +14,7 @@
|
|||
#include <xo/reader2/SchematikaReader.hpp>
|
||||
#include <xo/expression2/Expression.hpp>
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/facet/box.hpp>
|
||||
#include <xo/alloc2/abox.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
|
@ -74,7 +74,12 @@ namespace xo {
|
|||
using span_type = xo::mm::span<const char>;
|
||||
|
||||
public:
|
||||
VirtualSchematikaMachine(const VsmConfig & config);
|
||||
/** @p config. configuration
|
||||
* @p aux_mm. Allocator for miscellaneous dataN
|
||||
* owned by this VSM.
|
||||
**/
|
||||
VirtualSchematikaMachine(const VsmConfig & config,
|
||||
obj<AAllocator> aux_mm);
|
||||
|
||||
/** allocator for schematika data **/
|
||||
obj<AAllocator> allocator() const noexcept;
|
||||
|
|
@ -213,10 +218,17 @@ namespace xo {
|
|||
/** configuration **/
|
||||
VsmConfig config_;
|
||||
|
||||
#ifdef NOT_YET
|
||||
/** allocator (likely DArena) for globals.
|
||||
* For example DArenaHashMap in global symtab,
|
||||
**/
|
||||
obj<AAllocator> aux_mm_;
|
||||
#endif
|
||||
|
||||
/** allocator (likely DX1Collector or similar) for
|
||||
* expressions and values
|
||||
**/
|
||||
box<AAllocator> mm_;
|
||||
abox<AAllocator> mm_;
|
||||
|
||||
/** Sidecar allocator for error reporting.
|
||||
* Separate to mitigate interference with @ref mm_
|
||||
|
|
@ -224,12 +236,12 @@ namespace xo {
|
|||
* an out-of-memory error).
|
||||
* Likely DArena or similar
|
||||
**/
|
||||
box<AAllocator> error_mm_;
|
||||
abox<AAllocator> error_mm_;
|
||||
|
||||
/** runtime context for this vsm.
|
||||
* For example, provides allocator to primitives
|
||||
**/
|
||||
box<ARuntimeContext> rcx_;
|
||||
abox<ARuntimeContext> rcx_;
|
||||
|
||||
// consider separate allocator (which _may_ turn out to be the same)
|
||||
// for VM stack. Only works for code that doesn't rely on fancy
|
||||
|
|
|
|||
|
|
@ -19,15 +19,28 @@ namespace xo {
|
|||
|
||||
VsmConfig() = default;
|
||||
|
||||
VsmConfig with_debug_flag(bool x) const {
|
||||
VsmConfig retval = *this;
|
||||
retval.debug_flag_ = x;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/** true for interactive parser session; false for batch session **/
|
||||
bool interactive_flag_ = true;
|
||||
|
||||
/** true to enable logging **/
|
||||
bool debug_flag_ = false;
|
||||
|
||||
/** reader configuration **/
|
||||
ReaderConfig rdr_config_;
|
||||
/** Configuration for allocator/collector.
|
||||
* TODO: may want to make CollectorConfig polymorphic
|
||||
**/
|
||||
X1CollectorConfig x1_config_ = X1CollectorConfig().with_size(4*1024*1024);
|
||||
X1CollectorConfig x1_config_ = X1CollectorConfig().with_name("gc").with_size(4*1024*1024);
|
||||
/** Configuration for handful of non-moveable high-level objects
|
||||
* e.g. DArenaHashMap in global symtab
|
||||
**/
|
||||
ArenaConfig fixed_config_ = ArenaConfig().with_name("fixed").with_size(4*1024);
|
||||
/** Configuration for error allocator
|
||||
* TODO: may want to make ArenaConfig polymorphic
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue