Bytecode: merge CodeLoad class into Evaluate

silicon
Sébastien Villemot 2023-02-23 11:21:22 -05:00
parent 895ce96c61
commit aaab993ccf
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
4 changed files with 327 additions and 373 deletions

View File

@ -22,8 +22,11 @@
#include <limits>
#include <stack>
#include <dynmex.h>
#include "Evaluate.hh"
#include "CommonEnums.hh"
#include "ErrorHandling.hh"
Evaluate::Evaluate(int y_size_arg, int y_kmin_arg, int y_kmax_arg, bool steady_state_arg, int periods_arg, BasicSymbolTable &symbol_table_arg) :
symbol_table {symbol_table_arg}
@ -38,6 +41,271 @@ Evaluate::Evaluate(int y_size_arg, int y_kmin_arg, int y_kmax_arg, bool steady_s
steady_state = steady_state_arg;
}
void
Evaluate::loadCodeFile(const filesystem::path &codfile)
{
ifstream CompiledCode {codfile, ios::in | ios::binary | ios::ate};
if (!CompiledCode.is_open())
throw FatalException {codfile.string() + " cannot be opened"};
auto Code_Size {CompiledCode.tellg()};
raw_bytecode = make_unique<char[]>(Code_Size);
auto code {raw_bytecode.get()};
CompiledCode.seekg(0);
CompiledCode.read(code, Code_Size);
CompiledCode.close();
bool done {false};
while (!done)
{
BytecodeInstruction *instr {reinterpret_cast<BytecodeInstruction *>(code)};
switch (*reinterpret_cast<Tags *>(code))
{
case Tags::FLDZ:
# ifdef DEBUGL
mexPrintf("FLDZ\n");
# endif
code += sizeof(FLDZ_);
break;
case Tags::FEND:
# ifdef DEBUGL
mexPrintf("FEND\n");
# endif
code += sizeof(FEND_);
done = true;
break;
case Tags::FENDBLOCK:
# ifdef DEBUGL
mexPrintf("FENDBLOCK\n");
# endif
code += sizeof(FENDBLOCK_);
break;
case Tags::FENDEQU:
# ifdef DEBUGL
mexPrintf("FENDEQU\n");
# endif
code += sizeof(FENDEQU_);
break;
case Tags::FDIMT:
# ifdef DEBUGL
mexPrintf("FDIMT\n");
# endif
code += sizeof(FDIMT_);
break;
case Tags::FDIMST:
# ifdef DEBUGL
mexPrintf("FDIMST\n");
# endif
code += sizeof(FDIMST_);
break;
case Tags::FNUMEXPR:
# ifdef DEBUGL
mexPrintf("FNUMEXPR\n");
# endif
code += sizeof(FNUMEXPR_);
break;
case Tags::FLDC:
# ifdef DEBUGL
mexPrintf("FLDC\n");
# endif
code += sizeof(FLDC_);
break;
case Tags::FLDU:
# ifdef DEBUGL
mexPrintf("FLDU\n");
# endif
code += sizeof(FLDU_);
break;
case Tags::FLDSU:
# ifdef DEBUGL
mexPrintf("FLDSU\n");
# endif
code += sizeof(FLDSU_);
break;
case Tags::FLDR:
# ifdef DEBUGL
mexPrintf("FLDR\n");
# endif
code += sizeof(FLDR_);
break;
case Tags::FLDT:
# ifdef DEBUGL
mexPrintf("FLDT\n");
# endif
code += sizeof(FLDT_);
break;
case Tags::FLDST:
# ifdef DEBUGL
mexPrintf("FLDST\n");
# endif
code += sizeof(FLDST_);
break;
case Tags::FSTPT:
# ifdef DEBUGL
mexPrintf("FSTPT\n");
# endif
code += sizeof(FSTPT_);
break;
case Tags::FSTPST:
# ifdef DEBUGL
mexPrintf("FSTPST\n");
# endif
code += sizeof(FSTPST_);
break;
case Tags::FSTPR:
# ifdef DEBUGL
mexPrintf("FSTPR\n");
# endif
code += sizeof(FSTPR_);
break;
case Tags::FSTPU:
# ifdef DEBUGL
mexPrintf("FSTPU\n");
# endif
code += sizeof(FSTPU_);
break;
case Tags::FSTPSU:
# ifdef DEBUGL
mexPrintf("FSTPSU\n");
# endif
code += sizeof(FSTPSU_);
break;
case Tags::FSTPG:
# ifdef DEBUGL
mexPrintf("FSTPG\n");
# endif
code += sizeof(FSTPG_);
break;
case Tags::FSTPG2:
# ifdef DEBUGL
mexPrintf("FSTPG2\n");
# endif
code += sizeof(FSTPG2_);
break;
case Tags::FSTPG3:
# ifdef DEBUGL
mexPrintf("FSTPG3\n");
# endif
code += sizeof(FSTPG3_);
break;
case Tags::FUNARY:
# ifdef DEBUGL
mexPrintf("FUNARY\n");
# endif
code += sizeof(FUNARY_);
break;
case Tags::FBINARY:
# ifdef DEBUGL
mexPrintf("FBINARY\n");
# endif
code += sizeof(FBINARY_);
break;
case Tags::FTRINARY:
# ifdef DEBUGL
mexPrintf("FTRINARY\n");
# endif
code += sizeof(FTRINARY_);
break;
case Tags::FLDVS:
# ifdef DEBUGL
mexPrintf("FLDVS\n");
# endif
code += sizeof(FLDVS_);
break;
case Tags::FLDSV:
# ifdef DEBUGL
mexPrintf("FLDSV\n");
# endif
code += sizeof(FLDSV_);
break;
case Tags::FSTPSV:
# ifdef DEBUGL
mexPrintf("FSTPSV\n");
# endif
code += sizeof(FSTPSV_);
break;
case Tags::FLDV:
# ifdef DEBUGL
mexPrintf("FLDV\n");
# endif
code += sizeof(FLDV_);
break;
case Tags::FSTPV:
# ifdef DEBUGL
mexPrintf("FSTPV\n");
# endif
code += sizeof(FSTPV_);
break;
case Tags::FBEGINBLOCK:
# ifdef DEBUGL
mexPrintf("FBEGINBLOCK\n");
# endif
deserialized_special_instrs.push_back(make_unique<FBEGINBLOCK_>(code));
begin_block.push_back(instructions_list.size());
nb_blocks++;
instr = deserialized_special_instrs.back().get();
break;
case Tags::FJMPIFEVAL:
# ifdef DEBUGL
mexPrintf("FJMPIFEVAL\n");
# endif
code += sizeof(FJMPIFEVAL_);
break;
case Tags::FJMP:
# ifdef DEBUGL
mexPrintf("FJMP\n");
# endif
code += sizeof(FJMP_);
break;
case Tags::FCALL:
# ifdef DEBUGL
mexPrintf("FCALL\n");
# endif
deserialized_special_instrs.push_back(make_unique<FCALL_>(code));
instr = deserialized_special_instrs.back().get();
break;
case Tags::FLDTEF:
# ifdef DEBUGL
mexPrintf("FLDTEF\n");
# endif
code += sizeof(FLDTEF_);
break;
case Tags::FSTPTEF:
# ifdef DEBUGL
mexPrintf("FSTPTEF\n");
# endif
code += sizeof(FSTPTEF_);
break;
case Tags::FLDTEFD:
# ifdef DEBUGL
mexPrintf("FLDTEFD\n");
# endif
code += sizeof(FLDTEFD_);
break;
case Tags::FSTPTEFD:
# ifdef DEBUGL
mexPrintf("FSTPTEFD\n");
# endif
code += sizeof(FSTPTEFD_);
break;
case Tags::FLDTEFDD:
# ifdef DEBUGL
mexPrintf("FLDTEFDD\n");
# endif
code += sizeof(FLDTEFDD_);
break;
case Tags::FSTPTEFDD:
# ifdef DEBUGL
mexPrintf("FSTPTEFDD\n");
# endif
code += sizeof(FSTPTEFDD_);
break;
default:
throw FatalException {"Unknown tag value=" + to_string(static_cast<int>(*reinterpret_cast<Tags *>(code)))};
}
instructions_list.push_back(instr);
}
}
string
Evaluate::error_location(it_code_type expr_begin, it_code_type faulty_op, bool steady_state, int it_) const
{
@ -112,8 +380,8 @@ Evaluate::error_location(it_code_type expr_begin, it_code_type faulty_op, bool s
return Error_loc.str();
}
pair<string, it_code_type>
Evaluate::print_expression(const it_code_type &expr_begin, const optional<it_code_type> &faulty_op) const
pair<string, Evaluate::it_code_type>
Evaluate::print_expression(const Evaluate::it_code_type &expr_begin, const optional<it_code_type> &faulty_op) const
{
/* First element is output string, 2nd element is precedence of last
operator, 3rd element is opcode if the last operator was a binary

View File

@ -25,356 +25,43 @@
#include <map>
#include <optional>
#include <memory>
#include <filesystem>
#include "Bytecode.hh"
#include "ErrorHandling.hh"
#include "BasicSymbolTable.hh"
#include <dynmex.h>
using instructions_list_t = vector<BytecodeInstruction *>;
using it_code_type = instructions_list_t::const_iterator;
class CodeLoad
{
private:
char *code;
int nb_blocks;
vector<size_t> begin_block;
// Owns read instructions that have their specialized deserializing constructors
vector<unique_ptr<BytecodeInstruction>> deserialized_special_instrs;
public:
int
get_block_number() const
{
return nb_blocks;
}
size_t
get_begin_block(int block) const
{
return begin_block[block];
}
instructions_list_t
get_op_code(const filesystem::path &codfile)
{
instructions_list_t tags_liste;
ifstream CompiledCode;
streamoff Code_Size;
CompiledCode.open(codfile, ios::in | ios::binary| ios::ate);
if (!CompiledCode.is_open())
return tags_liste;
Code_Size = CompiledCode.tellg();
CompiledCode.seekg(ios::beg);
code = static_cast<char *>(mxMalloc(Code_Size));
CompiledCode.seekg(0);
CompiledCode.read(reinterpret_cast<char *>(code), Code_Size);
CompiledCode.close();
nb_blocks = 0;
bool done = false;
int instruction = 0;
while (!done)
{
BytecodeInstruction *instr {reinterpret_cast<BytecodeInstruction *>(code)};
switch (*reinterpret_cast<Tags *>(code))
{
case Tags::FLDZ:
# ifdef DEBUGL
mexPrintf("FLDZ = %d size = %d\n", Tags::FLDZ, sizeof(FLDZ_));
# endif
tags_liste.push_back(instr);
code += sizeof(FLDZ_);
break;
case Tags::FEND:
# ifdef DEBUGL
mexPrintf("FEND\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FEND_);
done = true;
break;
case Tags::FENDBLOCK:
# ifdef DEBUGL
mexPrintf("FENDBLOCK\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FENDBLOCK_);
break;
case Tags::FENDEQU:
# ifdef DEBUGL
mexPrintf("FENDEQU\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FENDEQU_);
break;
case Tags::FDIMT:
# ifdef DEBUGL
mexPrintf("FDIMT = %d size = %d\n", Tags::FDIMT, sizeof(FDIMT_));
# endif
tags_liste.push_back(instr);
code += sizeof(FDIMT_);
break;
case Tags::FDIMST:
# ifdef DEBUGL
mexPrintf("FDIMST\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FDIMST_);
break;
case Tags::FNUMEXPR:
# ifdef DEBUGL
mexPrintf("FNUMEXPR\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FNUMEXPR_);
break;
case Tags::FLDC:
# ifdef DEBUGL
mexPrintf("FLDC\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDC_);
break;
case Tags::FLDU:
# ifdef DEBUGL
mexPrintf("FLDU\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDU_);
break;
case Tags::FLDSU:
# ifdef DEBUGL
mexPrintf("FLDSU\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDSU_);
break;
case Tags::FLDR:
# ifdef DEBUGL
mexPrintf("FLDR\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDR_);
break;
case Tags::FLDT:
# ifdef DEBUGL
mexPrintf("FLDT\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDT_);
break;
case Tags::FLDST:
# ifdef DEBUGL
mexPrintf("FLDST\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDST_);
break;
case Tags::FSTPT:
# ifdef DEBUGL
mexPrintf("FSTPT = %d size = %d\n", Tags::FSTPT, sizeof(FSTPT_));
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPT_);
break;
case Tags::FSTPST:
# ifdef DEBUGL
mexPrintf("FSTPST\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPST_);
break;
case Tags::FSTPR:
# ifdef DEBUGL
mexPrintf("FSTPR\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPR_);
break;
case Tags::FSTPU:
# ifdef DEBUGL
mexPrintf("FSTPU\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPU_);
break;
case Tags::FSTPSU:
# ifdef DEBUGL
mexPrintf("FSTPSU\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPSU_);
break;
case Tags::FSTPG:
# ifdef DEBUGL
mexPrintf("FSTPG\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPG_);
break;
case Tags::FSTPG2:
# ifdef DEBUGL
mexPrintf("FSTPG2\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPG2_);
break;
case Tags::FSTPG3:
# ifdef DEBUGL
mexPrintf("FSTPG3\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPG3_);
break;
case Tags::FUNARY:
# ifdef DEBUGL
mexPrintf("FUNARY\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FUNARY_);
break;
case Tags::FBINARY:
# ifdef DEBUGL
mexPrintf("FBINARY\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FBINARY_);
break;
case Tags::FTRINARY:
# ifdef DEBUGL
mexPrintf("FTRINARY\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FTRINARY_);
break;
case Tags::FLDVS:
# ifdef DEBUGL
mexPrintf("FLDVS\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDVS_);
break;
case Tags::FLDSV:
# ifdef DEBUGL
mexPrintf("FLDSV\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDSV_);
break;
case Tags::FSTPSV:
# ifdef DEBUGL
mexPrintf("FSTPSV\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPSV_);
break;
case Tags::FLDV:
# ifdef DEBUGL
mexPrintf("FLDV\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDV_);
break;
case Tags::FSTPV:
# ifdef DEBUGL
mexPrintf("FSTPV\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPV_);
break;
case Tags::FBEGINBLOCK:
# ifdef DEBUGL
mexPrintf("FBEGINBLOCK\n");
# endif
{
deserialized_special_instrs.push_back(make_unique<FBEGINBLOCK_>(code));
begin_block.push_back(tags_liste.size());
tags_liste.push_back(deserialized_special_instrs.back().get());
nb_blocks++;
}
break;
case Tags::FJMPIFEVAL:
# ifdef DEBUGL
mexPrintf("FJMPIFEVAL\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FJMPIFEVAL_);
break;
case Tags::FJMP:
# ifdef DEBUGL
mexPrintf("FJMP\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FJMP_);
break;
case Tags::FCALL:
{
# ifdef DEBUGL
mexPrintf("FCALL\n");
# endif
deserialized_special_instrs.push_back(make_unique<FCALL_>(code));
tags_liste.push_back(deserialized_special_instrs.back().get());
# ifdef DEBUGL
mexPrintf("FCALL finish\n"); mexEvalString("drawnow;");
mexPrintf("-- *code=%d\n", *code); mexEvalString("drawnow;");
# endif
}
break;
case Tags::FLDTEF:
# ifdef DEBUGL
mexPrintf("FLDTEF\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDTEF_);
break;
case Tags::FSTPTEF:
# ifdef DEBUGL
mexPrintf("FSTPTEF\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPTEF_);
break;
case Tags::FLDTEFD:
# ifdef DEBUGL
mexPrintf("FLDTEFD\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDTEFD_);
break;
case Tags::FSTPTEFD:
# ifdef DEBUGL
mexPrintf("FSTPTEFD\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPTEFD_);
break;
case Tags::FLDTEFDD:
# ifdef DEBUGL
mexPrintf("FLDTEFDD\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FLDTEFDD_);
break;
case Tags::FSTPTEFDD:
# ifdef DEBUGL
mexPrintf("FSTPTEFDD\n");
# endif
tags_liste.push_back(instr);
code += sizeof(FSTPTEFDD_);
break;
default:
mexPrintf("Unknown Tag value=%d code=%x\n", *code, code);
done = true;
}
instruction++;
}
return tags_liste;
}
};
class Evaluate
{
private:
using instructions_list_t = vector<BytecodeInstruction *>;
protected: // TODO: REMOVE
using it_code_type = instructions_list_t::const_iterator;
private: // TODO: REMOVE
// Memory copy of the contents of the .cod file
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;
protected: // TODO: REMOVE
/* List of deserialized instructions
Those are either pointers inside raw_bytecode or deserialized_special_instrs */
instructions_list_t instructions_list;
// Number of blocks in the model
int nb_blocks {0};
// Index of beginnings of blocks within instructions_list
vector<size_t> begin_block;
// Iterator to current bytecode instruction within “instructions_list”
it_code_type it_code;
it_code_type start_code, end_code;
private: // TODO: REMOVE
ExpressionType EQN_type;
int EQN_equation, EQN_block, EQN_dvar1;
int EQN_lag1, EQN_lag2, EQN_lag3;
@ -398,7 +85,6 @@ protected:
double *g1, *r, *res;
vector<mxArray *> jacobian_block, jacobian_exo_block, jacobian_det_exo_block;
mxArray *GlobalTemporaryTerms;
it_code_type start_code, end_code;
double pow1(double a, double b);
double divide(double a, double b);
double log1(double a);
@ -407,8 +93,6 @@ protected:
void solve_simple_one_periods();
void solve_simple_over_periods(bool forward);
void compute_block_time(int Per_u_, bool evaluate, bool no_derivatives);
instructions_list_t code_liste;
it_code_type it_code;
int Per_u_, Per_y_;
int it_;
int maxit_;
@ -430,7 +114,7 @@ protected:
bool steady_state;
/* Prints a bytecode expression in human readable form.
If faulty_op is not default constructed, it should point to a tag withing
If faulty_op is not default constructed, it should point to a tag within
the expression that created a floating point exception, in which case the
corresponding mathematical operator will be printed within braces.
The second output argument points to the tag past the expression. */
@ -438,6 +122,8 @@ protected:
public:
Evaluate(int y_size_arg, int y_kmin_arg, int y_kmax_arg, bool steady_state_arg, int periods_arg, BasicSymbolTable &symbol_table_arg);
// TODO: integrate into the constructor
void loadCodeFile(const filesystem::path &codfile);
void set_block(int size_arg, BlockSimulationType type_arg, string file_name_arg, string bin_base_name_arg, int block_num_arg,
bool is_linear_arg, int symbol_table_endo_nbr_arg, int u_count_int_arg, int block_arg);
void evaluate_complete(bool no_derivatives);
@ -445,6 +131,12 @@ public:
void compute_complete_2b(bool no_derivatives, double *_res1, double *_res2, double *_max_res, int *_max_res_idx);
bool compute_complete(double lambda, double *crit);
int
get_block_number() const
{
return nb_blocks;
}
};
#endif // _EVALUATE_HH

View File

@ -551,20 +551,17 @@ Interpreter::print_a_block()
}
void
Interpreter::ReadCodeFile(const string &file_name, CodeLoad &code)
Interpreter::ReadCodeFile(const string &file_name)
{
filesystem::path codfile {file_name + "/model/bytecode/" + (block_decomposed ? "block/" : "")
+ (steady_state ? "static" : "dynamic") + ".cod"};
//First read and store in memory the code
code_liste = code.get_op_code(codfile);
EQN_block_number = code.get_block_number();
if (!code_liste.size())
throw FatalException{"In compute_blocks, " + codfile.string() + " cannot be opened"};
if (block >= code.get_block_number())
loadCodeFile(codfile);
EQN_block_number = get_block_number();
if (block >= get_block_number())
throw FatalException{"In compute_blocks, input argument block = " + to_string(block+1)
+ " is greater than the number of blocks in the model ("
+ to_string(code.get_block_number()) + " see M_.block_structure_stat.block)"};
+ " is greater than the number of blocks in the model ("
+ to_string(get_block_number()) + " see M_.block_structure" + (steady_state ? "_stat" : "") + ".block)"};
}
void
@ -599,7 +596,7 @@ Interpreter::check_for_controlled_exo_validity(FBEGINBLOCK_ *fb, const vector<s_
}
bool
Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool evaluate, int block, bool constrained, const vector<s_plan> &sconstrained_extended_path, const vector_table_conditional_local_type &vector_table_conditional_local)
Interpreter::MainLoop(const string &bin_basename, bool evaluate, int block, bool constrained, const vector<s_plan> &sconstrained_extended_path, const vector_table_conditional_local_type &vector_table_conditional_local)
{
int var;
Block_Count = -1;
@ -720,7 +717,7 @@ Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool eva
T = static_cast<double *>(mxMalloc(var*(periods+y_kmin+y_kmax)*sizeof(double)));
test_mxMalloc(T, __LINE__, __FILE__, __func__, var*(periods+y_kmin+y_kmax)*sizeof(double));
if (block >= 0)
it_code = code_liste.begin() + code.get_begin_block(block);
it_code = instructions_list.begin() + begin_block[block];
else
it_code++;
break;
@ -749,7 +746,7 @@ Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool eva
}
if (block >= 0)
it_code = code_liste.begin() + code.get_begin_block(block);
it_code = instructions_list.begin() + begin_block[block];
else
it_code++;
break;
@ -808,11 +805,9 @@ Interpreter::elastic(string str, unsigned int len, bool left)
bool
Interpreter::extended_path(const string &file_name, bool evaluate, int block, int &nb_blocks, int nb_periods, const vector<s_plan> &sextended_path, const vector<s_plan> &sconstrained_extended_path, const vector<string> &dates, const table_conditional_global_type &table_conditional_global)
{
CodeLoad code;
ReadCodeFile(file_name, code);
it_code = code_liste.begin();
it_code_type Init_Code = code_liste.begin();
ReadCodeFile(file_name);
it_code = instructions_list.begin();
it_code_type Init_Code = instructions_list.begin();
size_t size_of_direction = y_size*col_y*sizeof(double);
auto *y_save = static_cast<double *>(mxMalloc(size_of_direction));
test_mxMalloc(y_save, __LINE__, __FILE__, __func__, size_of_direction);
@ -869,7 +864,7 @@ Interpreter::extended_path(const string &file_name, bool evaluate, int block, in
vector_table_conditional_local.clear();
if (auto it = table_conditional_global.find(t); it != table_conditional_global.end())
vector_table_conditional_local = it->second;
MainLoop(file_name, code, evaluate, block, true, sconstrained_extended_path, vector_table_conditional_local);
MainLoop(file_name, evaluate, block, true, sconstrained_extended_path, vector_table_conditional_local);
for (int j = 0; j < y_size; j++)
{
y_save[j + (t + y_kmin) * y_size] = y[j + y_kmin * y_size];
@ -912,16 +907,15 @@ Interpreter::extended_path(const string &file_name, bool evaluate, int block, in
bool
Interpreter::compute_blocks(const string &file_name, bool evaluate, int block, int &nb_blocks)
{
CodeLoad code;
ReadCodeFile(file_name, code);
ReadCodeFile(file_name);
//The big loop on intructions
it_code = code_liste.begin();
it_code = instructions_list.begin();
auto Init_Code = it_code;
vector<s_plan> s_plan_junk;
vector_table_conditional_local_type vector_table_conditional_local_junk;
MainLoop(file_name, code, evaluate, block, false, s_plan_junk, vector_table_conditional_local_junk);
MainLoop(file_name, evaluate, block, false, s_plan_junk, vector_table_conditional_local_junk);
mxFree(*Init_Code);
nb_blocks = Block_Count+1;

View File

@ -58,8 +58,8 @@ public:
bool extended_path(const string &file_name, bool evaluate, int block, int &nb_blocks, int nb_periods, const vector<s_plan> &sextended_path, const vector<s_plan> &sconstrained_extended_path, const vector<string> &dates, const table_conditional_global_type &table_conditional_global);
bool compute_blocks(const string &file_name, bool evaluate, int block, int &nb_blocks);
void check_for_controlled_exo_validity(FBEGINBLOCK_ *fb, const vector<s_plan> &sconstrained_extended_path);
bool MainLoop(const string &bin_basename, const CodeLoad &code, bool evaluate, int block, bool constrained, const vector<s_plan> &sconstrained_extended_path, const vector_table_conditional_local_type &vector_table_conditional_local);
void ReadCodeFile(const string &file_name, CodeLoad &code);
bool MainLoop(const string &bin_basename, bool evaluate, int block, bool constrained, const vector<s_plan> &sconstrained_extended_path, const vector_table_conditional_local_type &vector_table_conditional_local);
void ReadCodeFile(const string &file_name);
inline mxArray *
get_jacob(int block_num) const