summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-0
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm/level-0')
-rw-r--r--starts/meaning-vm/level-0/baseref.hpp2
-rw-r--r--starts/meaning-vm/level-0/concept.cpp2
-rw-r--r--starts/meaning-vm/level-0/concept.hpp2
-rw-r--r--starts/meaning-vm/level-0/memorystore.cpp1
-rw-r--r--starts/meaning-vm/level-0/ref.cpp11
5 files changed, 11 insertions, 7 deletions
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 <iomanip>
#include <ostream>
+#include <sstream>
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();
}