Most implementations of the C++ programming language generate binary executable code. However, interpreted execution of C++ sources has its own use cases as the Cling interpreter from CERN’s ROOT project has shown. Some limitations are derived from the ODR (One Definition Rule) that rules out multiple definitions of entities within a single translation unit (TU). ODR is there to ensure uniform view of a given C++ entity across translation units. Ensuring uniform view of C++ entities helps when producing ABI compatible binaries. Interpreting C++ presumes a single ever-growing translation unit that define away some of the ODR use-cases. Therefore, it may well be desirable to relax the ODR and, consequently, to support the ability of developers to override any existing definition for a given declaration. This approach is especially well-suited for iterative prototyping. In this paper, we extend Cling, a Clang/LLVM-based C++ interpreter, to enable redefinitions of C++ entities at the prompt. To achieve this, top-level declarations are nested into inline namespaces and the translation unit lookup table is adjusted to invalidate previous definitions that would otherwise result in ambiguities. Formally, this technique refactors the code to an equivalent that does not violate the ODR, as each definition is nested in a different namespace. Furthermore, any previous definition that has been shadowed is still accessible by means of its fully-qualified name. A prototype implementation of the presented technique has been integrated into the Cling C++ interpreter, showing that our technique is feasible and usable.
Sun 23 FebDisplayed time zone: Pacific Time (US & Canada) change
10:30 - 11:40 | |||
10:30 23mResearch paper | Compiler-Based Graph Representations for Deep Learning Models of Code Main Conference Alexander Brauckmann TU Dresden, Germany, Andrés Goens TU Dresden, Sebastian Ertel Composable Operating Systems Group, Barkhausen Institute, Dresden, Jeronimo Castrillon TU Dresden, Germany | ||
10:53 23mResearch paper | Postcondition-Preserving Fusion of Postorder Tree Transformations Main Conference | ||
11:16 23mResearch paper | Relaxing the One Definition Rule in Interpreted C++ Main Conference Javier López-Gómez University Carlos III of Madrid, Javier Fernández University Carlos III of Madrid, David del Rio Astorga University Carlos III of Madrid, Vassil Vassilev Princeton University, Axel Naumann CERN, J. Daniel García University Carlos III of Madrid |