refactor(furvm): add shared pointer aliases

This commit is contained in:
2026-06-06 23:08:20 +02:00
parent 6824015728
commit daf16c18e1
6 changed files with 56 additions and 40 deletions
+8 -8
View File
@@ -1,23 +1,23 @@
#include "furvm/executor.hpp"
#include "furvm/context.hpp"
#include "furvm/context.hpp" // IWYU pragma: keep
namespace furvm {
executor::executor(egzekutor, executor_handle id, const std::shared_ptr<context>& context)
executor::executor(egzekutor, executor_handle id, const context_p& context)
: m_id(id), m_context(context) {}
executor::~executor() {
m_context->m_executors[m_id] = nullptr;
}
std::shared_ptr<executor> executor::create(const std::shared_ptr<context>& context) {
executor_p executor::create(const context_p& context) {
auto ex = std::make_shared<executor>(egzekutor{}, context->m_executors.size(), context);
context->m_executors.push_back(ex);
return std::move(ex);
}
void executor::push_frame(const std::shared_ptr<mod>& mod, std::size_t position) {
void executor::push_frame(const mod_p& mod, std::size_t position) {
m_frames.emplace((struct executor::frame){ mod, position, m_stack.size() });
}
@@ -31,18 +31,18 @@ struct executor::frame executor::frame() const {
return m_frames.top();
}
void executor::push_thing(const std::shared_ptr<class thing>& thing) {
void executor::push_thing(const thing_p& thing) {
m_stack.push(thing);
}
std::shared_ptr<class thing> executor::pop_thing() {
thing_p executor::pop_thing() {
if (m_frames.top().stackBase >= m_stack.size()) return {};
std::shared_ptr<class thing> top = std::move(m_stack.top());
thing_p top = std::move(m_stack.top());
m_stack.pop();
return top;
}
std::shared_ptr<class thing> executor::thing() const {
thing_p executor::thing() const {
if (m_frames.top().stackBase >= m_stack.size()) return {};
return m_stack.top();
}