diff --git a/mex/sources/bytecode/Evaluate.cc b/mex/sources/bytecode/Evaluate.cc index 8a7581622f44323eb62e907be74efd529290df2c..0fde22de0d6ce0c831804c1c5565d3fee0619557 100644 --- a/mex/sources/bytecode/Evaluate.cc +++ b/mex/sources/bytecode/Evaluate.cc @@ -229,10 +229,10 @@ Evaluate::Evaluate(const filesystem::path &codfile, bool steady_state_arg, const # ifdef DEBUGL mexPrintf("FBEGINBLOCK\n"); # endif - deserialized_special_instrs.push_back(make_unique<FBEGINBLOCK_>(code)); + deserialized_fbeginblock.emplace_back(code); begin_block.push_back(instructions_list.size()); nb_blocks++; - instr = deserialized_special_instrs.back().get(); + instr = &deserialized_fbeginblock.back(); break; case Tags::FJMPIFEVAL: # ifdef DEBUGL @@ -250,8 +250,8 @@ Evaluate::Evaluate(const filesystem::path &codfile, bool steady_state_arg, const # ifdef DEBUGL mexPrintf("FCALL\n"); # endif - deserialized_special_instrs.push_back(make_unique<FCALL_>(code)); - instr = deserialized_special_instrs.back().get(); + deserialized_fcall.emplace_back(code); + instr = &deserialized_fcall.back(); break; case Tags::FLDTEF: # ifdef DEBUGL diff --git a/mex/sources/bytecode/Evaluate.hh b/mex/sources/bytecode/Evaluate.hh index dcb004d7c498286f02e011594c810a85ae4fe4c0..609f5512c82f0b561883ff23a3ffb2b7bbe537f4 100644 --- a/mex/sources/bytecode/Evaluate.hh +++ b/mex/sources/bytecode/Evaluate.hh @@ -26,6 +26,7 @@ #include <optional> #include <memory> #include <filesystem> +#include <deque> #include "Bytecode.hh" #include "BasicSymbolTable.hh" @@ -43,11 +44,15 @@ private: unique_ptr<char[]> raw_bytecode; /* Owns read instructions that have their specialized deserializing - constructors (and are thus not part of the “code” memory block) */ - vector<unique_ptr<BytecodeInstruction>> deserialized_special_instrs; + constructors (and are thus not part of the “code” memory block). We use + std::deque for storing them, because that class guarantees the stability + of iterators, and thus of pointers to elements; we store such pointers in + the “instructions_list” data member. */ + deque<FBEGINBLOCK_> deserialized_fbeginblock; + deque<FCALL_> deserialized_fcall; /* List of deserialized instructions - Those are either pointers inside “raw_bytecode” or “deserialized_special_instrs” */ + Those are either pointers inside “raw_bytecode” or “deserialized_{fbeginblock,fcall}” */ instructions_list_t instructions_list; // Number of blocks in the model diff --git a/preprocessor b/preprocessor index 92f42bdf68bbdb217647e5268dc91cc7cf05df87..3a187076859751ebc3f6a4e43c9ffc3149655191 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 92f42bdf68bbdb217647e5268dc91cc7cf05df87 +Subproject commit 3a187076859751ebc3f6a4e43c9ffc3149655191