Hostname: page-component-77f85d65b8-5ngxj Total loading time: 0 Render date: 2026-04-18T08:45:48.016Z Has data issue: false hasContentIssue false

Representation sharing for Prolog

Published online by Cambridge University Press:  09 August 2011

PHUONG-LAN NGUYEN
Affiliation:
Institut de Mathématiques Appliquées, UCO, Angers, France (e-mail: nguyen@ima.uco.fr)
BART DEMOEN
Affiliation:
Department of Computer Science, K.U. Leuven, Belgium (e-mail: bart.demoen@cs.kuleuven.be)

Abstract

Representation sharing can reduce the memory footprint of a program by sharing one representation between duplicate terms. The most common implementation of representation sharing in functional programming systems is known as hash-consing. In the context of Prolog, representation sharing has been given little attention. Some current techniques that deal with representation sharing are reviewed. The new contributions are (1) an easy implementation of input sharing for findall/3; and (2) a description of a sharer module that introduces representation sharing at runtime. Their realization is shown in the context of the Warren Abstract Machine (WAM) as implemented by hProlog. Both can be adapted to any WAM-like Prolog implementation. The sharer works independently of the garbage collector, but it can be made to cooperate with the garbage collector. Benchmark results show that the sharer has a cost comparable to the heap garbage collector, that its effectiveness is highly application-dependent, and that its policy must be tuned to the collector.

Information

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2011

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Article purchase

Temporarily unavailable