Sébastien Villemot
7e01d01d80
VariableNode::writeBytecodeOutput(): check for temporary terms, as done for other types of output
2022-06-24 13:10:23 +02:00
Sébastien Villemot
9bd2973034
Refactor bytecode output around a new BytecodeWriter class and operator<< overloads
2022-06-24 13:10:04 +02:00
Sébastien Villemot
13dc0a1144
Use operator""s to replace some calls to std::string constructor
...
By the way, remove other unnecessary calls to that constructor.
2022-06-22 12:47:11 +02:00
Sébastien Villemot
83693e4427
Bytecode: stop using unsigned integers where signed ones avoid unnecessary casts
2022-06-20 17:49:31 +02:00
Sébastien Villemot
5cd5676c8e
Bytecode: directly use several enums inside instruction classes
2022-06-20 15:19:08 +02:00
Sébastien Villemot
4662a42c9a
Bytecode: in FNUMEXPR, store lag as int rather than int8_t
...
Otherwise lags are truncated at ±128.
2022-06-20 15:19:08 +02:00
Sébastien Villemot
b1c8e24e01
Bytecode: store instruction opcode (Tags enum) directly inside instruction classes
...
This makes the code simpler. Incidentally, since Tags are no longer stored as
uint8_t, this makes the .cod files larger, but there is no clear performance impact.
2022-06-20 15:18:23 +02:00
Sébastien Villemot
09cb33d867
Bytecode: no longer bypass normal alignment rules in instructions representation
...
This change provides a (limited) performance gain, at the expense of
a (moderate) increase in .cod files.
2022-06-20 10:28:30 +02:00
Sébastien Villemot
2ea6a5244e
Bytecode: remove unused expression types and associated constructors
2022-06-17 16:31:47 +02:00
Sébastien Villemot
3613dbbe01
Bytecode: remove unused instruction class constructors
2022-06-17 16:10:17 +02:00
Sébastien Villemot
aa4783fd86
Bytecode: move all instruction classes into a single class hierarchy
...
Class BytecodeInstruction is the root.
2022-06-17 15:33:54 +02:00
Sébastien Villemot
1383d2f344
Remove useless inline specifier
...
Functions entirely defined inside classes are automatically marked inline.
By the way, fix indentation in relation to the explicit specifier.
2022-06-17 14:29:12 +02:00
Sébastien Villemot
82751d21fe
Remove useless debugging code
2022-06-17 12:46:32 +02:00
Sébastien Villemot
b3b8ed63e1
Bytecode: remove unused opcodes
2022-06-17 12:46:24 +02:00
Sébastien Villemot
4cfba74f57
Bytecode: streamline description of opcodes
...
An “FLD…” opcode loads onto the stack, an “FST…” opcode stores from the stack.
Also remove useless numerical values (which may change).
2022-06-17 12:26:43 +02:00
Sébastien Villemot
5a0c6ad206
Build system update following header split
2022-06-16 20:41:53 +02:00
Sébastien Villemot
a85730313c
Split CodeInterpreter.hh into two headers
...
– a generic one: CommonEnums.hh
– and a bytecode-specific one: Bytecode.hh
By the way, rename global constant “near_zero” into “power_deriv_near_zero”,
for clarity.
2022-06-16 17:53:23 +02:00
Sébastien Villemot
41b1e89756
Macro-processor: when a variable is defined without a value, set it to “true”
...
Previously it was set to 1.
Also do the same change for variable defined on the command-line, for
consistency.
Closes : #43
2022-06-16 16:50:38 +02:00
Sébastien Villemot
2a68f5a3af
Use “follower” instead of “slave” in internal class and variable names
2022-06-15 15:39:20 +02:00
Sébastien Villemot
248dac4bc7
Rename “parallel_slave_open_mode” option to “parallel_follower_open_mode”
...
But still accept the old name for backward compatibility.
Closes : #86
2022-06-15 15:35:54 +02:00
Sébastien Villemot
9b04c5436e
Block decomposition: fix crash when a variable appears in an equation but has zero symbolic derivative
2022-06-13 16:32:58 +02:00
Sébastien Villemot
5d1264e2b9
Optimization: use a move_iterator
2022-06-13 15:06:58 +02:00
Sébastien Villemot
ee8ee7c27f
Optimization: use move semantics in a few more places
2022-06-13 14:27:19 +02:00
Sébastien Villemot
8541179a56
Correctly clean up options list after a “pac_model” statement
2022-06-13 14:27:19 +02:00
Sébastien Villemot
fe5f3d983b
CI: bump version of Boost dependency
2022-06-09 11:51:09 +02:00
Sébastien Villemot
a5feb52f2f
Merge branch 'AppleSiliconPkg' of git.dynare.org:wmutschl/preprocessor
...
Ref. !61
2022-06-08 15:27:28 +02:00
Willi Mutschler
fe8aaf44fd
🍎 provisions for Apple Silicon package
2022-06-08 15:11:02 +02:00
Sébastien Villemot
49277dbbf2
StaticModel::getDerivID() now throws an exception when arg is not endo or parameter
...
Previously it would return -1, which is bad practice.
2022-06-08 14:54:09 +02:00
Sébastien Villemot
e3bc2d1b9b
Minor simplification
2022-06-08 14:37:59 +02:00
Sébastien Villemot
46b2c73565
C++17 modernization: more uses of std::optional
2022-06-08 12:34:25 +02:00
Sébastien Villemot
c94dfb848c
C++20 modernization: use initialization within range-based for loop
...
In particular, use this feature in many loops which feature a special treatment
for the first iteration, using a boolean variable (replacing iterator
manipulation). By the way, also use std::exchange() to simultaneously test the
value of this variable and update it.
2022-06-07 14:35:59 +02:00
Sébastien Villemot
9ace2dc413
C++17 modernization: take advantage of class template argument deduction
2022-06-07 14:35:26 +02:00
Sébastien Villemot
0b5c88109f
Various simplifications
2022-06-07 14:34:30 +02:00
Sébastien Villemot
8b5e33b87a
Avoid name clash between function parameter and class member
2022-06-03 20:38:07 +02:00
Sébastien Villemot
cecf14f29d
Improve comment
2022-06-03 20:30:40 +02:00
Sébastien Villemot
4da901d05f
Fix comment
2022-06-03 20:30:40 +02:00
Sébastien Villemot
d859f59a10
Epilogue: improve error message
2022-06-03 20:30:40 +02:00
Sébastien Villemot
d2ef844696
Macro processor slides: minor improvements
2022-05-24 12:20:29 +02:00
Sébastien Villemot
edf75e48a3
Merge branch 'tolx_steady' into 'master'
...
Add tolx-option for steady
See merge request Dynare/preprocessor!60
2022-05-23 10:07:09 +00:00
Sébastien Villemot
cec47cc78c
Implement bytecode compilation of 2nd deriv of external functions
2022-05-20 12:35:38 +02:00
Sébastien Villemot
d1a3b227fd
Fix bug in bytecode compilation of 1st deriv of external functions
2022-05-20 12:35:23 +02:00
Sébastien Villemot
03dc9837d0
Comment improvement
2022-05-20 12:27:22 +02:00
Sébastien Villemot
171cd65566
Fix bytecode compilation of external function nodes
2022-05-20 11:43:02 +02:00
Johannes Pfeifer
1dbf9c8041
Add tolx-option for steady
2022-05-19 22:43:41 +02:00
Sébastien Villemot
591b5e5f9e
Always create bytecode output
...
And, symmetrically, when the “bytecode” option is requested by the user, always
create the .m static/dynamic files.
The “bytecode” option therefore no longer modifies the preprocessor output.
2022-05-19 14:49:46 +02:00
Sébastien Villemot
af88f50d44
Forbid multiple identical clauses in “occbin_constraints” block
...
Closes : #97
2022-05-19 14:36:15 +02:00
Sébastien Villemot
0284b249f5
Remove unused “bytecode” argument in {Static,Dynamic}Model::computingPass()
2022-05-19 14:10:22 +02:00
Sébastien Villemot
25a32b1a32
Cosmetics
2022-05-19 12:27:44 +02:00
Sébastien Villemot
17ba60e587
Mark copy constructor and assignment of ModelTree as protected
...
This limits the risk of slicing.
The same is not possible for DataTree, since that base class is directly used
in some places.
2022-05-19 12:27:39 +02:00
Sébastien Villemot
2483639f4d
Fix bug introduced in 3516894a71
related to new estimation syntax
2022-05-18 19:27:00 +02:00