Abstract:
A binding-time analysis in partial evaluation aimed at optimizing
programs divides software constructs into static and dynamic. A specializer
executes static constructs, and transfer dynamic ones into the resulting code.
Currently, partial evaluation is mainly used for the non-trivial compilation of
programs without a compiler, with only an interpreter and a specializer. As
previous studies have shown, the effectiveness of such an application of the partial
evaluation method significantly depends on the quality of the program annotation
obtained by performing the binding-time analysis.
The paper is devoted to the features of the binding-time analysis algorithm.
The features that arose during algorithm implementation for the widespread
object-oriented Java language within the JaSpe specializer developed by the
authors of this publication. The paper describes the basic concepts of the
binding-time analysis implemented and the intra-procedural version of the
algorithm. The article also discusses the algorithm details related to the program
constructs that use reference data types.
Apart from previous counterparts for object-oriented languages, this
algorithm non-trivially handles some language constructs: branches (if, switch),
loops (for, while, do), and block instructions that contain a sequence of other
instructions. Unlike the similar algorithms that work with imperative and
functional languages, the considered algorithm uses the BT-objects, which allow
specializer to obtain more accurate annotation (with a higher fraction of static
constructs) when processing object-oriented programs. Another feature of this
algorithm is the focus on interactivity and readability of results.
Key words and phrases:modern programming languages, static program analysis, program transformation, metaprogramming, mixed computation, interactive specialization.