
Fine-Grained Modularity and Reuse of Virtual Machine Components Christian Wimmer∗ Stefan Brunthalery Per Larseny Michael Franzy ∗ y Oracle Labs Department of Computer Science, University of California, Irvine [email protected] [email protected] [email protected] [email protected] Abstract Categories and Subject Descriptors D.3.4 [Programming Modularity is a key concept for large and complex applica- Languages]: Processors—Run-time environments, Compil- tions and an important enabler for collaborative research. In ers, Optimization comparison, virtual machines (VMs) are still mostly mono- General Terms Algorithms, Languages, Performance lithic pieces of software. Our goal is to significantly reduce to the cost of extending VMs to efficiently host and ex- Keywords Maxine, languages, dynamic languages, Java, ecute multiple, dynamic languages. We are designing and virtual machine, modularity, modular VM, metacircular implementing a VM following the “everything is extensible” VM, just-in-time compilation, optimization, performance paradigm. Among the novel use cases that will be enabled by our research are: VM extensions by third parties, support for multiple languages inside one VM, and a universal VM for 1. Introduction mobile devices. Modularity enables developers to build increasingly large Our research will be based on the existing state of the and complex applications. It is often not feasible to closely TM art. We will reuse an existing metacircular Java VM and control the entire architecture of such applications. They an existing dynamic language VM implemented in Java. We are often developed by distributed teams or even multiple will split the VMs into fine-grained modules, define explicit vendors, so it is necessary that individual modules are inde- interfaces and extension points for the modules, and finally pendent and have a well-defined interface to the rest of the re-connect them. application. The concept of a module system, i.e., a software Performance is one of the most important concerns for layer that loads, unloads, and connects modules, is well VMs. Modularity improves flexibility but can introduce an understood in the field of software engineering [29]. It is unacceptable performance overhead at the module bound- used on a daily basis with industry standards like OSGi [24]. aries, e.g., for inter-module method calls. We will identify The complexity of virtual machines (VMs) is steadily this overhead and address it with novel feedback-directed increasing. This includes the development of more advanced compiler optimizations. These optimizations will also im- just-in-time (JIT) compilers and garbage collectors, but also prove the performance of modular applications running on optimized run-time services such as thread synchronization. top of our VM. Additionally, the rise of dynamic languages has led to The expected results of our research will be not only new a plethora of new VMs, since a completely new VM is insights and a new design approach for VMs, but also a typically developed for every new language. VMs are still complete reference implementation of a modular VM where mostly monolithic pieces of software. They are developed in everything is extensible by third parties and that supports C or C++, the languages that they aim to replace. In sum- multiple languages. mary, VMs offer a lot of benefits for applications running on top of them, but they mostly do not utilize these benefits for themselves. The reason often cited for this is performance. Many subsystems are highly performance critical or have perfor- mance critical connection points with other subsystems. For Permission to make digital or hard copies of all or part of this work for personal or example, when a garbage collector needs write barriers, the classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation JIT compiler must efficiently embed them into the generated on the first page. To copy otherwise, to republish, to post on servers or to redistribute code. A callback into the garbage collector for every field to lists, requires prior specific permission and/or a fee. AOSD’12, March 25–30, 2012, Potsdam, Germany. access would be too slow. Using modularity and interfaces, Copyright c 2012 ACM 978-1-4503-1092-5/12/03. $10.00 it would be an even slower call that needs dynamic dis- 203 patch. Existing modular VMs therefore have carefully se- Object Layout lected module boundaries to avoid the performance impact. An important step towards true modularity for VMs are metacircular VMs, i.e., VMs written in the same language as Interpreter Garbage Collector they execute. The two most prominent examples for JavaTM are the Jikes RVM [16] and the Maxine VM [20]. Maxine JIT Compiler Synchronization is designed with modularity in mind: the core subsystems are exchangeable using so-called “schemes”. However, there is still no explicit concept of modules. Additionally, the Class Loader Linker modularity is on a coarse level. Individual modules are not Figure 1. Structure of current VMs. designed with fine-grained extensibility in mind. Most current VMs are designed to execute only a sin- gle input language. The monolithic design makes it dif- software development. Consequently, it is not possible to ficult to adapt major parts when building a new VM for implement different VM optimizations independently from a new language. For example, Java VMs have been ex- each other: all parts of a VM interdepend on each other. Fig- tensively optimized over the last decade, which has led to ure 1 shows important subsystems of a current VM. There aggressively optimizing JIT compilers as well as parallel are multiple circular and bidirectional dependencies, e.g., and concurrent garbage collectors. However, the dynamic between the JIT compiler and the garbage collector: the language VMs that have become highly popular in recent JIT compiler emits read and write barriers specifically for a years do not incorporate these implementation-intensive op- garbage collector, while the garbage collector traverses stack timizations. The lack of modularity has prohibited the reuse frames and root pointers defined by the JIT compiler. of existing VM optimizations. With fine-grained modularity, We want to disentangle the structure of the VM by intro- implementing a VM for a new language requires only im- ducing an explicit concept of modules and module depen- plementing the new language-specific parts, while the core dencies. Modules provide well-specified extension points runtime and optimization infrastructure remains unchanged. that are used by other modules. We outline the main features The goal of our research is to investigate the impact of of the resulting system below. fine-grained modularity on VMs. We envision a VM follow- ing the “everything is extensible” paradigm, by combining • No circular dependencies: The module system prohibits best practices of existing VM design and existing module circular dependencies, leading to an overall structure that systems. is easier to understand. We expect our research to contribute along three axes. • Fine-grained modules: Every subsystem is split into sev- eral modules with explicit dependencies and extension • Direct research results: We will study the performance points in between. impact of fine-grained modularity in VMs, develop new optimizations to eliminate possible overhead, and gener- • Ubiquitous extensibility: There is no distinction between alize the results for the benefit of all modular applica- “internal” modules that constitute the core runtime sys- tions. tem, and “external” modules supplied by third-party ven- dors. All use the same extension points and have access • Benefits for future research: We will develop a VM re- to the same data and interfaces. search platform that is ideal for future research. It will make comparisons of different optimizations much easier • Metacircularity: The VM is mostly written in one of the than before. many managed languages that it can execute (we antici- pate the VM to be written in Java). Modules that extend • Optimized VMs for many languages: We will define a the VM are shipped in the same form as applications customizable family of VMs that can easily be configured running on top of the VM. Therefore, all optimizations for different languages (static and dynamic languages), that improve the application speed also improve the VM different target systems (from embedded devices to speed, and it is possible to eliminate the overhead of servers), and different optimization strategies. For some modularity. of these configurations, no optimized VMs are available yet, e.g., we expect to contribute significantly to the 2.1 Performance performance of dynamic language VMs. Performance is a key aspect for VMs because it affects all applications running on top of the VM. However, we believe 2. Vision of a Modular VM that the current VM development process is too centered While the performance and complexity of VMs have been around performance, thereby sacrificing other important as- greatly increased over the last decade, the internal struc- pects such as maintainability, portability, and extensibility. ture of VMs still neglects the concepts of modern modular Many optimizations are applied prematurely because there is 204 Application Library Application Library Use of Complex Class Definition of Use of Complex Class Definition of Numbers Complex Numbers Numbers Complex Numbers VM VM JIT Compiler JIT Compiler Compiler Optimizations Garbage Collector Garbage Collector Memory Layout ... ... (a) Current Structure (b) Envisioned Structure Figure 2. Case study for the support of complex numbers inside the VM. the common belief that they are indispensable. To overcome tions for a certain library is out of scope for a VM—only this, we will follow a three step process. important methods of the standard library that ships with the VM are optimized by the VM. 1. Define the module boundaries so that each module is a Using our approach, the library vendor can also supply small, self-contained, and individually meaningful entity.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages11 Page
-
File Size-