next up previous index
Next: Compiler Input Up: The Compiler Previous: Procedure Types

Compiler Modes

The compiler has several modes of operation, each mode generating code with different properties. The operating mode is controlled by a set of global flags, which may be modified at any time, even during the compilation so that a part of the program is compiled in a different mode. These flags and the associated modes are listed below.

debug_compile When this flag is on, the compiler generates code which can be traced with the debugger. This code can sometimes be significantly less efficient than the untraceable one, and the generated code size is always significantly larger. To generate optimised code, this flag must be switched off. To achieve this, the predicate
:- nodbgcomp.
can also be called, and it also switches off the variable_names flag.

occur_check   When this flag is on, the compiled code will perform the occur check if necessary. This means that every time a variable will be unified with a compound term that might already contain a reference to this variable, the compound term will be scanned for this occurrence and if it is found, the unification fails. In this way, the creation of infinite (cyclic) terms is impossible and thus the behaviour of the system is closer to the first order logic theory. Unifications with the occur check may sometimes be very slow, and most Prolog programs do not need it, because no cyclic terms are created. Note that this flag must be set both at compile time and at runtime in order to actually perform the checks.

dfid_compile   When this flag is on, the compiler will generate code that keeps track of the number of ancestors of the current goal, which is used by the library dfid to execute   the bounded depth-first search, either as iterative deepening or plain depth limiting.

float_precision This flag specifies if the compiler generates code for single or double precision floating point arithmetic. It is recommended not to mix code compiled in different modes, because single and double precision numbers do not unify and therefore may cause unexpected failures.

variable_names   ECLiPSe can remember the source variable names of the input variables. When this flag is on, the compiled predicates will keep the names of the source variables and will display them whenever the variables are printed. In this case the usage of the global stack and code space is slightly higher (to store the name), and the efficiency of the code is marginally lower.   Setting this flag to check_singletons has the same effect as on, but additionally, the compiler will issue warnings about variables which occur only once in a clause and whose names do not start with an underscore character.

all_dynamic When this flag is on, all procedures are compiled as dynamic ones (and there is no equivalent static/1 declaration). It can be used to port programs from older interpreters which rely heavily on the fact that all predicates in these interpreters were dynamic. Another possible use is to switch it on at the beginning of a file that contains many dynamic predicates and switch it off at its end.

macro_expansion This is in fact a parser flag, is enables or disables the macro transformation (see Chapter gif) for the input source.



next up previous index
Next: Compiler Input Up: The Compiler Previous: Procedure Types



Micha Meier
Mon Mar 4 12:11:45 MET 1996