\documentclass{acm_proc_article-sp} %-- Begin patch area for accents in 'Author Block' area - may be needed by some authors / but not all \DeclareFixedFont{\auacc}{OT1}{phv}{m}{n}{12} % Needed for "Author Block" accents - Patch by Gerry 3/21/07 \DeclareFixedFont{\afacc}{OT1}{phv}{m}{n}{10} % Needed for "Author Block" accents in the affiliation/address line - Patch by Gerry 3/21/07 %-- \usepackage{latexsym,amsmath,amssymb,times} \usepackage{xspace} \usepackage{listings} \usepackage{color} \usepackage{fancyvrb} \lstset{language=Python, basicstyle=\footnotesize\ttfamily, frame=lines, stringstyle=\color{blue}, fancyvrb=true, xleftmargin=20pt,xrightmargin=20pt, showstringspaces=false} \begin{document} \pagestyle{plain} \conferenceinfo{}{} \CopyrightYear{} \crdata{} \setpagenumber{1} \pagestyle{plain} \title{RPython: Reconciling Dynamically and Statically Typed OO Languages\titlenote{This work has been partially supported by PyPy EC Project IST FP6-004779 and by MIUR EOS DUE - Extensible Object Systems for Dynamic and Unpredictable Environments.}} \subtitle{[Draft]} \numberofauthors{4} \author{ \alignauthor Davide Ancona \\ \affaddr{DISI, Univ. of Genova, Italy}\\ \email{davide@disi.unige.it} \alignauthor Massimo Ancona \\ \affaddr{DISI, Univ. of Genova, Italy}\\ \email{ancona@disi.unige.it} \and \alignauthor Antonio Cuni \\ \affaddr{DISI, Univ. of Genova, Italy}\\ \email{cuni@disi.unige.it} \alignauthor Nicholas D. Matsakis \\ \affaddr{ETH Zurich, Switzerland}\\ \email{nicholas.matsakis@inf.ethz.ch} } \maketitle \begin{abstract} Although Python's C-based interpreter is reasonably fast, it cannot keep up with the JVM and CLI. As a result, there have been many efforts to craft compilers for Python which try to take advantage of the robust JIT compilers, garbage collectors, and other features which are offered by these runtimes. Unfortunately, because the CLI and JVM are primarily designed to execute statically-typed, object-oriented languages, most dynamic language implementations cannot use the native bytecodes for common operations like method calls and exception handling; as a result, they are not able to take full advantage of the power offered by the CLI and JVM. We describe a different approach that attempts to preserve Python's flexibility, while still allowing for efficient execution. This is achieved by limiting the use of Python's more dynamic features to an initial, boot-strapping phase. This boot-strapping phase is used to construct the final program that is actually executed. Any code which can execute after the boot-strapping phase completes must conform to a be proper subset of Python called RPython, or Restricted Python. RPython is statically-typeable, and cannot modify class or method definitions dynamically; however, it can still take advantage of Python features such as mixins and first-class methods and classes. This paper presents an overview of RPython, including its design and its translation to both CLI and JVM bytecode. We show how the boot-strapping phase can be used to implement advanced features, like extensible classes, and to avoid repetitive code generation, all without support from the base language. We also discuss what work remains before RPython is truly ready for general use, and compare the performance of RPython with that of other approaches. \end{abstract} %A category including the fourth, optional field follows... \category{D.3.4}{Programming Languages}{Processors}[compilers] \category{D.3.2}{Programming Languages}{Language Classifications}[object-oriented languages] \terms{Languages, Performance} \keywords{Python, JVM, .NET} % NOT required for Proceedings \input{macros} \input{intro} \input{rpython-intro} \input{frontend} \input{backend} \input{futureWork} \input{conclusion} \bibliographystyle{abbrv} \bibliography{main} \end{document}