We introduce Backstroke, a new open source framework for the automatic generation of reverse code for functions written in C++. Backstroke enables reverse computation for optimistic parallel discrete event simulations. It is built over the ROSE open-source compiler infrastructure, and handles complex C++ features including pointers and pointer types, arrays, function and method calls, class types, inheritance, polymorphism, virtual functions, abstract classes, templated classes and containers. Backstroke also introduces new program inversion techniques based on advanced compiler analysis tools built into ROSE. We explore and illustrate some of the complex language and semantic issues that arise in generating correct reverse code for C++ functions.
INTRODUCTIONBackstroke is a new open source framework for the automatic generation of reverse code for functions written in C++. It is built on ROSE, a widely used source-to-source compiler infrastructure that has been under development at Lawrence Livermore National Laboratory for a decade (Quinlan 2011). The primary purpose of Backstroke is to enable reverse computation for fast, efficient rollback in optimistic parallel discrete event simulations. Reverse computation is a well established technique now, but major practical barriers still prevent its widespread adoption. It is difficult to create correct and efficient reverse methods by hand, and unrealistic to require programmers to do so. Further, since the number of times an event is rolled back is unpredictable, simple bugs in reverse code frequently act as nondeterministic "Heisenbugs", making debugging very difficult. These considerations suggest automatic generation of reverse code (Perumalla 1999, Carothers, Perumalla, and. Backstroke takes this approach, but advances it considerably beyond prior systems. In particular, it can reverse more complex language constructs than prior work, since it applies to C++ rather than just C, and it serves as a general framework allowing experimentation with many different inversion techniques. We will describe some of the general approaches to automatic generation of reverse code, and explore language and semantic issues that arise in generating correct reverse code for C++ functions.
CONTEXT AND RELATED WORKA parallel discrete event simulation (PDES) program consists of logical processes (LPs) that execute concurrently and exchange timestamped event messages. A synchronization algorithm is required to ensure each LP processes events in non-decreasing timestamp order. Optimistic synchronization uses rollback to undo the computation of events that are performed out of timestamp order (Jefferson 1985). Parallel discrete event simulation and optimistic execution are described in detail in (Fujimoto 2000). Reverse computation is a technique to efficiently implement event rollback (Carothers, Perumalla and Fujimoto, 1999;Tang Perumalla, and Fujimoto 2006, Naborskyy andFujimoto 2007). Each event routine is instrumented to save a minimal amount of control and data informat...