feat(furvm): add reference counting

Refs: #10
This commit is contained in:
2026-06-10 15:42:45 +02:00
parent 26d77bdc02
commit a4fd939cd2
2 changed files with 23 additions and 1 deletions
+2
View File
@@ -38,6 +38,7 @@ struct executor::frame executor::frame() const {
}
void executor::push_thing(const thing_p& thing) {
thing->add_reference();
m_stack.push(thing);
}
@@ -45,6 +46,7 @@ thing_p executor::pop_thing() {
if (m_frames.top().stackBase >= m_stack.size()) throw stack_underflow();
thing_p top = std::move(m_stack.top());
m_stack.pop();
top->remove_reference();
return top;
}