Implementing Parallel Language Constructs Using a Re ective Object-Oriented Language

|in Pro ceedings of Reection'96, pp.79{91|Implementing Parallel Language Constructs Usinga Reective Ob ject-Oriented LanguageHidehiko MasuharaySatoshi MatsuokaAkinori YonezawzDepartment of Graphics and Computer Science, College of Arts and SciencesyDepartment of Information EngineeringzDepartment of Information ScienceUniversityof TokyoAbstractTo provide various parallel language constructs, ex-tensible languages based on reection are attrac-tive for b oth implementors and users. This pap erdescribes our prop osed meta-level architecture ofa concurrent ob ject-oriented language ABCL/R3,which has the following characteristics:(1) lan-guage customization through meta-interpreters andmeta-ob jects, (2) delegation and inheritance mech-anisms facilitating mo dular and re-usable meta-level programming, and (3) thereective annota-tionsandmeta-level argumentsrealizing separationof base- and meta-level programs.We also showthat several meta-level programs that provide com-mon parallel programming strategies, such as ob-ject replication and latency hiding, are easily im-plemented.1Parallel Languages and Reec-tionPractical parallel and distributed programs oftenhave complicated computation and communicationstructures for achieving eciency.For example, la-tency hiding|which is an optimization techniquefor remote messages|makes programs complicatedbecause a thread of control must b e delib erately`broken up' into multiple pro cess. To alleviate thisContact: 3{8{1 Komaba, Meguro-ku, Tokyo 153, Japan.E-mail: masuhara@graco.c. u-tokyo.ac. jpPhone: +81{3{5454{6679, Fax: +81{3{3465{2896.complexity, language systems often provide high-level parallel constructs that supp ort such sp eci coptimization techniques.However, it is dicultto provide `generic' constructs to cover all circum-stances, since optimizations tend to b e sp eci c toapplications or their executing platforms.In ad-dition, implementation of new constructs in thelanguage requires tremendous e ort for compiler-writers.A di erent (and p ossibly b etter) approach is tocreate a simple, yet extensible language, and pro-vide user-de ned constructs as if built-in. This ap-proach is b ene cial not only to language implemen-tors, but also to users as they can design and buildtheir own parallel constructs afterwards.Basedon this observation, we are developing a reectiveob ject-oriented concurrent language ABCL/R3[6],based on ABCL/f[16], that we provide such exten-sibility via reection.The ma jor features of ourmeta-level architecture are as follows:(1) Meta-interpreters provide programming abstractions withwhich the user can customize language's syntax andsemantics. (2) Meta-ob jects serve as the meta-levelrepresentations of ob jects that can b e used for de n-ing customized ob ject b ehavior. (3)Reective an-notationscan b e de ned as programming directivesto the meta-level, and their interpretations can b emo di ed by customizing the meta-interpreters.The technical details of the ABCL/R3 compilerthat uses partial evaluation for compile-time opti-mization have b een presented elsewhere[6]. In thispap er, we describ e how parallel language constructs1