From ab64435e8c05073b9af974fbfdc2dedfe18dcc4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 7 Mar 2024 14:50:13 +0100
Subject: [PATCH] Bytecode: simplify FSTPG opcode

---
 src/Bytecode.hh  | 5 ++---
 src/ModelTree.hh | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Bytecode.hh b/src/Bytecode.hh
index 1928f46c..2c1e3083 100644
--- a/src/Bytecode.hh
+++ b/src/Bytecode.hh
@@ -74,7 +74,7 @@ enum class Tag
   FLDR,  // Loads a residual onto the stack
   FSTPR, // Stores a residual from the stack
 
-  FSTPG,  // Stores a derivative from the stack
+  FSTPG,  // Stores the derivative of a simple (single-equation) block in simulate mode
   FSTPG2, // Stores a derivative matrix for a static model from the stack
   FSTPG3, // Stores a derivative matrix for a dynamic model from the stack
 
@@ -279,8 +279,7 @@ struct FSTPSU final : public Instruction
 
 struct FSTPG final : public Instruction
 {
-  const int pos;
-  explicit FSTPG(int pos_arg) : Instruction {Tag::FSTPG}, pos {pos_arg}
+  explicit FSTPG() : Instruction {Tag::FSTPG}
   {
   }
 };
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index e1fe26d4..169d52a4 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -1823,7 +1823,7 @@ ModelTree::writeBlockBytecodeHelper(Bytecode::Writer& code_file, int block,
                                               blocks_temporary_terms_idxs, tef_terms);
             else
               code_file << Bytecode::FLDZ {};
-            code_file << Bytecode::FSTPG {0};
+            code_file << Bytecode::FSTPG {};
           }
           break;
 
-- 
GitLab