Partial translation: towards a portable and efficient prolog implementation technology
The Journal of Logic Programming
We describe a new language translation framework (partial translation) and the application of one of its instances: the C-ification of Binary Prolog. Our partial translation framework compiles selected sequences of emulator instructions down to native code. The technique can be seen as an automatic specialization with respect to a given program of the traditional instruction ]olding techniques used to speed up emulators. In our implementation, the complex control structure, some large
... ns, and the management of the symbol table are left to the emulator, while the translated code deals with relatively long sequences of simple instructions. After compilation, the generated code is linked with a target language representation of the emulator's byte code and the emulator itself to form a stand-alone application. The composite run-time system's behavior can be seen as a form of "coroutining" between emulated and native code. The framework supports modular compilation, allows programmer control of the speed versus size optimization, is fully portable, and has a performance that ranges between the performance of emulated code and that of native code. Our design has been proven practical in the implementation *This paper is an extended and revised version of the paper "The Power of Partial Translation: An Experiment with the C-ification of Binary Prolog" presented at the ACM SAC Conference, Nashville, TN, 1995.