Compiling Prolog to Logic-inference Virtual Machine
Abstract
The Logic-inference Virtual Machine (LVM) is a new Prolog execution model
consisting of a set of high-level instructions and memory architecture for handling control
and unification. Different from the well-known Warren's Abstract Machine [1], which uses
Structure Copying method, the LVM adopts a hybrid of Program Sharing [2] and
Structure Copying to represent first-order terms. In addition, the LVM employs a single
stack paradigm for dynamic memory allocation and embeds a very efficient garbage
collection algorithm to reclaim the useless memory cells. In order to construct a complete
Prolog system based on the LVM, a corresponding compiler must be written.
In this thesis, a design of such LVM compiler is presented and all important
components of the compiler are described. The LVM compiler is developed to translate
Prolog programs into LVM bytecode instructions, so that a Prolog program is compiled
once and can run anywhere.
The first version of LVM compiler (about 8000 lines of C code) has been
developed. The compilation time is approximately proportional to the size of source
codes. About 80 percent of the time are spent on the global analysis. Some compiled
programs have been tested under a LVM emulator. Benchmarks show that the LVM
system is very promising in memory utilization and performance.
Collections
- Retrospective theses [1604]