TU Darmstadt / ULB / TUprints

An Efficient and Flexible Implementation of Aspect-Oriented Languages

Bockisch, Christoph-Matthias (2009)
An Efficient and Flexible Implementation of Aspect-Oriented Languages.
Technische Universität
Ph.D. Thesis, Primary publication

[img]
Preview
PDF
DissertationBockisch-AspectLanguageImplementation.pdf
Copyright Information: CC BY-NC-ND 2.5 Generic - Creative Commons, Attribution, NonCommercial, NoDerivs .

Download (1MB) | Preview
Item Type: Ph.D. Thesis
Type of entry: Primary publication
Title: An Efficient and Flexible Implementation of Aspect-Oriented Languages
Language: English
Referees: Mezini, Prof. Mira ; Aksit, Prof. Mehmet
Date: 5 February 2009
Place of Publication: Darmstadt
Date of oral examination: 1 July 2008
Abstract:

Compilers for modern object-oriented programming languages generate code in a platform independent intermediate language preserving the concepts of the source language; for example, classes, fields, methods, and virtual or static dispatch can be directly identified within the intermediate code. To execute this intermediate code, state-of-the-art implementations of virtual machines perform just-in-time (JIT) compilation of the intermediate language; i.e., the virtual instructions in the intermediate code are compiled to native machine code at runtime. In this step, a declarative representation of source language concepts in the intermediate language facilitates highly efficient adaptive and speculative optimization of the running program which may not be possible otherwise. In contrast, constructs of aspect-oriented languages - which improve the separation of concerns - are commonly realized by compiling them to conventional intermediate language instructions or by driving transformations of the intermediate code, which is called weaving. This way the aspect-oriented constructs' semantics is not preserved in a declarative manner at the intermediate language level. This representational gap between aspect-oriented concepts in the source code and in the intermediate code hinders high performance optimizations and weakens features of software engineering processes like debugging support or the continuity property of incremental compilation: modifying an aspect in the source code potentially requires re-weaving multiple other modules. To leverage language implementation techniques for aspect-oriented languages, this thesis proposes the Aspect-Language Implementation Architecture (ALIA) which prescribes - amongst others - the existence of an intermediate representation preserving the aspect-oriented constructs of the source program. A central component of this architecture is an extensible and flexible meta-model of aspect-oriented concepts which acts as an interface between front-ends (usually a compiler) and back-ends (usually a virtual machine) of aspect-oriented language implementations. The architecture and the meta-model are embodied for Java-based aspect-oriented languages in the Framework for Implementing Aspect Languages (FIAL) respectively the Language-Independent Aspect Meta-Model (LIAM) which is part of the framework. FIAL generically implements the work flows required from an execution environment when executing aspects provided in terms of LIAM. In addition to the first-class intermediate representation of aspect-oriented concepts, ALIA - and the FIAL framework as its incarnation - treat the points of interaction between aspects and other modules - so-called join points - as being late-bound to an implementation. In analogy to the object-oriented terminology for late-bound methods, the join points are called virtual in ALIA. Together, the first-class representation of aspect-oriented concepts in the intermediate representation as well as treating join points as being virtual facilitate the implementation of new and effective optimizations for aspect-oriented programs. Three different instantiations of the FIAL framework are presented in this thesis, showcasing the feasibility of integrating language back-ends with different characteristics with the framework. One integration supports static aspect deployment and produces results similar to conventional aspect weavers; the woven code is executable on any standard Java virtual machine. Two instantiations are fully dynamic, where one is realized as a portable plug-in for standard Java virtual machines and the other one, called Steamloom^ALIA , is realized as a deep integration into a specific virtual machine, the Jikes Research Virtual Machine Alpern2005. While the latter instantiation is not portable, it exhibits an outstanding performance. Virtual join point dispatch is a generalization of virtual method dispatch. Thus, well established and elaborate optimization techniques from the field of virtual method dispatch are re-used with slight adaptations in Steamloom^ALIA . These optimizations for aspect-oriented concepts go beyond the generation of optimal bytecode. Especially strikingly, the power of such optimizations is shown in this thesis by the examples of the cflow dynamic property, which may be necessary to evaluate during virtual join point dispatch, and dynamic aspect deployment - i.e., the selective modification of specific join points' dispatch. In order to evaluate the optimization techniques developed in this thesis, a means for benchmarking has been developed in terms of macro-benchmarks; i.e., real-world applications are executed. These benchmarks show that for both concepts the implementation presented here is at least circa twice as fast as state-of-the-art implementations performing static optimizations of the generated bytecode; in many cases this thesis's optimizations even reach a speed-up of two orders of magnitude for the cflow implementation and even four orders of magnitude for the dynamic deployment. The intermediate representation in terms of LIAM models is general enough to express the constructs of multiple aspect-oriented languages. Therefore, optimizations of features common to different languages are available to applications written in all of them. To proof that the abstractions provided by LIAM are sufficient to act as intermediate language for multiple aspect-oriented source languages, an automated translation from source code to LIAM models has been realized for three very different and popular aspect-oriented languages: AspectJ, JAsCo and Compose*. In addition, the feasibility of translating from CaesarJ to LIAM models is shown by discussion. The use of an extensible meta-model as intermediate representation furthermore simplifies the definition of new aspect-oriented language concepts as is shown in terms of a tutorial-style example of designing a domain specific extension to the Java language in this thesis.

Alternative Abstract:
Alternative AbstractLanguage

Compiler für moderne Objekt-orientierte Programmiersprachen generieren Code in einer Plattform-unabhängigen Intermediate-Sprache, die die Konzepte der Quell-Sprache erhält; zum Beispiel können Klassen, Felder, Methoden und virtueller oder statischer Methodendispatch direkt im Intermediate-Code identifiziert werden. Um diesen Intermediate-Code auszuführen, führen aktuelle Implementierungen von virtuellen Maschinen just-in-time (JIT) Compilierung der Intermediate-Sprache durch; das bedeutet, dass die virtuellen Instruktionen im Intermediate-Code zur Laufzeit zu nativem Maschinencode compiliert werden. In diesem Schritt ermöglicht eine deklarative Repräsentation der Konzepte aus der Quell-Sprache in der Intermediate-Sprache höchst effiziente adaptive und spekulative Optimierungen des laufenden Programms, die sonst nicht möglich wären. Im Gegensatz hierzu werden die Konstrukte von Aspekt-orientierten Programmiersprachen - die zu einer besseren "Separation of Concerns" führen - üblicherweise dadurch realisiert, dass sie zu herkömmlichen Intermediate-Instruktionen compiliert werden oder dass sie Transformationen im Intermediate-Code bewirken; dies wird "Weben" genannt. Auf diese Weise bleibt die Semantik Aspekt-orientierter Konstrukte auf der Ebene der Intermediate-Sprache nicht deklarativ erhalten. Durch diese Kluft in der Darstellung Aspekt-orientierter Konzepte im Quell-Code und im Intermediate-Code werden hoch-performante Optimierungen behindert und Eigenschaften eines Software-Entwicklungsprozesses geschwächt, wie Unterstützung beim Debuggen oder die Continuity-Eigenschaft von inkremeteller Compilierung: Eine Modifikation an einem Aspekt im Quell-Code zieht möglicherweise das erneute Weben mehrerer anderer Module nach sich. Um die Sprach-Implementierungstechniken für Aspekt-orientierte Programmiersprachen zu verbessern, wird in dieser Arbeit die Architektur für Aspekt-Sprachen-Implementierungen (englisch Aspect-Language Implementation Architecture, ALIA) vorgeschlagen, welche unter anderem vorschreibt, dass eine Intermediate-Repräsentation existiert, die die Aspekt-orientierten Konstrukte aus dem Quell-Programm erhält. Eine zentrale Komponente dieser Architektur ist das erweiterbare und flexible Meta-Model von Aspekt-orientierten Konzepten, das als Schnittstelle zwischen Front-Ends (üblicherweise ein Compiler) und Back-Ends (üblicherweise eine virtuelle Maschine) von Aspekt-orientierten Sprachimplementierungen dient. Die Architektur und das Meta-Model sind für Java-basierte Sprachen in dem Framework zum Implementieren von Aspekt-Sprachen (englisch Framework for Implementing Aspect Languages, FIAL) beziehungsweise dem Sprachunabhängigen Aspekt-Meta-Model (englisch Language-Independent Aspect Meta-Model, LIAM), das Teil des Frameworks ist, verkörpert. FIAL implementiert generisch Arbeitsabläufe, die von einer Ausführungsumgebung benötigt werden, welche Aspekte ausführt, die mit LIAM definiert sind. Zusätzlich zu der deklarativen Intermediate-Repräsentation von Aspekt-orientierten Konzepten behandelt ALIA - und FIAL als dessen Verkörperung - Join-Points - also Punkte an denen Interaktion zwischen Aspekten und anderen Modulen stattfindet - so, dass sie an eine Implementierung spät-gebunden werden. Analog zu der Objekt-orientierten Terminologie für spät-gebundene Methoden werden Join-Points in ALIA als virtuell bezeichnet. Die deklarative Repräsentation von Aspekt-orientierten Konzepten in der Intermediate-Repräsentation und das Behandeln von Join-Points als virtuell ermöglichen es, neue und effektive Optimierungen für Aspekt-orientierte Programme zu entwickeln. In dieser Arbeit werden drei Instantiierungen von FIAL vorgestellt, die herausstellen, dass eine Integration von Sprach-Back-Ends mit unterschiedlichen Eigenschaften mit dem Framework möglich sind. Eine der Integrierungen unterstützt statisches Aspekt-Deployment und erzeugt Ergebnisse, die vergleichbar mit denen herkömmlicher Weber sind; der gewobene Code kann auf jeder standard-Java Virtual Machine ausgeführt werden. Zwei Instantiierungen sind vollständig dynamisch, wobei eine als portables Plug-in für standard-Java Virtual Machines realisiert ist und die andere als tiefgehende Integration in eine spezielle virtuelle Maschine, die Jikes Research Virtual Machine. Während Steamloom^ALIA, die letztere Instantiierung, nicht portabel ist, ist sie besonders leistungsstark. Der Dispatch von virtuellen Join-Points ist eine Verallgemeinerung des Dispatchs von virtuellen Methoden. Daher werden in Steamloom^ALIA etablierte und ausgefeilte Optimierungstechniken aus dem Bereich des virtuellen Methodendispatchs wiederverwendet. Diese Optimierungen für Aspekt-orientierte Konzepte gehen über die Erzeugung von optimalem Bytecode hinaus. Die Mächtigkeit solcher Optimierungen wird in dieser Arbeit besonders offensichtlich an den Beispielen der dynamischen Eigenschaft cflow Avgustinov2005, die bei der Auswertung eines virtuellen Join-Point-Dispatchs benötigt werden kann, und dynamischem Aspekt-Deployment Mezini2003 - das heißt die selektive Modifikation des Dispatchs von bestimmten Join-Points. Um diese Optimierungstechniken zu evaluieren, wurde in dieser Arbeit ein Benchmark-Verfahren entwickelt, in dem Makro-Benchmarks, also reale Applikationen, verwendet werden. Diese Benchmarks zeigen, dass für beide Konzepte die hier präsentierte Implementierung mindestens etwa doppelt so schnell ist wie aktuelle Implementierungen, die den generierten Bytecode statisch optimieren; in vielen Fällen erreichen die in dieser Arbeit vorgestellten Optimierungen sogar eine Beschleunigung von zwei Größenordnungen für die cflow-Implementierung und sogar vier Größenordnungen für das dynamische Deployment. Die Verwendung von LIAM -Modellen als Intermediate-Repräsentation ist allgemein genug, um Aspekt-orientierte Konstrukte mehrerer Sprachen auszudrücken. Daher profitieren alle Sprachen davon, wenn für gemeinsame Konzepte Optimierungen implementiert werden. Um zu zeigen, dass die Abstraktionen von LIAM ausreichend sind, um als Intermediate-Sprache für mehrere Aspekt-Orientierte Quell-Sprachen zu dienen, wurden automatische Übersetzer von Quell-Code zu LIAM -Modellen für drei sehr verschiedene aber populäre Aspekt-orientierte Sprachen entwickelt: AspectJ, JAsCo und Compose*. Zusätzlich wird die Machbarkeit, von CaesarJ zu LIAM -Modellen zu übersetzen, diskutiert. Die Verwendung eines erweiterbaren Meta-Modells als Intermediate-Repräsentation vereinfacht weiterhin die Definition von neuen Aspekt-orientierten Sprach-Konzepten, wie in dieser Arbeit durch ein Tutorial-artiges Beispiel gezeigt wird, in dem eine Domänen-spezifische Erweiterung der Sprache Java entwickelt wird.

German
Uncontrolled Keywords: Virtual Machines, Dynamic Optimization, Speculative Optimization, Aspect-Oriented Programming, Meta-Model of Aspects, Virtual Join Points, Aspect Weaving, Dynamic Deployment, cflow Pointcut Designator, Benchmark
Alternative keywords:
Alternative keywordsLanguage
Virtual Machines, Dynamic Optimization, Speculative Optimization, Aspect-Oriented Programming, Meta-Model of Aspects, Virtual Join Points, Aspect Weaving, Dynamic Deployment, cflow Pointcut Designator, BenchmarkEnglish
URN: urn:nbn:de:tuda-tuprints-13147
Classification DDC: 000 Generalities, computers, information > 004 Computer science
Divisions: 20 Department of Computer Science > Software Technology
Date Deposited: 20 Feb 2009 12:43
Last Modified: 08 Jul 2020 23:17
URI: https://tuprints.ulb.tu-darmstadt.de/id/eprint/1314
PPN: 209429836
Export:
Actions (login required)
View Item View Item