docs(furvm): document the executor

Refs: #12
This commit is contained in:
2026-06-21 19:40:33 +02:00
parent 3a2fa32ce1
commit b6d3387388
+22 -14
View File
@@ -36,7 +36,7 @@ public:
* Call frame. * Call frame.
*/ */
struct frame { struct frame {
mod_h mod; /**< Shared pointer to a module with the bytecode. */ mod_h mod; /**< Handle to the frame's module. */
std::size_t position; /**< Cursor to a current instruction in the bytecode. */ std::size_t position; /**< Cursor to a current instruction in the bytecode. */
std::size_t stackBase; /**< Snapshot of the stack size before this frame. */ std::size_t stackBase; /**< Snapshot of the stack size before this frame. */
@@ -83,8 +83,8 @@ public:
/** /**
* @brief Pushes a new frame. * @brief Pushes a new frame.
* *
* @param mod Module. * @param mod Handle to the frame's module.
* @param function Function handle. * @param function Frame's function.
*/ */
void push_frame(const mod_h& mod, function function); void push_frame(const mod_h& mod, function function);
@@ -102,6 +102,11 @@ public:
*/ */
frame frame() const; frame frame() const;
public: public:
/**
* @brief Pushes a thing handle onto the stack.
*
* @param handle Thing handle.
*/
template <typename HandleFwd> template <typename HandleFwd>
void push_thing(HandleFwd&& handle) { void push_thing(HandleFwd&& handle) {
m_stack.emplace(std::forward<HandleFwd>(handle)); m_stack.emplace(std::forward<HandleFwd>(handle));
@@ -110,45 +115,48 @@ public:
/** /**
* @brief Pushes a thing onto the stack. * @brief Pushes a thing onto the stack.
* *
* @param thing The thing to push. * Registers a new thing and pushes its handle onto the stack.
*
* @param thing Thing.
* @return The pushed handle.
*/ */
thing_h push_thing(class thing<>&& thing); thing_h push_thing(class thing<>&& thing);
/** /**
* @brief Pops a thing from the stack. * @brief Pops a thing from the stack.
* *
* @return The popped thing. * @return A handle to the popped thing.
*/ */
thing_h pop_thing(); thing_h pop_thing();
/** /**
* @brief Returns the top thing on the stack. * @brief Returns the top thing on the stack.
* *
* @return The thing. * @return A handle to the top thing.
*/ */
thing_h thing() const; thing_h thing() const;
public: public:
/** /**
* @brief Stores a thing in a variable. * @brief Stores a thing in a frame variable.
* *
* @param variable Variable to store the thing in. * @param variable Id of the variable in which the handle will be put.
* @param thing Thing to store. * @param thing Thing handle.
*/ */
void store_thing(variable_t variable, const thing_h& thing); void store_thing(variable_t variable, const thing_h& thing);
/** /**
* @brief Stores a thing in a variable. * @brief Stores a thing in a frame variable.
* *
* @param variable Variable to store the thing in. * @param variable Id of the variable in which the handle will be put.
* @param thing Thing to store. * @param thing Thing handle.
*/ */
void store_thing(variable_t variable, thing_h&& thing); void store_thing(variable_t variable, thing_h&& thing);
/** /**
* @brief Returns a thing stored in a variable. * @brief Returns a thing stored in a variable.
* *
* @param variable Variable where the thing is stored. * @param variable Id of the variable from which the handle will be fetched.
* @return The thing stored in the variable. * @return A handle stored in the variable.
*/ */
thing_h load_thing(variable_t variable) const; thing_h load_thing(variable_t variable) const;
public: public: