JavaScript:ActionMonkey: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 17: Line 17:
== Stage 0 ==
== Stage 0 ==


Replace SpiderMonkey's GC with Tamarin's GC (MMgc).
Replace SpiderMonkey's GC with Tamarin's GC (MMgc). See [[JavaScript:ActionMonkey:Stage 0 Whiteboard]].
[https://bugzilla.mozilla.org/show_bug.cgi?id=387012 Bug 387012] – ActionMonkey stage 0 tracking bug


Details:
Work is underway in the http://hg.mozilla.org/actionmonkey and http://hg.mozilla.org/actionmonkey-tamarin [[Mercurial]] repositories.  (The actionmonkey repo is a hard hat area, one step removed from the primary mozilla-central repository.  This is because we expect things will break intermittently.  Also because some of the people working on this aren't CVS committers yet, myself included.  -jorendorff)
* The plan is to hollow out jsgc.c and replace it with a new implementation based on MMgc.  The API in jsgc.h will be preserved.
* We'll use MMgc in non-incremental mode to start with.  (It's easier.  Avoid premature optimization.)
* We'll build SpiderMonkey as C++, and some key types (<code>JSObject</code>, <code>JSString</code>) will become classes.  This is unavoidable because MMgc's API for finalization is to subclass <code>MMgc::GCFinalizedObject</code>.
 
More details:  [[JavaScript:ActionMonkey:Stage 0 Whiteboard]]
 
Steps:
* Convince the SpiderMonkey and Tamarin build systems to cooperate.
* Change the few places where SpiderMonkey is directly using stdlib <code>malloc()</code> (<code>malloc</code>, <code>free</code>, <code>realloc</code>, <code>calloc</code>, <code>strdup</code>, etc.) to use a new internal API (lowercase <code>js_malloc</code>).
** brendan: Hope these can all be macro-defined.
* Team hacking session to reimplement jsgc.c.
 
Notes on the jsgc.h API:
* Tracing API.  (This is used by the cycle collector.)
* API for tracing private data.  (DOM objects use this to participate in GC.)
* Rooting API.  (No sweat - this can be implemented in terms of <code>MMgc::GCRoot</code>.)
* Object pinning API.  (Same here.)
* <code>JS_IsAboutToBeFinalized()</code> needs to be implemented for MMgc.
* <code>JS_AddExternalStringFinalizer()</code> and friends. (We can probably implement these in terms of <code>MMgc::GCFinalizedObject</code>.)
 
Other notes:
* XPConnect garbage-collects <code>XPCWrapNative</code> objects and its own data structures.  This needs some more research.  (Brendan thinks this won't affect stage 0 work.)
 
We will, for the moment, lose one thing: the threading model where a single <code>JSRuntime</code> has multiple threads, each with its own <code>JSContext</code>.  (Firefox doesn't use this.)
 
During this stage, work will be done in the http://hg.mozilla.org/actionmonkey [[Mercurial]] repository.  (This repo is a hard hat area, one step removed from the primary mozilla-central repository.  This is because we expect things will break intermittently.  Also because some of the people working on this aren't CVS committers yet, myself included.  -jorendorff)


== Stage 1 ==
== Stage 1 ==


More to come.
More to come.

Revision as of 13:54, 16 July 2007

ActionMonkey is the code-name for the project to integrate Tamarin and SpiderMonkey as part of Mozilla 2.

Want to help? Write to jason dot orendorff at gmail dot com. Or visit irc://irc.mozilla.org/jslang and say hi.

Goals

The goals are:

  • Preservation (with necessary additions and as few deletions as possible) of jsapi.h.
  • SpiderMonkey's thread safety and property tree integrated/reimplemented in Tamarin.
  • Replacement of SpiderMonkey's decompiler with a better decompiler that can work with ABC.
  • Replacement of SpiderMonkey's GC with Tamarin:MMgc, evolved as needed.
  • Replacement of SpiderMonkey's interpreter by an evolved version of Tamarin's.
  • Advanced JIT optimization for hot paths and untyped code, inspired by Trace Trees.
  • Information flow VM support for better security models.

Stage 0

Replace SpiderMonkey's GC with Tamarin's GC (MMgc). See JavaScript:ActionMonkey:Stage 0 Whiteboard.

Work is underway in the http://hg.mozilla.org/actionmonkey and http://hg.mozilla.org/actionmonkey-tamarin Mercurial repositories. (The actionmonkey repo is a hard hat area, one step removed from the primary mozilla-central repository. This is because we expect things will break intermittently. Also because some of the people working on this aren't CVS committers yet, myself included. -jorendorff)

Stage 1

More to come.