From 549af109b90ec50979bb0361d4624dc987e24af4 Mon Sep 17 00:00:00 2001 From: CHatingPython Date: Sun, 19 Jul 2026 22:04:50 +0200 Subject: [PATCH] fix: fix this mess I am stupid I am stupid I am stupid I can't believe how f- ricking stupid I am --- furas/examples/array.furas | 4 +--- furas/examples/array2.furas | 4 ++-- furvm/include/furvm/fwd.hpp | 2 +- furvm/include/furvm/thing_allocator.hpp | 3 ++- furvm/src/executor.cpp | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/furas/examples/array.furas b/furas/examples/array.furas index 3d687e0..2b1d32d 100644 --- a/furas/examples/array.furas +++ b/furas/examples/array.furas @@ -9,15 +9,13 @@ main: store %0 lenof - push $s32 1 - sub store %1 push $s32 0 loop: dup load %1 - eq + ge jnz #end body: dup diff --git a/furas/examples/array2.furas b/furas/examples/array2.furas index ae51298..e2d268c 100644 --- a/furas/examples/array2.furas +++ b/furas/examples/array2.furas @@ -7,14 +7,14 @@ main: array $arr store %0 - push $s32 1 + push $s32 2 store %1 push $s32 0 loop: dup load %1 - eq + ge jnz #end body: dup diff --git a/furvm/include/furvm/fwd.hpp b/furvm/include/furvm/fwd.hpp index fb12a2e..d7d3798 100644 --- a/furvm/include/furvm/fwd.hpp +++ b/furvm/include/furvm/fwd.hpp @@ -111,7 +111,7 @@ using function_id = std::uint16_t; /** * @brief A handle to a furvm function. */ -using function_h = handle>; +using function_h = handle>; // module.hpp diff --git a/furvm/include/furvm/thing_allocator.hpp b/furvm/include/furvm/thing_allocator.hpp index cd1badb..8419ea1 100644 --- a/furvm/include/furvm/thing_allocator.hpp +++ b/furvm/include/furvm/thing_allocator.hpp @@ -69,8 +69,9 @@ public: [[nodiscard]] T* allocate(std::size_t count = 1) { for (auto it = m_deadThings->begin(); it != m_deadThings->end(); ++it) { if (it->second != count) continue; + T* data = it->first; m_deadThings->erase(it); - return it->first; + return data; } return m_arena->allocate(count); } diff --git a/furvm/src/executor.cpp b/furvm/src/executor.cpp index 0263315..d74918c 100644 --- a/furvm/src/executor.cpp +++ b/furvm/src/executor.cpp @@ -101,7 +101,7 @@ thing_h executor::pop_thing() { if (m_frames.top().stackBase >= m_stack.size()) throw stack_underflow(); thing_h top = std::move(m_stack.top()); m_stack.pop(); - return top; + return std::move(top); } thing_h executor::thing() const {