1 Introduction

The SICStus Prolog Just-In-Time Compiler (SPJIT) is currently operational on the x86 and x86_64 architectures under Windows, Mac OS X and Linux, and is being ported to the PPC64 (Power8) architecture under Linux. SPJIT works entirely in-memory; generated native code is never written to any files. The unit of compilation is a Prolog predicate. The compilation is performed in two steps: (a) from WAM (Warren Abstract Machine) to IR (intermediate representation), (b) from IR to native code. SPJIT thus consists of three modules:

  1. A WAM to IR translator, written in Prolog. Goals of this module include to be target independent and to run in time linear in the size of the input.
  2. An IR to native code translator, written in C. This module obviously needs to be adapted to the specific target. One source code version covers x86 and x86_64, whereas another one is being developed for PPC64.
  3. A runtime system to support the native code, written in assembly language. It also contains entry points when emulated code wants to call, continue to, or fail back to native code. Conversely, it contains return points when native code wants to call, continue to, or fail back to non-native code, or for all kinds of exception handling. This module also calls other parts of the runtime system as needed. This module too obviously needs to be adapted to the specific target. One source code version covers x86 and x86_64, whereas another one is being developed for PPC64.

Send feedback on this subject.