Commit Graph

34 Commits (master)

Author SHA1 Message Date
Sébastien Villemot cf45c77343
Bytecode: simplify various instruction classes 2023-12-14 17:07:06 +01:00
Sébastien Villemot f55019c41e
Bytecode: rename several classes and class members, for consistency and clarity 2023-12-14 16:17:22 +01:00
Sébastien Villemot 22709f8225
Move bytecode stuff into a dedicated namespace, for better code separation 2023-12-14 15:48:22 +01:00
Sébastien Villemot 22675728aa
No longer call std::move on trivially-copyable types
Automatically detected by clang-tidy with performance-move-const-arg check.

Do not make the modification for Tokenizer::location type, since we have no
guarantee that the type will remain trivially-copyable in the future.
2023-12-13 15:37:07 +01:00
Sébastien Villemot 3d94f1956c
Remove some unneeded object copies
Automatically detected by clang-tidy using performance-unnecessary-value-param
check.
2023-12-13 10:28:54 +01:00
Sébastien Villemot b2e9ec205e
No longer use reserved identifiers for include guards
Automatically detected using clang-tidy with bugprone-reserved-identifier
check.

By the way, homogeneize the define identifiers in relation to camel case
convention.
2023-12-01 15:39:01 +01:00
Sébastien Villemot d463607e90
Reformat C++ source code using clang-format 15 2023-11-30 15:58:32 +01:00
Sébastien Villemot 66dcb59d2b
🐛 Bytecode: fix FSTPG3_::get_lag()
It would return an incorrect result. This had no impact except for debugging
information.
2023-11-07 15:32:12 +01:00
Sébastien Villemot 3a18707685
Bytecode: make destructors of base classes protected
This prevents destruction through a base pointer, which would a memory leak
since the destructor is not virtual (and we cannot make it virtual because it
would break our crude serialization strategy).
2023-09-01 13:50:57 +02:00
Sébastien Villemot 34edd4e143
Bytecode: remove useless FBEGINBLOCK_::endo_nbr data member 2023-04-18 16:54:35 +02:00
Sébastien Villemot 008a80910e
Bytecode: move CodeLoad class out of the preprocessor 2023-02-21 16:01:27 -05:00
Sébastien Villemot a88b921991
Bytecode: improve deserialization routines for FCALL and FBEGINBLOCK 2023-02-17 16:20:40 -05:00
Sébastien Villemot 4bba274f39
Block decomposition: drop unused max lead/lag fields
Note that DynamicModel::determineBlockDerivativesType(), it’s legitimate to
replace max_{lead,lag} by max_endo_{lead,lag}, because for exogenous
lag=lead=0, and we no longer compute derivatives w.r.t. to endogenous that do
not belong to the block (so-called “other” endogenous).
2023-01-17 14:42:29 +01:00
Sébastien Villemot 2e09df90e7
Bytecode w/ block decomposition: no longer output derivatives w.r.t. exogenous and endogenous outside the block 2023-01-17 14:23:40 +01:00
Sébastien Villemot a4f299c0b7
Bytecode: change interface of function called from bytecode MEX 2023-01-09 14:09:09 +01:00
Sébastien Villemot 253fbbe7d6
Use std::filesystem::path in more places 2023-01-05 17:21:28 +01:00
Sébastien Villemot c3cb7ca534
Bytecode: simplify type for storing list of instructions
Incidentally, make BytecodeInstruction an immutable struct, to facilitate
access to opcode in such a list.
2022-07-26 18:26:37 +02:00
Sébastien Villemot 613e0da782
Bytecode: add some comments to FNUMEXPR_
[skip ci]
2022-07-26 14:52:10 +02:00
Sébastien Villemot 1401c85d6a
Bytecode: drop FCUML instruction
It’s redundant with FBINARY{BinaryOpcode::plus}.
2022-07-20 16:02:24 +02:00
Sébastien Villemot a58109d094
Bytecode: refactor methods for writing .cod and .bin files in the block decomposition case 2022-07-20 16:02:24 +02:00
Sébastien Villemot 4b30342dc2
Bytecode: various simplifications
Also improve the naming of the enum class used for identifying the type of
external function call.
2022-07-08 16:02:49 +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 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 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 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