On Modularity and Performances of External Domain-Specific Language Implementations Manuel Leduc
Total Page:16
File Type:pdf, Size:1020Kb
On modularity and performances of external domain-specific language implementations Manuel Leduc To cite this version: Manuel Leduc. On modularity and performances of external domain-specific language implementa- tions. Software Engineering [cs.SE]. Université Rennes 1, 2019. English. NNT : 2019REN1S112. tel-02972666 HAL Id: tel-02972666 https://tel.archives-ouvertes.fr/tel-02972666 Submitted on 20 Oct 2020 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. THÈSE DE DOCTORAT DE L’UNIVERSITE DE RENNES 1 COMUE UNIVERSITE BRETAGNE LOIRE Ecole Doctorale N°601 Mathèmatique et Sciences et Technologies de l’Information et de la Communication Spécialité : Informatique Par Manuel LEDUC On modularity and performance of External Domain-Specific Language im- plementations Thèse présentée et soutenue à RENNES , le 18 Décembre 2019 Unité de recherche : Equipe DiverSE, IRISA Rapporteurs avant soutenance : Paul Klint, Professeur, CWI, Amsterdam, Pays-Bas Juan De Lara, Professeur, Université autonome de Madrid, Madrid, Espagne Composition du jury : Président : Olivier Ridoux, Professeur, Université de Rennes 1, Rennes, France Examinateurs : Nelly Bencomo, Lecturer in Computer Science, Aston University, Birmingham, Royaume-Uni Jean-Remy Falleri, Maître de conférences HDR, Université de Bordeaux, Bordeaux, France Gurvan Le Guernic, Ingénieur de recherche, DGA, Rennes, France Dir. de thèse : Benoît Combemale, Professeur, UT2J, Toulouse, France Co-dir. de thèse : Olivier Barais, Professeur, Université de Rennes 1, Rennes, France Invité Thomas Degueule, Chargé de Recherche, CWI, Amsterdam, Pays-Bas ACKNOWLEDGEMENT First of all, I would like to thank all the members of the jury for accepting to review my work. In particular, I wish to thank Professor Juan De Lara and Professor Paul Klint for thoroughly reviewing this report. Those three years have been a very intense and enriching experience. For that, I want to thank my advisors, Benoît Combemale and Olivier Barais. I also want to highlight the infinite energy and passion that they invest in their work. This has been an incredible thing to witness. I also want to thank Thomas, who had the patience to write with me and to be available to answer my numerous questions. You helped me untangle the puzzle that scientific writing is. Then, I want to thank Gurvan, who gave me an outside view of my research and helped me question my work. Continuing, I would like to thank the members of the SWAT team. It has been a pleasure to visit your team and to collaborate on the ALE project. And as a final note on the professional and scientific side, I want to thank the DiverSE team as a whole. I am impressed by the energy, creativity, and spirit of its members and I’m proud to have shared so many coffee breaks with you all. Moving to a more personal note, I first want to thank the “coureurs d’extrême” running club. The weekly training sessions have been an awesome way to clear my mind after work. The great advice and cheerfulness of everybody brought me from slow-paced 10k races to ultra-trails during the span of those three years. It goes without saying that I thank everybody from “Robidou” and my family. Your attentions have helped me through this challenge. Finally, my last acknowledgment goes to Flora. Three wonderful years, thank you for your infinite support and encouragements, even when you were more exhausted than I was. TABLE OF CONTENTS Table of Contents Introduction en français i Contexte de recherche ............................... i Énoncé du problème ............................... i Contributions ................................... iii Applications : Implémentations et Évaluations .................. iv 1 Introduction 1 1.1 Research Context .............................. 1 1.2 Problem Statement ............................. 2 1.3 Contributions ................................ 3 1.4 Implementations and Evaluations ...................... 4 1.5 Outline ................................... 5 1.6 List of Publications ............................. 7 1.6.1 Main Publications ......................... 7 1.6.2 Publications Under Minor Revision ................ 7 1.6.3 Other Publications ......................... 8 I Preliminaries 9 2 Background 11 2.1 Model-Driven Engineering ......................... 11 2.2 Software Languages ............................. 15 2.3 Software Language Engineering ...................... 17 2.3.1 Domain-Specific Language Specification ............. 18 2.3.2 Domain-Specific Language Services Implementation ....... 22 2.3.3 Language Workbenches ...................... 22 2.4 Summary .................................. 23 3 State of the Art 25 3.1 Context and Scope ............................. 25 3.2 Reuse in Software Language Engineering ................. 28 3.2.1 Syntax Reuse ............................ 29 3.2.2 Semantics Reuse .......................... 31 3.3 Runtime Performance Optimization in Software Language Engineering . 33 TABLE OF CONTENTS 3.4 Tool Support in Software Language Engineering.............. 35 3.5 Advancing the State of the Art ....................... 37 II Contributions 40 4 Language Reuse 43 4.1 The Language Extension Problem ..................... 43 4.1.1 From the Expression Problem to the Language Extension Problem 43 4.1.2 The Language Extension Problem ................. 45 4.1.3 The Language Extension Problem in Practice ........... 46 4.1.4 Wrap up of the Language Extension Problem ........... 47 4.2 Reusable Languages Motivation and Overview .............. 47 4.2.1 Reuse of a Finite State Machine Language by Extension ..... 47 4.2.2 Reuse of a Finite State Machine Language by Composition .... 48 4.2.3 On Language Module Interfaces .................. 49 4.2.4 Language Reuse Requirements ................... 50 4.2.5 Language Extension Overview ................... 51 4.2.6 Language Composition Overview ................. 52 4.2.7 Modular Language Reuse Discussion ............... 54 4.3 Reusable Language Implementation .................... 54 4.3.1 The REVISITOR Pattern ...................... 55 4.3.2 Modular Extension with REVISITORS ............... 58 4.3.3 Modular Composition with REVISITORS ............. 61 4.4 Conclusion on Language Reuse ....................... 68 5 Language Performance Optimization 71 5.1 Introduction to Language Performances .................. 71 5.2 Background ................................. 72 5.2.1 Graal and GraalVM ......................... 72 5.2.2 Truffle ................................ 73 5.3 DSL Design and Implementation ...................... 73 5.4 Automatic Generation of Truffle-based Interpreters ............ 74 5.4.1 Preliminary Results ......................... 75 5.4.2 Truffle-Compliant Object Model Implementation ......... 75 5.4.3 Truffle Boundaries ......................... 77 5.4.4 Discussion of Additional Truffle Optimizations .......... 78 5.5 Conclusion on Language Performance Optimization ............ 80 TABLE OF CONTENTS III Implementation and Evaluation 81 6 Technical Background 83 6.1 Introducing the ALE Metalanguage .................... 83 6.2 Benchmarking Setup ............................ 87 7 ALE Compiler for Language Reuse 89 7.1 The REVISITOR compiler .......................... 89 7.2 Language Extension Evaluation ...................... 92 7.2.1 Scenario ............................... 92 7.2.2 fUML with ALE .......................... 93 7.2.3 Performance Evaluation ...................... 94 7.3 Language Composition Evaluation ..................... 95 7.3.1 The IoT Case Study ........................ 95 7.3.2 Case Study Implementation .................... 96 7.3.3 Discussion ............................. 97 7.4 Conclusion on Modular Language Reuse .................. 99 8 ALE Compiler for Language Performance Optimization 101 8.1 The Truffle Compiler ............................ 101 8.2 Language Performance Evaluation ..................... 102 8.2.1 Benchmarked Languages and Programs .............. 102 8.2.2 Results ............................... 103 8.3 Conclusion on the Automatic Optimization of Language Performances .. 105 IV Conclusion and Perspectives 106 9 Conclusion and Perspectives 109 9.1 Conclusion ................................. 109 9.2 Perspectives ................................. 110 9.2.1 Reusability and Performance Tradeoff ............... 110 9.2.2 Automatic Domain Adaptation ................... 111 9.2.3 Safer Language Reuse ....................... 112 V Indexes 113 List of Figures 114 List of Tables 116 List of Listings 117 Bibliography 117 Abstract 141 TABLE OF CONTENTS ii INTRODUCTION EN FRANÇAIS Contexte de recherche Un challenge important de l’ingénierie logicielle est le développement et la maintenance de systèmes complexes. Des exemples récents de tels systèmes sont l’internet des objets ou les systèmes cyber-physiques. La conception de ces systèmes complexes implique de nombreux partie prenante, avec des points de vue variés et hétérogènes. Ce qui soulève de nombreux défis d’ingénierie. Par conséquent, le succès de la conception de systèmes complexes requière l’application de méthodes et d’outils d’ingénierie