diff options
author | user <user@localhost.localdomain> | 2019-12-26 13:31:23 -0800 |
---|---|---|
committer | user <user@localhost.localdomain> | 2019-12-26 13:31:23 -0800 |
commit | 1c0b4c8ea8e32dddef0da99bbac546952bb20e44 (patch) | |
tree | 45b7c1f593df2f80f07727ff04d6ad53a23f3eef /starts/meaning-vm/level0.cpp | |
parent | dc2779f5a7ceb226620f39e728b73b028cb17c10 (diff) | |
download | standingwithresilience-1c0b4c8ea8e32dddef0da99bbac546952bb20e44.tar.gz standingwithresilience-1c0b4c8ea8e32dddef0da99bbac546952bb20e44.zip |
wip
Diffstat (limited to 'starts/meaning-vm/level0.cpp')
-rw-r--r-- | starts/meaning-vm/level0.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/starts/meaning-vm/level0.cpp b/starts/meaning-vm/level0.cpp index add6689..6beb789 100644 --- a/starts/meaning-vm/level0.cpp +++ b/starts/meaning-vm/level0.cpp @@ -5,7 +5,7 @@ using namespace intellect::level0; -#define out(name) std::cout << " " #name ":" << (long)name.ptr() +#define out(name) std::cout << " " #name ":" << std::hex << (size_t)name.ptr() << std::dec int main() { @@ -41,9 +41,34 @@ int main() std::cout << "Code: "; a.vget<std::function<void()>>(codelink)(); std::cout << allocated() << " allocated" << std::endl; + + a.get(codelink).setcrucial(); + try { + dealloc(a.get(codelink), a); + throw "deallocd crucial concept"; + } catch (crucial_concept e) { + realloc(a.get(codelink), concepts::level0allocations()); + } + a.setcrucial(codelink, a.get(codelink)); + try { + a.unlink(codelink); + throw "unlinkd crucial link"; + } catch (crucial_link_type_target e) { + realloc(a, concepts::level0allocations()); + realloc(codelink, concepts::level0allocations()); + } + + for (auto c : { a, a.get(codelink) } ) + for (auto it = c.links().begin(); it != c.links().end();) { + if (!c.crucial(it) && !it->first.linked(concepts::allocator(), concepts::level0allocations())) { + c.unlink(it++); + } else { + ++ it; + } + } e.unlink(b, a); - dealloc(a, store); + //dealloc(a, store); dealloc(store, concepts::allocations()); std::cout << allocated() << " allocated" << std::endl; |