Incremental Compilation in Compose*
Total Page:16
File Type:pdf, Size:1020Kb
Incremental Compilation in Compose? A thesis submitted for the degree of Master of Science at the University of Twente Dennis Spenkelink Enschede, October 28, 2006 Research Group Graduation Committee Twente Research and Education prof. dr. ir. M. Aksit on Software Engineering dr. ir. L.M.J. Bergmans Faculty of Electrical Engineering, M.Sc. G. Gulesir Mathematics and Computer Science University of Twente Abstract Compose? is a project that provides aspect-oriented programming for object-oriented lan- guages by using the composition filters model. In particular, Compose?.NET is an implemen- tation of Compose? that provides aspect-oriented programming to Microsoft Visual Studio languages. The compilation process of Compose?.NET contains multiple compilation modules. Each of them has their own responsibilities and duties such as parsing, analysis tasks and weaving. However, all of them suffer from the same problem. They do not support any kind of incre- mentality. This means that they perform all of their operations in each compilation without taking advantage of the results and efforts of previous compilations. This unavoidably results in compilations containing many redundant repeats of operations, which slow down compila- tion. To minimize these redundant operations and hence, speed up the compilation, Compose? needs an incremental compilation process. Therefore, we have developed a new compilation module called INCRE. This compilation module provides incremental performance as a service to all other compilation modules of Compose?. This thesis describes in detail the design and implementation of this new compila- tion module and evaluates its performance by charts of tests. i Acknowledgements My graduation time was a long but exciting process and I would not have missed it for the world. Many people contributed to the completion of this thesis, for which I am grateful. In particular, I would like to express my appreciation to the following people. First, I would like to thank my supervisor Lodewijk Bergmans for his enthusiastic and expert guiding. In addition, I am thankful to Gurcan Gulesir and Istvan´ Nagy for their assistance in writing this thesis. Furthermore, I thank my fellow members of the Compose? project for their valuable comments and tips. I learned a lot from you guys. Finally, many thanks go to my family for encouraging me to do my best and supporting me all the way. iii Contents Abstract i Acknowledgements iii List of Figures xii List of Listings xiv Reading Guide xv 1 Introduction to AOSD 1 1.1 Introduction . 1 1.2 Traditional Approach . 2 1.3 AOP Approach . 4 1.3.1 AOP Composition . 5 1.3.2 Aspect Weaving . 5 1.3.2.1 Source Code Weaving . 5 1.3.2.2 Intermediate Language Weaving . 6 1.3.2.3 Adapting the Virtual Machine . 6 1.4 AOP Solutions . 7 1.4.1 AspectJ Approach . 7 1.4.2 Hyperspaces Approach . 9 1.4.3 Composition Filters . 10 2 Compose? 12 2.1 Evolution of Composition Filters . 12 2.2 Composition Filters in Compose? ........................... 13 2.3 Demonstrating Example . 15 2.3.1 Initial Object-Oriented Design . 15 2.3.2 Completing the Pacman Example . 17 v 2.3.2.1 Implementation of Scoring . 17 2.3.2.2 Implementation of Dynamic Strategy . 18 2.4 Compose? Architecture . 18 2.4.1 Integrated Development Environment . 18 2.4.2 Compile Time . 21 2.4.3 Adaptation . 21 2.4.4 Runtime . 21 2.5 Platforms . 21 2.6 Features Specific to Compose? ............................. 22 3 Problem Statement 25 3.1 Background . 25 3.1.1 OOP Work on Incremental Compilation . 25 3.1.1.1 Make Tool . 26 3.1.1.2 Jikes . 26 3.1.1.3 Tichy’s Smart Recompilation . 26 3.1.1.4 Eclipse Compiler . 27 3.1.1.5 IBM VisualAge C++ . 27 3.1.2 AOP Work on Incremental Compilation . 28 3.1.2.1 Whole-program and Incremental Weaving . 28 3.1.2.2 Crosscutting Complicates Incremental Weaving . 28 3.1.2.3 Incremental Weavers . 28 3.2 Non-incremental Compilation in Compose? ..................... 29 3.3 Motivation . 31 3.4 Problem Summary and Conclusion . 32 4 Solution Approaches 33 4.1 Model of a Compilation Module in Compose? .................... 33 4.2 Restoration in Seven Steps . 35 4.3 Rebuilding in Five Steps . 37 4.4 Comparison of Solution Approaches . 38 4.4.1 Comparison Criteria . 38 4.4.2 Applying the Comparison Criteria . 39 4.4.2.1 Criteria applied to Restoration and Rebuilding . 39 4.4.2.2 Conclusion . 40 5 Design Alternatives Rebuilding Approach 41 5.1 Design Decisions . 41 5.2 Storage and Retrieval . 42 5.2.1 Java Object Serialization (JOS) . 42 5.2.2 Java Database Connectivity (JDBC) . 43 5.2.3 Java Data Objects (JDO) . 44 5.2.4 Comparison Criteria . 46 5.2.5 Applying the Criteria . 47 5.2.5.1 Criteria applied to JOS . 47 5.2.5.2 Criteria applied to JDBC . 48 5.2.5.3 Criteria applied to JDO . 48 5.2.6 Choice Motivation . 49 5.2.7 Limitations of chosen alternative . 50 5.3 Data Comparison . 50 5.3.1 File Comparison . 50 5.3.1.1 Byte-by-byte comparison . 50 5.3.1.2 Timestamp comparison . 50 5.3.2 Repository Entities Comparison . 51 5.4 Acquisition of Dependent Data . 53 5.5 Conclusion . 55 6 Implementation 56 6.1 Adaptations to the Compose? architecture . 56 6.2 XML configuration file . 58 6.3 Implementation of the object comparator mechanism . 59 6.4 Reporting . 62 6.5 Control Flow . 63 6.5.1 IsProcessedBy service . 64 6.6 Conclusion . 66 7 Realization of Incremental Compose? Compilation Modules 67 7.1 Compilation Modules Enhanced . 67 7.2 Step One: Identifying Input, Output and Data Dependencies . 68 7.2.1 FILTH Analysis . 68 7.2.2 RECOMA Analysis . 69 7.3 Step Two: Serializing Repository . 70 7.4 Step Three: Implementing Copy Operation . 70 7.4.1 Copy Operation FILTH . 70 7.4.2 Copy Operation RECOMA . 71 7.5 Step Four: Configuring Data Dependencies . 71 7.5.1 Dependency Configuration FILTH . 71 7.5.2 Dependency Configuration RECOMA . 72 7.6 Step Five: Optimizing Repository Entity Comparison . 73 7.6.1 Comparison Configuration FILTH . 73 7.6.2 Comparison Configuration RECOMA . 74 7.7 Conclusion . 74 8 Evaluation 75 8.1 Test Cases and Conditions . 75 8.1.1 Cases . 75 8.1.2 Conditions . 76 8.2 Charts and Expected Results . 76 8.3 Non-incremental Compilation Time of Compilation Modules . 79 8.4 Performance Improvement by Example and Scenario . 80 8.5 Overhead by Example and Scenario . 81 8.6 Average Performance of Compilation Modules . 82 8.7 Evaluation of INCRE . 83 8.8 Evaluation of COPPER . ..