scholarly journals The JaSpe specializer: an algorithm of intra-procedural binding time analysis for programs in Java language subset

2020 ◽  
Vol 11 (1) ◽  
pp. 3-29
Author(s):  
Игорь Алексеевич Адамович ◽  
Юрий Андреевич Климов

Анализ времени связывания в частичных вычислениях, нацеленных на оптимизацию программ, разделяет программные конструкции на статические и динамические. Статические конструкции исполняются специализатором, а динамические переходят в результирующую программу. Частичные вычисления применяются в основном для нетривиальной компиляции программ без компилятора, при наличии лишь интерпретатора и специализатора. Эффективность их существенно зависит от качества разметки программы, получаемой в результате анализа времени связывания. Статья посвящена особенностям алгоритма анализа времени связывания специализатора JaSpe, разрабатываемого авторами данной публикации для широко распространенного объектно/ориентированного языка Java. Она содержит основные понятия, использованные при реализации анализа времени связывания, внутрипроцедурную версию алгоритма и обсуждение деталей анализа конструкций, использующих ссылочные типы данных. Алгоритм отличается от предшествующих аналогов, из числа работающих с программами на объектно-ориентированных языках, нетривиальной обработкой конструкций ветвления (if, switch), циклов (for, while, do) и блочных инструкции, которые содержат последовательность других инструкций. От аналогичных алгоритмов, работающих с императивными и функциональными языками, он отличается использованием BT-объектов, которые позволяют получать более точную разметку — c большей долей статических конструкций — при обработке объектно-ориентированных программ. Алгоритм ориентирован на интерактивность и удобочитаемость результатов.

1992 ◽  
Vol 21 (393) ◽  
Author(s):  
Jens Palsberg ◽  
Michael I. Schwartzbach

Binding time analysis is important in partial evaluators. Its task is to determine which parts of a program can be specialized if some of the expected input is known. Two approaches to do this are abstract interpretation and type inference. We compare two specific such analyses to see which one determines most program parts to be eliminable. The first is the abstract interpretation approach of Bondorf, and the second is the type inference approach o£ Gomard. Both apply to the untyped lambda calculus. We prove that Bondorf's analysis is better than Gomard's.


2001 ◽  
Vol 8 (54) ◽  
Author(s):  
Daniel Damian ◽  
Olivier Danvy

We show that a non-duplicating transformation into continuation-passing style (CPS) has no effect on control-flow analysis, a positive effect on binding-time analysis for traditional partial evaluation, and no effect on binding-time analysis for continuation-based partial evaluation: a monovariant control-flow analysis yields equivalent results on a direct-style program and on its CPS counterpart, a monovariant binding-time analysis yields less precise results on a direct-style program than on its CPS counterpart, and an enhanced monovariant binding-time analysis yields equivalent results on a direct-style program and on its CPS counterpart. Our proof technique amounts to constructing the CPS counterpart of flow information and of binding times.<br /> <br />Our results formalize and confirm a folklore theorem about traditional binding-time analysis, namely that CPS has a positive effect on binding times. What may be more surprising is that the benefit does not arise from a standard refinement of program analysis, as, for instance, duplicating continuations.<br /> <br />The present study is symptomatic of an unsettling property of program analyses: their quality is unpredictably vulnerable to syntactic accidents in source programs, i.e., to the way these programs are written. More reliable program analyses require a better understanding of the effect of syntactic change.


1993 ◽  
Vol 3 (3) ◽  
pp. 315-346 ◽  
Author(s):  
Anders Bondorf ◽  
Jesper Jørgensen

AbstractBased on Henglein's efficient binding-time analysis for the lambda calculus (with constants and ‘fix’) (Henglein, 1991), we develop three efficient analyses for use in the preprocessing phase of Similix, a self-applicable partial evaluator for a higher-order subset of Scheme. The analyses developed in this paper are almost-linear in the size of the analysed program. (1) A flow analysis determines possible value flow between lambda-abstractions and function applications and between constructor applications and selector/predicate applications. The flow analysis is not particularly biased towards partial evaluation; the analysis corresponds to the closure analysis of Bondorf (1991b). (2) A (monovariant) binding-time analysis distinguishes static from dynamic values; the analysis treats both higher-order functions and partially static data structures. (3) A new is-used analysis, not present in Bondorf (1991b), finds a non-minimal binding-time annotation which is ‘safe’ in a certain way: a first-order value may only become static if its result is ‘needed’ during specialization; this ‘poor man's generalization’ (Holst, 1988) increases termination of specialization. The three analyses are performed sequentially in the above mentioned order since each depends on results from the previous analyses. The input to all three analyses are constraint sets generated from the program being analysed. The constraints are solved efficiently by a normalizing union/find-based algorithm in almost-linear time. Whenever possible, the constraint sets are partitioned into subsets which are solved in a specific order; this simplifies constraint normalization. The framework elegantly allows expressing both forwards and backwards components of analyses. In particular, the new is-used analysis is of backwards nature. The three constraint normalization algorithms are proved correct (soundness, completeness, termination, existence of a best solution). The analyses have been implemented and integrated in the Similix system. The new analyses are indeed much more efficient than those of Bondorf (1991b); the almost-linear complexity of the new analyses is confirmed by the implementation.


Sign in / Sign up

Export Citation Format

Share Document