Module management in Mosel
In Mosel, all basic module operations are performed by a Module Manager. This manager is in charge of loading and unloading the modules as well as maintaining various pieces of information about the modules (version number, features provided, reference counting). Whenever a module is requested either by the Model Compiler or to run a previously compiled model, the Module Manager looks for the module and, if it is not yet in core memory, loads it from the disk and initializes it by calling its initialization function (see Section The initialization function). After a period of inactivity or on request, the Module Manager may unload unused modules.
Use of modules for compiling a model
The directive uses "modname" informs the Model Compiler that the module modname is required by the model being compiled. For every module that appears in a uses directive, the compiler queries the Module Manager in order to extend its dictionary with the symbols and operators defined by the module. The following information is therefore recorded for every symbol:
- identifier (i.e. name of the subroutine or type)
- origin: the identity of the module that defines the symbol
- depending on the type of the symbol:
- constant: the value associated to the identifier
- procedure/function/operator: internal code in the module and types of the result and parameters
- type: internal code in the module and properties (e.g. can this type be translated into a string?)
During the compilation, each time an external symbol is encountered, assuming it is used appropriately (type of result as required, valid parameters for routines, etc.), the following operation is performed depending on the category of the symbol:
- constant: the symbol is replaced by its value
- procedure, function or operator: a function call is prepared using the internal code of the symbol
- type: the function call that corresponds to the required operation (e.g. creation) is prepared using the internal code of the symbol
In the BIM file that is generated during the compilation of a model, the compiler saves the table of modules it requires together with their version numbers. Only the modules that are effectively required (those from which functions are to be called) are stored in this table.
Use of modules for running a model
When the BIM file is loaded, Mosel queries the Module Manager for the modules required by the model. The model is ready for execution only if all the modules with their specified versions are available. The modules are considered to be ``in use'' as long as the model is in core memory.
During the execution of the model, the function calls prepared during the compilation phase are executed.
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.