Bytecode: always produce block and non-block versions

The block decomposed version is now under <BASENAME>/bytecode/block/.
master
Sébastien Villemot 2023-01-09 13:35:49 +01:00
parent 4348f4d57f
commit ec3ce156b4
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 12 additions and 14 deletions

View File

@ -619,9 +619,9 @@ DynamicModel::writeDynamicBytecode(const string &basename) const
void
DynamicModel::writeDynamicBlockBytecode(const string &basename) const
{
BytecodeWriter code_file {basename + "/model/bytecode/dynamic.cod"};
BytecodeWriter code_file {basename + "/model/bytecode/block/dynamic.cod"};
const filesystem::path bin_filename {basename + "/model/bytecode/dynamic.bin"};
const filesystem::path bin_filename {basename + "/model/bytecode/block/dynamic.bin"};
ofstream bin_file {bin_filename, ios::out | ios::binary};
if (!bin_file.is_open())
{
@ -3318,13 +3318,11 @@ DynamicModel::writeDynamicFile(const string &basename, bool block, bool use_dll,
create_directories(plusfolder / "+debug");
}
create_directories(model_dir / "bytecode");
create_directories(model_dir / "bytecode" / "block");
// Legacy representation
if (block)
{
writeDynamicBlockBytecode(basename);
if (use_dll)
{
auto per_block_object_files { writeDynamicPerBlockCFiles(basename, mexext, matlabroot, dynareroot) };
@ -3343,14 +3341,15 @@ DynamicModel::writeDynamicFile(const string &basename, bool block, bool use_dll,
}
else
{
writeDynamicBytecode(basename);
if (use_dll)
writeModelCFile<true>(basename, mexext, matlabroot, dynareroot);
else if (!julia) // M-files
writeDynamicMFile(basename);
// The legacy representation is no longer produced for Julia
}
writeDynamicBytecode(basename);
if (block_decomposed)
writeDynamicBlockBytecode(basename);
// Sparse representation
if (use_dll)

View File

@ -283,9 +283,9 @@ StaticModel::writeStaticBytecode(const string &basename) const
void
StaticModel::writeStaticBlockBytecode(const string &basename) const
{
BytecodeWriter code_file {basename + "/model/bytecode/static.cod"};
BytecodeWriter code_file {basename + "/model/bytecode/block/static.cod"};
const filesystem::path bin_filename {basename + "/model/bytecode/static.bin"};
const filesystem::path bin_filename {basename + "/model/bytecode/block/static.bin"};
ofstream bin_file {bin_filename, ios::out | ios::binary};
if (!bin_file.is_open())
{
@ -642,13 +642,11 @@ StaticModel::writeStaticFile(const string &basename, bool block, bool use_dll, c
create_directories(plusfolder / "+debug");
}
create_directories(model_dir / "bytecode");
create_directories(model_dir / "bytecode" / "block");
// Legacy representation
if (block)
{
writeStaticBlockBytecode(basename);
if (use_dll)
{
auto per_block_object_files { writeStaticPerBlockCFiles(basename, mexext, matlabroot, dynareroot) };
@ -667,14 +665,15 @@ StaticModel::writeStaticFile(const string &basename, bool block, bool use_dll, c
}
else
{
writeStaticBytecode(basename);
if (use_dll)
writeModelCFile<false>(basename, mexext, matlabroot, dynareroot);
else if (!julia) // M-files
writeStaticMFile(basename);
// The legacy representation is no longer produced for Julia
}
writeStaticBytecode(basename);
if (block_decomposed)
writeStaticBlockBytecode(basename);
// Sparse representation
if (use_dll)