Hostname: page-component-89b8bd64d-b5k59 Total loading time: 0 Render date: 2026-05-10T15:28:28.237Z Has data issue: false hasContentIssue false

Efficient local unfolding with ancestor stacks*

Published online by Cambridge University Press:  18 January 2010

GERMÁN PUEBLA
Affiliation:
School of Computer Science, Technical University of Madrid, E28660-Boadilla del Monte, Madrid, Spain (e-mail: german@fi.upm.es)
ELVIRA ALBERT
Affiliation:
School of Computer Science, Complutense University of Madrid, E28040-Profesor José García Santesmases, s/n, Madrid, Spain (e-mail: elvira@sip.ucm.es)
MANUEL HERMENEGILDO
Affiliation:
School of Computer Science, Technical University of Madrid, E28660-Boadilla del Monte, Madrid, Spain (e-mail: herme@fi.upm.es) Madrid Institute for Advanced Studies in Software Development Technology, IMDEA Software, E28660-Boadilla del Monte, Madrid, Spain (e-mail: manuel.hermenegildo@imdea.org)

Abstract

The most successful unfolding rules used nowadays in the partial evaluation of logic programs are based on well quasi orders (wqo) applied over (covering) ancestors, i.e., a subsequence of the atoms selected during a derivation. Ancestor (sub)sequences are used to increase the specialization power of unfolding while still guaranteeing termination and also to reduce the number of atoms for which the wqo has to be checked. Unfortunately, maintaining the structure of the ancestor relation during unfolding introduces significant overhead. We propose an efficient, practical local unfolding rule based on the notion of covering ancestors which can be used in combination with a wqo and allows a stack-based implementation without losing any opportunities for specialization. Using our technique, certain nonleftmost unfoldings are allowed as long as local unfolding is performed, i.e., we cover depth-first strategies. To deal with practical programs, we propose assertion-based techniques which allow our approach to treat programs that include (Prolog) built-ins and external predicates in a very extensible manner, for the case of leftmost unfolding. Finally, we report on our implementation of these techniques embedded in a practical partial evaluator, which shows that our techniques, in addition to dealing with practical programs, are also significantly more efficient in time and somewhat more efficient in memory than traditional tree-based implementations.

Information

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2010

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