Offline Specialisation in Prolog Using a Hand-Written Compiler Generator

08/07/2002
by   Michael Leuschel, et al.
0

The so called "cogen approach" to program specialisation, writing a compiler generator instead of a specialiser, has been used with considerable success in partial evaluation of both functional and imperative languages. This paper demonstrates that the cogen approach is also applicable to the specialisation of logic programs (also called partial deduction) and leads to effective specialisers. Moreover, using good binding-time annotations, the speed-ups of the specialised programs are comparable to the speed-ups obtained with online specialisers. The paper first develops a generic approach to offline partial deduction and then a specific offline partial deduction method, leading to the offline system LIX for pure logic programs. While this is a usable specialiser by itself, it is used to develop the cogen system LOGEN. Given a program, a specification of what inputs will be static, and an annotation specifying which calls should be unfolded, LOGEN generates a specialised specialiser for the program at hand. Running this specialiser with particular values for the static inputs results in the specialised program. While this requires two steps instead of one, the efficiency of the specialisation process is improved in situations where the same program is specialised multiple times. The paper also presents and evaluates an automatic binding-time analysis that is able to derive the annotations. While the derived annotations are still suboptimal compared to hand-crafted ones, they enable non-expert users to use the LOGEN system in a fully automated way. Finally, LOGEN is extended so as to directly support a large part of Prolog's declarative and non-declarative features and so as to be able to perform so called mixline specialisations.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/16/2018

Compiling Control as Offline Partial Deduction

We present a new approach to a technique known as compiling control, who...
research
08/24/2017

Transforming Coroutining Logic Programs into Equivalent CHR Programs

We extend a technique called Compiling Control. The technique transforms...
research
11/28/2018

Partial Evaluation of Logic Programs in Vector Spaces

In this paper, we introduce methods of encoding propositional logic prog...
research
03/08/2000

Logic Programs with Compiled Preferences

We describe an approach for compiling preferences into logic programs un...
research
09/06/2021

Lightweight, Multi-Stage, Compiler-Assisted Application Specialization

Program debloating aims to enhance the performance and reduce the attack...
research
03/22/2023

Practical compilation of fexprs using partial evaluation: Fexprs can performantly replace macros in purely-functional Lisp

Macros are a common part of Lisp languages, and one of their most lauded...
research
05/13/2020

A Generating-Extension-Generator for Machine Code

The problem of "debloating" programs for security and performance purpos...

Please sign up or login with your details

Forgot password? Click here to reset