From 1c0b4c8ea8e32dddef0da99bbac546952bb20e44 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 26 Dec 2019 13:31:23 -0800 Subject: wip --- starts/meaning-vm/level-0/baseref.hpp | 2 +- starts/meaning-vm/level-0/concept.cpp | 2 +- starts/meaning-vm/level-0/concept.hpp | 2 +- starts/meaning-vm/level-0/memorystore.cpp | 1 + starts/meaning-vm/level-0/ref.cpp | 11 +++++++---- 5 files changed, 11 insertions(+), 7 deletions(-) (limited to 'starts/meaning-vm/level-0') diff --git a/starts/meaning-vm/level-0/baseref.hpp b/starts/meaning-vm/level-0/baseref.hpp index b6e98e8..90c33e1 100644 --- a/starts/meaning-vm/level-0/baseref.hpp +++ b/starts/meaning-vm/level-0/baseref.hpp @@ -149,7 +149,7 @@ public: decltype(concept::links) & links; }; - void unlink(typename links_t::iterator & it) { p->unlink(it.underlying()); } + void unlink(typename links_t::iterator it) { p->unlink(it.underlying()); } bool crucial(typename links_t::iterator it) { return self.p->crucial(it.underlying()); } void setcrucial(typename links_t::iterator it) { self.p->setcrucial(it.underlying()); } }; diff --git a/starts/meaning-vm/level-0/concept.cpp b/starts/meaning-vm/level-0/concept.cpp index 373b3b7..66e5af1 100644 --- a/starts/meaning-vm/level-0/concept.cpp +++ b/starts/meaning-vm/level-0/concept.cpp @@ -75,7 +75,7 @@ void concept::unlink(concept* type) unlink(ls.first); } -void concept::unlink(decltype(links)::iterator & it) +void concept::unlink(decltype(links)::iterator it) { if (crucialparts.count(it)) { throw crucial_link_type_target(selfref, it->first, it->second); diff --git a/starts/meaning-vm/level-0/concept.hpp b/starts/meaning-vm/level-0/concept.hpp index e885ccf..833e417 100644 --- a/starts/meaning-vm/level-0/concept.hpp +++ b/starts/meaning-vm/level-0/concept.hpp @@ -24,7 +24,7 @@ struct concept void link(concept* type, concept* target); void unlink(concept* type, concept* target); void unlink(concept* type); - void unlink(decltype(links)::iterator & it); + void unlink(decltype(links)::iterator it); bool crucial() { return iscrucial || crucialparts.size(); } bool crucial(concept* type, concept* target); diff --git a/starts/meaning-vm/level-0/memorystore.cpp b/starts/meaning-vm/level-0/memorystore.cpp index 1d9e9f6..24e91b0 100644 --- a/starts/meaning-vm/level-0/memorystore.cpp +++ b/starts/meaning-vm/level-0/memorystore.cpp @@ -155,6 +155,7 @@ void dealloc(ref r, ref source) if (r.linked(concepts::allocator())) { return; } try { + if (r.crucial()) { throw crucial_concept(r); } dealloc_from(r); concept * referenced = intellect::level0::referenced(r, source); if (referenced) { diff --git a/starts/meaning-vm/level-0/ref.cpp b/starts/meaning-vm/level-0/ref.cpp index 87e911a..513d3ce 100644 --- a/starts/meaning-vm/level-0/ref.cpp +++ b/starts/meaning-vm/level-0/ref.cpp @@ -3,7 +3,9 @@ #include "errors.hpp" #include "memorystore.hpp" +#include #include +#include using namespace intellect::level0; using namespace concepts; @@ -13,10 +15,11 @@ std::string ref::dump(ref skipmarkertype, ref skipmarkertarget) if (self.linked(skipmarkertype, skipmarkertarget)) { return {}; } - std::string ret = std::to_string((unsigned long)ptr()) + ":\n"; + std::stringstream ss; + ss << std::hex << (size_t)ptr() << ":" << std::endl; for (auto & link : self.links()) { if (link.first.linked(allocator(), level0allocations())) { continue; } - ret += " " + std::to_string((unsigned long)link.first.ptr()) + ": " + std::to_string((unsigned long)link.second.ptr()) + "\n"; + ss << " " << (size_t)link.first.ptr() << ": " << (size_t)link.second.ptr() << std::endl; } self.link(skipmarkertype, skipmarkertarget); for (auto & link : self.links()) { @@ -24,7 +27,7 @@ std::string ref::dump(ref skipmarkertype, ref skipmarkertarget) if (link.first == skipmarkertype && link.second == skipmarkertarget) { continue; } - ret += link.second.dump(skipmarkertype, skipmarkertarget); + ss << link.second.dump(skipmarkertype, skipmarkertarget); } - return ret; + return ss.str(); } -- cgit v1.2.3