4.3.1 Overview

There are two ways of loading programs into Prolog—loading source files and loading precompiled PO files. Source files can be compiled into virtual machine code, as well as consulted for interpretation. Dynamic predicates are always stored in interpreted form, however.

Virtual machine code runs about 8 times faster than interpreted code, and requires less runtime storage. Compiled code is fully debuggable, except certain constructs compile inline and cannot be traced. Compiled code also provides better precision for execution profiling and coverage analysis.

Since release 4.3, on 32 and 64 bit x86 platforms running Windows, OS X, and Linux, SICStus Prolog has the ability to compile predicates from virtual machine code to native code. This process, known as Just In Time (JIT) compilation, is controlled by a couple of system properties (see System Properties and Environment Variables), but is otherwise automatic. JIT compilation is seamless wrt. debugging, profiling, coverage analysis, etc. JIT compiled code runs up to 4 times faster than virtual machine code, but takes more space.

The virtual machine compiler operates in two different modes, controlled by the compiling Prolog flag. The possible values of the flag are:


Compilation produces byte-coded abstract instructions. The default.


Compilation produces interpreted code, i.e. compiling is replaced by consulting.

This section contains references to the use of the module system. These can be ignored if the module system is not being used (see ref-mod for information on the module system).

Send feedback on this subject.