From 798287ef47a74cacca6a84280fd6ba12d475a7e9 Mon Sep 17 00:00:00 2001 From: CHatingPython Date: Mon, 13 Jul 2026 20:31:41 +0200 Subject: [PATCH] refactor: remove ReturnValue instruction --- furc/src/back/furvm.cpp | 6 +----- furvm/include/furvm/instruction.hpp | 5 ----- furvm/src/executor.cpp | 5 ----- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/furc/src/back/furvm.cpp b/furc/src/back/furvm.cpp index 0f7c9a0..658b641 100644 --- a/furc/src/back/furvm.cpp +++ b/furc/src/back/furvm.cpp @@ -143,11 +143,7 @@ void furvm_generator::generate_instruction(furvm::mod& mod, generate_jump(mod, ctx, branch.else_block(), false); } break; case furlang::ir::instruction_t::Return: { - if (instr.sources().empty()) { - mod.bytecode().push_back(static_cast(furvm::instruction_t::Return)); - } else { - mod.bytecode().push_back(static_cast(furvm::instruction_t::ReturnValue)); - } + mod.bytecode().push_back(static_cast(furvm::instruction_t::Return)); } break; case furlang::ir::instruction_t::Call: { const auto& call = dynamic_cast(instr); diff --git a/furvm/include/furvm/instruction.hpp b/furvm/include/furvm/instruction.hpp index 81c2e2e..c1ece78 100644 --- a/furvm/include/furvm/instruction.hpp +++ b/furvm/include/furvm/instruction.hpp @@ -170,11 +170,6 @@ enum class instruction_t : byte { * @brief Pops the current call frame. */ Return, - - /** - * @brief Pops the current call frame and pushes the first element from the previous stack onto the new stack. - */ - ReturnValue, }; struct instruction { diff --git a/furvm/src/executor.cpp b/furvm/src/executor.cpp index ff8e313..a86c766 100644 --- a/furvm/src/executor.cpp +++ b/furvm/src/executor.cpp @@ -297,11 +297,6 @@ void executor::step() { pop_frame(); if (m_frames.empty()) m_flags = m_flags | executor_flags::Done; } break; - case instruction_t::ReturnValue: { - auto value = pop_thing(); - pop_frame(); - push_thing(std::move(value)); - } break; case instruction_t::PushConstant: throw std::runtime_error("unimplemented"); default: throw std::runtime_error("unknown instruction"); }