wdv4758h/mu-client-pypy


unofficial mirror of https://gitlab.anu.edu.au/mu/mu-client-pypy

License: Other

Language: Python


PyPy-Mu: A Mu Backend for PyPy

Welcome to PyPy-Mu!

PyPy-Mu is a fork of PyPy that aims to add a Mu Micro Virtual Machine backend for it.

This project is currently under active development, right now we can compile PyPy interpreter with --no-allworkingmodules option.

Building

Obtaining a Mu implementation

The reference implementation for Mu can be found here. Build the Mu implementation, make sure to build the C binding as well.

Compiling some RPython C backend support source code

Currently the Mu backend still requires some support from the C backend function implementations. We thus build them into a shared library that's loaded by the Mu RPython client launcher.

$ cd rpython/translator/mu/rpyc
$ make

This will produce the shared library librpyc.so.

Setting up environment variable

  • Set up an environment variable $MU to point to the cloned Mu MicroVM repository.
$ export MU=$REPOS/microvm-refimpl2
  • Make an alias for the client launcher, adding Python binding and C binding to environment varible:
$ alias murpy="PYTHONPATH=$MU/pythonbinding:$PYTHONPATH LD_LIBRARY_PATH=$MU/cbinding:$LD_LIBRARY_PATH python $PYPY_MU/rpython/mucli/murpy.py"

Compiling & Executing RPython Target

Specify -b mu option to compile using the Mu backend:

$ rpython/bin/rpython -b mu <target>

This outputs a <target>-mu.mu file in the current directory. This is a zipped bundle of the IR, HAIL and external function list files.

Use murpy to load and run the compiled bundle program:

$ murpy --noSourceInfo --vmLog=ERROR <target>-mu.mu

Note the default Mu code generation backend is textform which is going to be deprecated. To use the API backend (which is currently under mu-benchmarks/apicodegen branches), do:

$ PYTHONPATH=$MU/tools pypy rpython/bin/rpython -b mu --mugen=api <target>

Note that this backend depends on $MU/tools/mar.py, PYTHONPATH variable needs to be set. This will start up a Mu instance, build a bundle in Mu via API calls, and dump a boot image. To run the dumped boot image, use the runmu.sh provided by the reference implementation.

$ $MU/tools/runmu.sh <mu-flags> <bootimage> <program-args>

Why not try compiling the PyPy interpreter (currently with some limitations)?

$ rpython -O2 -b mu pypy/goal/targetpypystandalone.py --no-allworkingmodules
$ murpy --noSourceInfo --vmLog=ERROR --sosSize=780M --losSize=780M pypy-mu.mu

Project Statistics

Sourcerank 3
Repository Size 90.9 MB
Stars 0
Forks 0
Watchers 2
Open issues 0
Dependencies 0
Contributors 168
Tags 31
Created
Last updated
Last pushed

Top Contributors See all

Armin Rigo Maciej Fijalkowski Carl Friedrich Bolz-Tereick Antonio Cuni Amaury Forgeot d'Arc Matti Picus Alex Gaynor Samuele Pedroni Brian Kearns Michael Hudson-Doyle Ronan Lamy Christian Tismer-Sperling David Schneider holger krekel Håkan Ardö Benjamin Peterson Richard Plangger Eric van Riet Paap wlav Anders Chrigström

Recent Tags See all

apicodegen-muapiref-e4b223c August 23, 2016
mu-benchmarks-withmod-struct August 05, 2016
pypy-mu-pypyinterp-minimal July 21, 2016
rpylibmu-v1.0 July 01, 2016
release-pypy2.7-v5.3.1 June 14, 2016
release-pypy2.7-v5.3 June 07, 2016
release-pypy3.3-v5.2 May 29, 2016
release-5.1.2 May 16, 2016
release-5.1.1 April 24, 2016
release-5.1 April 19, 2016
release-5.0.1 March 18, 2016
release-5.0 March 09, 2016
release-4.0.1 November 17, 2015
release-4.0.0 October 26, 2015
release-2.6.1 August 28, 2015

Something wrong with this page? Make a suggestion

Last synced: 2024-07-22 09:59:03 UTC

Login to resync this repository