Efficient local unfolding with ancestor stacks for full prolog

  • Authors:
  • Germán Puebla;Elvira Albert;Manuel Hermenegildo

  • Affiliations:
  • School of Computer Science, Technical U. of Madrid;School of Computer Science, Complutense U. of Madrid;School of Computer Science, Technical U. of Madrid

  • Venue:
  • LOPSTR'04 Proceedings of the 14th international conference on Logic Based Program Synthesis and Transformation
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

The integration of powerful partial evaluation methods into practical compilers for logic programs is still far from reality. This is related both to 1) efficiency issues and to 2) the complications of dealing with practical programs. Regarding efficiency, the most successful unfolding rules used nowadays are based on structural orders applied over (covering) ancestors, i.e., a subsequence of the atoms selected during a derivation. 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 any structural order and allows a stack-based implementation without losing any opportunities for specialization. Regarding the second issue, we propose assertion-based techniques which allow our approach to deal with real programs that include (Prolog) built-ins and external predicates in a very extensible manner. Finally, we report on our implementation of these techniques in a practical partial evaluator, embedded in a state of the art compiler which uses global analysis extensively (the Ciao compiler and, specifically, its preprocessor CiaoPP). The performance analysis of the resulting system 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.