MPS issue job001092

TitleMPS is not integrated with public cool projects.
Assigned userGareth Rees
DescriptionAlthough the MPS works well in some commercial and open source settings,
it isn't very visible in popular projects.

The MPS needs to be deployed as a memory manager and integrated
into some cool projects.

This is to:

- Raise awareness of the MPS.

- Make the MPS flexible (can be used in many different

- Prove that that MPS is flexible.

So that:

- The industry is improved by knowing about and using the MPS

- Ravenbrook can attract MPS licensees.
AnalysisSome cool projects into which the MPS could possibly be

Java, Parrot, Lua, perl, Python, Kaffe, SIOD, Objective-C, C--,
PTL Scheme (see [10]).

Recently (to 2007-02-20) we have also been investigating
SC (rb's pet scheme compiler) and CMUCL.

Cost factors:

- availability of source code.
- documentation for source code.
- niceness of source code.
- suitability of project for slottable memory manager.


Java would be maximally cool, source code is generally
available, try
We wouldn't be able to distribute this source, but
we would be able to use it for an internal integration.
(The source used to be not so readily available, but
times have changed).

Parrot is cool.

Lua is cool but obscure. Is gaining ground in the games
industry (which is a cool sector).

perl and Python are cool.

Kaffe is cool but not making much noise these days.

SIOD is only cool to schemers and lispers. Sorry.

Objective C is in Mac OS X so is cool by association.

C-- is a bit unkown to DRJ.


Is it still used? Not much sign of life since 1996.

Sounds like (from reading [7]) that integration would be
fairly easy. The existing stop-and-copy GC is about 40
lines long. Advantage of MPS: incremental.

Possible advantages are that we could get an integration
done in a very small time and that would give us valuable
experience in doing integrations and would help RichardK.

Also any experience in doing any integration would, if
documented, go towards the creation of the Integrator's


Lua 5.1 has an incremental GC. This version of Lua is now
generally available.

DRJ's expertise in Lua is mostly with 4.x. Will need to
look at 5.x source code to see how much has changed.

Lua 5 has weak tables. Weak key, weak value, or weak both.
User selectable in a slightly horrid way (see ), but it
does make sense from the Lua programmer's perspective. I
think this might be an issue in the integration. Naively
it seems that the weakness (rank) of table T depends on an
object (a string) referenced from T's metatable M. However,
the restrictions on the metatable mean that a table's
weakness is set from one invocation of setmetatable to the
next. This is still a bit boggling.

GDR had a go (starting with no knowledge of the MPS) at replacing Lua's own mark-and-sweep GC with the MPS in 2012-09 and got more or less everything working except finalization and weak hash tables [13] [14] [15] [16] [17] [18] [19] [20] [21] [22]. Performance was not so good. The weak hash tables would be a problem. Code leftover from this work is in //


You ought to know that PMC stands for Parrot Magic Cookie.
I think this is an allocated object with an abstracted
interface, but it's a bit hard to tell. reveals
a mark vtable method. This seems to be like our object
scan method. Except that there is no callback to call.

src/malloc.c is a copy of Doug Lea malloc. Or started out
that way. (red herring).

This Parrot Design Document seems useful:


As seen in Mac OS X. These days I think everyone thinks
of Mac OS X when they think of Objective-C. See [8].

Cocoa uses reference counting, see [8]/The Runtime System/Memory
Management. Reference counting is manual, that is the Cocoa
programmer must write explicit method calls to manage the
reference count. The methods are "retain", "release", and
"autorelease". I find the exact semantics difficult to pin


Runtime source:

RB says: ObjC new object calls _alloc calls
_internal_class_createInstanceFromZone calls malloc!


See Goran's war story [9]


Built-in support for interfacing with garbage collectors. See [24].


Mono ships with two garbage collectors (a generational collector, and Boehm-Weiser conservative collector) which is not a very promising sign. See Wikipedia for some analysis. [23]

2007-04-12 DRJ:

See some general integration notes (what to think about when
integrating): [12]
How foundunknown
[9] //
[10] //
[12] //
[13] <>
[14] <>
[15] <>
[16] <>
[17] <>
[18] <>
[19] <>
[20] <>
[21] <>
[22] <>
[23] <>
[24] <>
Observed in1.100.0
Created byDavid Jones
Created on2004-12-10 15:58:38
Last modified byGareth Rees
Last modified on2016-09-13 10:37:40
History2004-12-10 DRJ Created and some analysis.
2006-04-19 DRJ Now available: Lua 5.1, Java source.
2007-02-20 DRJ Note about SC and CMUCL
2007-04-12 DRJ Notes about integration notes
2012-10-25 GDR Added notes about Lua/MPS integration; LLVM; Mono.
2013-03-19 GDR Assigned to GDR.