You are here: Home Deliverables D4-5 Refactoring Rules

D4-5 Refactoring Rules

Work package 4 aims to develop the methodology as well as the tool support for a complete refactoring transformation system, which can rewrite sequential reali-sations of the ParaPhrase patterns into parallel equivalents semi-automatically (i.e. under programmer’s control). The final code is a result of a complex process composed of pattern discovery, candidate assessment and refactoring transformation, and it should be a semantically equivalent, but structured parallel program. In Task 4.3, ELTE and ELTE-Soft have worked on i) finding the proper abstraction levels and suitable notations for defining refactoring transformation rules formally, and ii) defining the refactoring transformations needed for transforming typical sequential implementations of patterns into instances of the parallel skeletons. A key aspect of this task was to identify and formalise the pre- and post-conditions under which the transformations are valid and yield semantically equivalent code. We started our work by giving an exhaustive set of code examples as a specification for required shaping transformations (summed up by the [2] technical report). Then we examined these transformations and we defined a formalism with which we were able to provide the formal rules of the transformations (for further detail see the [1] technical report). At a very early stage, we have found that there can be many different sequential realisations of a pattern. For example, in the case of the farm pattern, so-called map-like computations are realisable with language-level constructs as well as by higher-order functions on lists and other data structures. Therefore, for each and every pattern, we defined a canonical sequential implementation to which we reshape any other variants, and then skeleton introduction is defined on the canonical form only. This idea induces the concept of shaping transformations. Shaping transformations aim at transforming pattern-like computations into one of the canonical forms. As a result, in our approach, the paraphrasing process is embodied as a composition of a number of shaping transformations, a skeleton introduction step, and some clean-up transformations. This decomposition of the paraphrasing transformation simplifies the implementation, and may facilitate formal verification

D4-5.pdf — PDF document, 518 kB (530846 bytes)