Abstract
Structure Sharing (SS) and Structure Copying (SC) are two commonly used term representation methods in various Prolog systems. SS was used in earlier Prolog implementations while SC has been accepted as the de facto standard in modern Prolog implementations. Most abstract machines dedicated to Prolog, such as the Warren Abstract Machine(WAM) and the Vienna Abstract Machine(VAM), adopt SC as the fundamental component to implement efficient unification. However, practical comparison of SS and SC shown that programs can be written which make any one method almost arbitrarily worse than the other. In this paper, I propose a new Prolog implementation approach — Program Sharing (PS). The major contribution of this work is that PS has the advantages of both SC (representing terms of different types to fit in the size of a machine word) and SS (low overhead in constructing a dynamic structure instance), and the concept of program sharing could be used to realize all special-case instruction-driven unification. This method has been adopted in the design of a new Prolog abstract machine — the LAM1/2. I have implemented an experimental LAM1/2-emulator in C. Benchmarks show that this new approach is at least as efficient as the WAM-based systems in general while exhibits much better performance to those tasks involving large, complex data structures.
Preview
Unable to display preview. Download preview PDF.
References
R. S. Boyer and J. S. Moore. The Sharing of Structure in Theorem Proving Programs. Machine Intelligence 7 (B. Meltzer and D. Miche, eds.), Edinburgh University Press, 1972, pp. 101–116.
D. H. D. Warren. Logic Programming and Compiler Writing. Technique Report: DAI 44, University of Edinburgh, 1977.
Z. Farkas, P. Koves and P. Szeredi. MProlog: An Implementation Overview. Implementations of Logic Programming Systems, Kluwer Academic Publishers, 1994, pp. 103–117.
M. Bruynooghe. An Interpreter for Predicate Programs: Part 1. Technique Report CW 16, Katholieke Universiteit Leuven, 1976.
D. H. D. Warren. An Abstract Prolog Instruction Set. Technical Note 209, SIR International, 1983.
H. Ait-Kaci. Warren's Abstract Machine: a Tutorial Reconstruction. MIT Press, 1991.
A. Krall and U. Neumerkel. The Vienna Abstract Machine. In PLILP'90, LNCS. Springer, 1990.
P. Van Roy and A. M. Despain. High-Performance Logic Programming with the Aquarius Prolog Compiler. IEEE Computer, Vol. 25, No. 1, 1992, pp. 54–68.
E. Tick and G. Succi. Implementations of Logic Programming Systems. Kluwer Academic Publishers, 1994.
P. Codognet and D. Diaz. wamcc: Compiling Prolog to C. PLILP'95, The MIT Press, 1995.
D. H. D. Warren. Foreword in Warren's Abstract Machine: a Tutorial Reconstruction. MIT Press, 1991, pp. xiii–xiv.
C. S. Mellish. An Alternative to Structure Sharing in the Implementation of a Prolog Interpreter. Logic Programming, Academic Press, 1982.
M. Bruynooghe. The Memory Management of Prolog Implementations. Logic Programming, Academic Press, 1982.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Li, X. (1996). Program Sharing: A new implementation approach for Prolog. In: Kuchen, H., Doaitse Swierstra, S. (eds) Programming Languages: Implementations, Logics, and Programs. PLILP 1996. Lecture Notes in Computer Science, vol 1140. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-61756-6_90
Download citation
DOI: https://doi.org/10.1007/3-540-61756-6_90
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-61756-3
Online ISBN: 978-3-540-70654-0
eBook Packages: Springer Book Archive