Informal reading list for Ra, the R just-in-time compiler

Some of the references here are of only peripheral relevance.

Back to Ra homepage

R specific

Tierney, Venables post 4 May 2008 Comments on R speedups
Ihaka 1998 R Past and Future History The Future
Tierney 2001 Compiling R: A Preliminary Report
Tierney Notes on compilation in R
Tierney Notes on the Generational GC for R
Ogranovich post When can we expect Prof Tierney's compiled R
Warnes Moreira RPy (calling R from Python)
Lang RSPython (calling R from Python)
Skylar, Murdoch, Smith inline package inline C C++ Fortran in R 2007
Skylar, Murdoch, Smith inline package
FortranCallsR package (defunct?)
Calder Scompile (compile S to C)
Urbanek R2c experimental package for compiling a subset of R
Urbanek rJava a simple R-to-Java interface
Samperi RcppTemplate R/C++ interface library, people who use it seem to like it
Runnalls CXXR port of the R interpreter to C++
Corlans R2cl experimental R to Lisp translator
Ihaka post assignment scoping in R 1996 (variable declarations in R, follow thread too)
Tierney post frames in R and S 1996 (early post on disadvantages of allowing users access to frames, follow thread too)

Threaded and stack code

Wikipedia Threaded code
Wikipedia Forth

Ertl Threaded Code tutorial good intro to threaded code

Ertl Forth Research (good Forth links)
Ertl A Portable Forth Engine.
Ertl Stack Caching for Interpreters benefits of keeping part of the stack in real machine registers

Ertl Compilation of Stack-Based Languages 1999 (with links)

Piumarta Optimizing Direct Threaded Code By Selective Inlining 1998 R's existing bytecode interpreter uses techniques from this paper

Miranda post Portable Fast Direct Threaded Code 1991
Miranda post Framed Stack vs. Two Stack Architecture 2006, one stack is faster
Labels as values in gcc also called first-class-labels, used in fast threaded code


Wikipedia Static single assignment form
Wikipedia Duck_typing
Wikipedia Partial evaluation
Wikipedia Continuation-passing style
Fogg Software Optimization Resources for Intel and AMD good docs on writing fast code
Polleto and Sarkar Linear Scan Register Allocation allocating registers quickly

Dynamic code generation

Techniques and tools for generating code while a progam is running.

Wikipedia Just-in-time compilation
Engler VCODE: A Retargetable, Extensible, Very Fast Dynamic Code Generation System
Auslander et al Fast, Effective Dynamic Compilation
Noel et al Automatic, Template-Based Run-Time Specialization: Implementation and Experimental Study
c-- portable assembly language
Weatherly and Demakov libjit
Piumarata ccg dynamic code generation for C and C++
Piumarata The Virtual Processor architecture neutral dynamic code gen
Bonzini GNU lightning based on ccg
Miranda BrouHaHa - A portable Smalltalk interpreter
LLVM Low Level Virtual Machine compiler infrastructure

Languages with some similar compilation issues

Languages like R with type determined at run time are more difficult to implement efficiently.

Wikipedia Ungar Smith Self Programming language pioneered many JIT techniques
Holzle Ungar A third-generation Self implementation: Reconciling responsiveness with performance
Ingalls et al Back to the future: the story of Squeak Smalltalk
Matthew Flatt MzScheme compiles Scheme to just-in-time native code
Beazley SWIG mix C with other languages
Sugunama et al Evolution of a Java just-in-time compiler for IA-32 platforms
Starynkevitch OCAMLJIT a just-in-time ocaml implemention
Peyton Jones Implementing lazy functional languages on stock hardware: The Spineless Tagless G-machine an approach that is interesting for its differences to R eval().
Wikipedia Sasada YARV bytecode interpreter for Ruby
Pall LuaJit JIT compiler for Lua


Software to improve Python run-time efficiency.

Wikipedia Ewing Pyrex A Python-like language for writing extension modules
Ewing Pyrex A Python-like language for writing extension modules
Wikipedia Rigo Psyco specializing compiler for Python
Mertz Charming Python Make Python run as fast as C with Psyco
Wikipedia PyPy (python in python, successor to Pysco)
Wikipedia Dufour Shed-skin An Optimizing Python to C++ compiler
Dufour Shed-skin An Optimizing Python to C++ compiler

Garbage collection

Wikipedia Garbage Collection
Henry Baker's Archive of Research Papers
Baker The Treadmill: Real-Time Garbage Collection Without Motion Sickness R's gc uses this
Miranda post Faster reference counting


The following books are of direct relevance to R. See also the standard references: Dragon book, SICP, Muchnick, yacc, and bison docs.

Kamin Programming Languages: An Interpreter-Based Approach 1990 Probably the best way to learn about the R evaluator, apart from the R docs and code itself. The R evaluator appears to be derived from code in this book.

Jones and Lins Garbage Collection: Algorithms for Automatic Dynamic Memory Management 1999 (to understand R's garbage collection).

Back to Ra homepage