summaryrefslogtreecommitdiff
path: root/starts/meaning-vm
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-12 01:35:42 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-12 01:35:42 -0800
commitf04b23092c201e13229ee90625d03e97286649f4 (patch)
tree8b8651b3ac2c9dfb2e06d94ef6ae6abb2f91d033 /starts/meaning-vm
parentc87af57ce54cac3ae7f49758f3fc3fb6e0abb451 (diff)
downloadstandingwithresilience-f04b23092c201e13229ee90625d03e97286649f4.tar.gz
standingwithresilience-f04b23092c201e13229ee90625d03e97286649f4.zip
this code appears to make a try{} block loop in a weird compiler exception edgecase, narroing
Diffstat (limited to 'starts/meaning-vm')
-rw-r--r--starts/meaning-vm/level-0/memorystore.cpp13
-rw-r--r--starts/meaning-vm/level-0/memorystore.hpp1
-rw-r--r--starts/meaning-vm/level0.cpp2
-rw-r--r--starts/meaning-vm/level1.cpp16
-rw-r--r--starts/meaning-vm/makefile2
5 files changed, 24 insertions, 10 deletions
diff --git a/starts/meaning-vm/level-0/memorystore.cpp b/starts/meaning-vm/level-0/memorystore.cpp
index 220d0c3..edb75b1 100644
--- a/starts/meaning-vm/level-0/memorystore.cpp
+++ b/starts/meaning-vm/level-0/memorystore.cpp
@@ -17,10 +17,10 @@ static auto & index()
namespace concepts {
- ref allocator() { static ref ret = basic_alloc(); return ret; };
- ref allocates() { static ref ret = basic_alloc(); return ret; };
- ref allocations() { static ref ret = basic_alloc(); return ret; };
- ref level0allocations() { static ref ret = basic_alloc(); return ret; };
+ ref allocator() { static ref ret = basic_alloc(); return ret; }
+ ref allocates() { static ref ret = basic_alloc(); return ret; }
+ ref allocations() { static ref ret = basic_alloc(); return ret; }
+ ref level0allocations() { static ref ret = basic_alloc(); return ret; }
}
struct init { init()
@@ -117,8 +117,9 @@ void dealloc_from(ref source)
}
try {
for (auto allocation : ours ) {
- if (allocation.linked(concepts::allocates())) {
- dealloc_from(allocation);
+ for (auto suballocation : allocation.getAll(concepts::allocates())) {
+ // check for this link to find subgroups
+ throw still_referenced_by(allocation, suballocation);
}
}
for (auto ghost : ours) {
diff --git a/starts/meaning-vm/level-0/memorystore.hpp b/starts/meaning-vm/level-0/memorystore.hpp
index f4faa13..55723b2 100644
--- a/starts/meaning-vm/level-0/memorystore.hpp
+++ b/starts/meaning-vm/level-0/memorystore.hpp
@@ -44,7 +44,6 @@ void basic_dealloc(ref allocated);
ref alloc(ref allocator, std::any data = {}); // new concept
void alloc(ref allocated, ref allocator); // extra ownership for concept
void realloc(ref allocated, ref allocator); // move ownership for concept to allocator
-[[deprecated("can make recursion: turn to workable habits")]]
void dealloc(ref allocated, ref allocator); // remove ownership for concept
std::size_t allocated();
diff --git a/starts/meaning-vm/level0.cpp b/starts/meaning-vm/level0.cpp
index 4ab8b7b..4ed9e22 100644
--- a/starts/meaning-vm/level0.cpp
+++ b/starts/meaning-vm/level0.cpp
@@ -43,7 +43,7 @@ int main()
std::cout << allocated() << " allocated" << std::endl;
e.unlink(b, a);
- //dealloc(a, store);
+ dealloc(a, store);
dealloc(store, concepts::allocations());
std::cout << allocated() << " allocated" << std::endl;
diff --git a/starts/meaning-vm/level1.cpp b/starts/meaning-vm/level1.cpp
index 3c1a634..51c7fdd 100644
--- a/starts/meaning-vm/level1.cpp
+++ b/starts/meaning-vm/level1.cpp
@@ -65,7 +65,21 @@ int main()
std::cout << apple.dump("dumped", true) << std::endl;
std::cout << intellect::level0::allocated() << " allocated" << std::endl;
- intellect::level0::dealloc(intellect::level0::concepts::allocations(), intellect::level0::concepts::level0allocations());
+ while (true) {
+ try {
+ std::cout << "calling dealloc" << std::endl;
+ intellect::level0::dealloc(intellect::level0::concepts::allocations(), intellect::level0::concepts::level0allocations());
+ } catch (intellect::level0::still_referenced_by &e) {
+ std::cout << "expected exception" << std::endl;
+ if (e.topic->linked(intellect::level0::concepts::allocates(), e.referrer)) {
+ intellect::level0::dealloc(e.referrer, e.topic);
+ } else {
+ throw;
+ }
+ } catch (...) {
+ std::cout << "unexpected exception" << std::endl;
+ }
+ }
std::cout << intellect::level0::allocated() << " allocated" << std::endl;
return 0;
diff --git a/starts/meaning-vm/makefile b/starts/meaning-vm/makefile
index 637c4fe..3c560e0 100644
--- a/starts/meaning-vm/makefile
+++ b/starts/meaning-vm/makefile
@@ -1,4 +1,4 @@
-CXXFLAGS=-Wall -Werror -Wno-error=deprecated-declarations -std=gnu++17 -fno-operator-names -ggdb -O0
+CXXFLAGS=-pedantic -Wall -Werror -Wno-error=deprecated-declarations -std=gnu++17 -fno-operator-names -ggdb -O0
LINK.o=$(LINK.cc)
all: level0 level1 habit-starts/rhythm