PyPy's VM Approach

Authors: Armin Rigo
Samuele Pedroni
Date: 23 October 2006 / 24 October 2006
Location:DLS'06 OOPSLA Portland OR / Intel Hillsboro OR

PyPy

VMs are still hard

It is hard to achieve:

Especially with limited resources.

Python Case

CPython is a straightforward, portable VM.

Python Case (ii)

PyPy's approach

Goal: generate VMs from a single high-level description of the language, in a retargettable way.

Mapping to low-level targets

Status of the project

Fully compliant interpreter, translatable to C, LLVM and the CLR.

Translation approach

Translation overview


image/arch2.png

Type Inference

Targets as Type Systems

STR = GcStruct('rpy_string',
                  ('hash', Signed),
                  ('chars', Array(Char)))

Targets as Type Systems (ii)

Targets as Type Systems (iii)

Translation Aspects

Features not present in the source can be added during translation:

Translation Aspects (ii)

Translation Summary

The translation tool-chain has proved effective:

Website etc.

Run-time Specialization

Previous experience: Psyco

A Specializer as an Aspect

General idea (the devil is in the details):

This is what we are working on right now.

JIT Generation Diagram

image/arch-jit-gen.png

Translation Diagram

image/arch-translation.png

Self-hosted JITs

Target platform VMs (JVM, CLR)

Open Virtual Machines

Reconfigurable at run time to run specific languages.

GC Pressure

RPython is still a garbage collected language.

Large allocation rate from interpreter objects (boxes, frames) but easily temporary objects too.

Good allocation removal optimizations and memory management very much needed.