On the Run - Building Dynamic Program Modifiers for Optimization, Introspection and Security

Saman P. Amarasinghe

Laboratory for Computer Science
Massachusetts Institute of Technology


In the new world of software, which heavily utilizes dynamic class loading, DLLs and interconnected components, the power and reach of static analysis is diminishing. An exciting new paradigm of dynamic program optimization, improving the performance of a program while it is being executed, is emerging. In this tutorial, we will describe intricacies of building a dynamic program modification system, explore novel applications areas such as program introspection and security, and provide details of building your own dynamic code modifier using Dynamo/RIO. Dynamo/RIO, a joint development between HP Labs and MIT, is a powerful dynamic code modification infrastructure capable of running existing binaries such as Microsoft Office Suite. It runs on both Windows and Linux environments. Dynamo-RIO is freely available for non-commercial use. 

There has been increasing interest in techniques and runtime systems that enable dynamic code manipulations while a program is running, from simple dynamic library loaders to complex dynamic code optimization systems. These dynamic techniques share a fundamental property: the capability to observe and transform instructions of the underlying target machine immediately before they run. Importantly, recent advances allow this capability to be offered without having to pay the price of performance degradation.

The first part of the tutorial will concentrate on issues on building a dynamic program modification framework. We will use the Dynamo/RIO system as a guiding example to present the basic structure of a dynamic program modification system. We will illustrate the major design decisions and trade-offs and point to the important engineering challenges. At the end of this part the participants should be able to understand and reproduce the general structure of a dynamic program modification system.

The second part of the tutorial will present novel applications that exploit the dynamic code inspection and transformation capability of dynamic program modification systems. This is intended to demonstrate the large spectrum of capabilities offered by dynamic program modificaiton systems and to motivate the exploration into other novel uses for these systems. We plan to discuss some of the following applications:

The third part of the tutorial will serve as an hands-on introduction to using and working with the Dynamo/RIO system. The discussion will include a detailed description of the system's API that allows the user to specify various dynamic code transformations. We will also illustrate several examples of how to use the system for specific code transformations. At the end of this part the participants will be sufficiently knowledgeable about the Dynamo/RIO code release to actively engage in experimentation with the system.

A main motivation of this tutorial is to help foster research in dynamic optimization, introspection and security. Although there are many exciting novel and innovative possibilities for dynamic code modification, the complexity of building an infrastructure and the lack of a publicly available infrastructure has made it difficult for many researchers to enter this fertile research area. We hope that the public release of the Dynamo/RIO infrastructure will foster many novel applications of dynamic code modification. We expect that this tutorial will further this goal by educating the community about the possibilities.


Saman P. Amarasinghe is an Associate Professor in the Department of Electrical Engineering and Computer Science at Massachusetts Institute of Technology and a member of the MIT Laboratory for Computer Science. Currently he leads the Commit compiler group and is the co-leader of the Raw project. Saman's research interests are in discovering novel approaches to improve the performance of modern computer systems without unduly increasing the complexity faced by either application developers, compiler writers, or computer architects. He received his BS in Electrical Engineering and Computer Science from Cornell University in 1988, and his MSEE and Ph.D from Stanford University in 1990 and 1997, respectively.