refactor(furvm): use generational indexes for thing

Refs: #10
This commit is contained in:
2026-06-10 15:31:23 +02:00
parent d86f38d166
commit 26d77bdc02
3 changed files with 23 additions and 10 deletions
+6 -4
View File
@@ -5,6 +5,7 @@
#include "furvm/fwd.hpp"
#include "furvm/module.hpp"
#include <queue>
#include <type_traits>
#include <vector>
@@ -21,12 +22,12 @@ public:
/**
* @brief Move constructor.
*/
context(context&&) = default;
context(context&&) noexcept = default;
/**
* @brief Move constructor.
*/
context& operator=(context&&) = default;
context& operator=(context&&) noexcept = default;
context(const context&) = delete;
context& operator=(const context&) = delete;
@@ -97,8 +98,9 @@ private:
std::vector<thing_p> m_things;
std::vector<executor_p> m_executors;
std::vector<void*> m_deadThings;
furlang::arena m_thingArena;
std::queue<thing_handle> m_deadThings;
std::vector<void*> m_deadThingData;
furlang::arena m_thingArena;
};
} // namespace furvm
+3 -1
View File
@@ -50,7 +50,7 @@ public:
const char* what() const noexcept override { return "bad thing access"; }
};
class thing {
class thing final {
friend class executor;
private:
/**
@@ -61,6 +61,8 @@ private:
struct rzecz {
explicit rzecz() = default;
};
public:
static constexpr thing_handle GENERATION_SIZE = 12; /**< Bit size of generation part in thing_handle. */
public:
/**
* @brief Private constructor.