Bytecode: misc minor simplifications

silicon
Sébastien Villemot 2023-02-21 16:20:46 -05:00
parent 24b2976ac2
commit 1ad6b29936
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
4 changed files with 10 additions and 16 deletions

View File

@ -52,11 +52,6 @@ public:
{
return begin_block[block];
}
void *
get_current_code() const
{
return code;
}
instructions_list_t
get_op_code(const filesystem::path &codfile)
{

View File

@ -808,7 +808,7 @@ Interpreter::elastic(string str, unsigned int len, bool left)
}
bool
Interpreter::extended_path(const string &file_name, const string &bin_basename, 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)
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;
@ -872,9 +872,9 @@ Interpreter::extended_path(const string &file_name, const string &bin_basename,
if (auto it = table_conditional_global.find(t); it != table_conditional_global.end())
vector_table_conditional_local = it->second;
if (t < nb_periods)
MainLoop(bin_basename, code, evaluate, block, false, true, sconstrained_extended_path, vector_table_conditional_local);
MainLoop(file_name, code, evaluate, block, false, true, sconstrained_extended_path, vector_table_conditional_local);
else
MainLoop(bin_basename, code, evaluate, block, true, true, sconstrained_extended_path, vector_table_conditional_local);
MainLoop(file_name, code, evaluate, block, true, 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];
@ -915,7 +915,7 @@ Interpreter::extended_path(const string &file_name, const string &bin_basename,
}
bool
Interpreter::compute_blocks(const string &file_name, const string &bin_basename, bool evaluate, int block, int &nb_blocks)
Interpreter::compute_blocks(const string &file_name, bool evaluate, int block, int &nb_blocks)
{
CodeLoad code;
ReadCodeFile(file_name, code);
@ -926,7 +926,7 @@ Interpreter::compute_blocks(const string &file_name, const string &bin_basename,
vector<s_plan> s_plan_junk;
vector_table_conditional_local_type vector_table_conditional_local_junk;
MainLoop(bin_basename, code, evaluate, block, true, false, s_plan_junk, vector_table_conditional_local_junk);
MainLoop(file_name, code, evaluate, block, true, false, s_plan_junk, vector_table_conditional_local_junk);
mxFree(*Init_Code);
nb_blocks = Block_Count+1;

View File

@ -55,8 +55,8 @@ public:
string &filename_arg, int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
bool global_temporary_terms_arg, bool print_arg, bool print_error_arg, mxArray *GlobalTemporaryTerms_arg,
bool steady_state_arg, bool block_decomposed_arg, bool print_it_arg, int col_x_arg, int col_y_arg, BasicSymbolTable &symbol_table_arg);
bool extended_path(const string &file_name, const string &bin_basename, 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, const string &bin_basename, bool evaluate, int block, int &nb_blocks);
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 last_call, 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);

View File

@ -687,6 +687,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if (status != 0)
mexWarnMsgTxt("Not enough space. Filename is truncated.");
string file_name = fname;
mxFree(fname);
if (stack_solve_algo == 7 && !steady_state)
mexErrMsgTxt("Bytecode: Can't use option stack_solve_algo=7");
@ -720,8 +721,6 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
markowitz_c, file_name, minimal_solving_periods, stack_solve_algo,
solve_algo, global_temporary_terms, print, print_error, GlobalTemporaryTerms,
steady_state, block_decomposed, print_it, col_x, col_y, symbol_table};
string f(fname);
mxFree(fname);
int nb_blocks = 0;
double *pind;
@ -729,7 +728,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
try
{
interprete.extended_path(f, f, evaluate, block, nb_blocks, max_periods, sextended_path, sconditional_extended_path, dates, table_conditional_global);
interprete.extended_path(file_name, evaluate, block, nb_blocks, max_periods, sextended_path, sconditional_extended_path, dates, table_conditional_global);
}
catch (GeneralException &feh)
{
@ -742,7 +741,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
try
{
interprete.compute_blocks(f, f, evaluate, block, nb_blocks);
interprete.compute_blocks(file_name, evaluate, block, nb_blocks);
}
catch (GeneralException &feh)
{