Springer Verlag, Lecture Notes in Computer Science, p. 80-97
DOI: 10.1007/11680093_6
Full text: Download
Polyvariant specialization allows generating multiple versions of a procedure, which can then be separately optimized for difierent uses. Since allowing a high degree of polyvariance often results in more opti- mized code, polyvariant specializers, such as most partial evaluators, can generate a large number of versions. This can produce unnecessarily large residual programs. Also, large programs can be slower due to cache miss efiects. A possible solution to this problem is to introduce a min- imization step which identifles sets of equivalent versions, and replace all occurrences of such versions by a single one. In this work we present a unifying view of the problem of super∞uous polyvariance. It includes both partial deduction and abstract multiple specialization. As regards partial deduction, we extend existing approaches in several ways. First, previous work has dealt with pure logic programs and a very limited class of builtins. Herein we propose an extension to traditional char- acteristic trees which can be used in the presence of calls to external predicates. This includes all builtins, libraries, other user modules, etc. Second, we propose the possibility of collapsing versions which are not strictly equivalent. This allows trading time for space and can be useful in the context of embedded and pervasive systems. This is done by residual- izing certain computations for external predicates which would otherwise be performed at specialization time. Third, we provide an experimental evaluation of the potential gains achievable using minimization which leads to interesting conclusions.