MPS issue job001092

TitleMPS is not integrated with public cool projects.
Statusopen
Priorityoptional
Assigned userGareth Rees
OrganizationRavenbrook
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
scenarios).

- 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
integrated:

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.

Coolness:

Java would be maximally cool, source code is generally
available, try
http://www.sun.com/software/communitysource/j2se/java2/download.xml
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.


SIOD:

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
Manual.


Lua:

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
http://www.lua.org/manual/5.0/manual.html#2.9.2 ), 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 //info.ravenbrook.com/user/gdr/project/luamps/...


Parrot:

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.

http://www.parrotcode.org/docs/pdd/pdd02_vtables.html 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:
http://www.parrotcode.org/docs/pdd/pdd09_gc.html


Objective-C:

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
down.

See http://www.macdevcenter.com/lpt/a/2418

Runtime source:
http://cvs.opendarwin.org/index.cgi/src/objc4/runtime/

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


Java:

See Goran's war story [9]


LLVM

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


Mono

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
Evidence[1] http://www.parrotcode.org/
[2] http://www.lua.org/
[3] http://www.perl.com/
[4] http://www.python.org/
[5] http://www.kaffe.org/
[6] http://wwws.sun.com/software/java/
[7] http://www.cs.indiana.edu/scheme-repository/imp/siod.html
[8] http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/
[9] //info.ravenbrook.com/mail/2004/09/06/09-11-16/0.txt
[10] //info.ravenbrook.com/mail/2004/12/17/00-34-42/0.txt
[11] http://www.plt-scheme.org/
[12] //info.ravenbrook.com/mail/2007/03/30/14-07-30/0.txt
[13] <https://info.ravenbrook.com/mail/2012/09/19/16-54-01/0/>
[14] <http://info.ravenbrook.com/mail/2012/09/20/16-06-48/0/>
[15] <http://info.ravenbrook.com/mail/2012/09/21/14-58-15/0/>
[16] <https://info.ravenbrook.com/mail/2012/09/27/18-07-06/0/>
[17] <https://info.ravenbrook.com/mail/2012/09/28/17-12-07/0/>
[18] <https://info.ravenbrook.com/mail/2012/10/03/08-29-14/0/>
[19] <https://info.ravenbrook.com/mail/2012/10/03/16-35-24/0/>
[20] <https://info.ravenbrook.com/mail/2012/10/04/17-38-59/0/>
[21] <https://info.ravenbrook.com/mail/2012/10/07/22-17-57/0/>
[22] <https://info.ravenbrook.com/mail/2012/10/08/18-55-13/0/>
[23] <http://en.wikipedia.org/wiki/Mono_(software)#Garbage_collector>
[24] <http://llvm.org/docs/GarbageCollection.html>
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.