JavaScript:ActionMonkey: Difference between revisions
Jump to navigation
Jump to search
(→Stage 0: add real plans) |
|||
Line 18: | Line 18: | ||
* Either get SpiderMonkey to build as C++, or write a C wrapper for MMgc. | * Either get SpiderMonkey to build as C++, or write a C wrapper for MMgc. | ||
* Convince the SpiderMonkey and Tamarin build systems to cooperate. | * Convince the SpiderMonkey and Tamarin build systems to cooperate. | ||
* | * Change the few places where SpiderMonkey is directly using malloc() and free() to use a new internal API (lowercase <code>js_malloc</code>). | ||
* | |||
* | Retain as many JSAPI functions as possible: | ||
* | * Tracing API. This is used by the cycle collector. | ||
* API for tracing private data. DOM objects use this to participate in GC. | |||
* Rooting API. This can be implemented in terms of <code>MMgc::GCRoot</code>. | |||
* Object pinning API. Same here. | |||
* XPConnect garbage-collects <code>XPCWrapNative</code> objects and its own data structures. This needs some more research. | |||
* <code>JS_IsAboutToBeFinalized()</code> needs to be implemented for MMgc. | |||
* <code>JS_AddExternalStringFinalizer()</code> needs to be implemented, probably using <code>MMgc::GCFinalizedObject</code>. | |||
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>. | |||
Modify stuff that is not using the JSAPI but is cheating: | |||
* Change the XPCOM cycle collector (crash of thunder) to use a separate trace phase instead of depending on the SpiderMonkey GC mark phase to generate certain information it needs for cycle detection. | |||
At the end of this stage, the work will show up somewhere on hg.mozilla.org (TBD); for now jorendorff is working in a fork of hg.mozilla.org/mozilla-central. | At the end of this stage, the work will show up somewhere on hg.mozilla.org (TBD); for now jorendorff is working in a fork of hg.mozilla.org/mozilla-central. |
Revision as of 00:26, 28 June 2007
Intro
ActionMonkey is the code-name for the project to integrate Tamarin and SpiderMonkey as part of Mozilla 2. 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).
- Use MMgc in non-incremental mode to start with. (It's easier. Avoid premature optimization.)
- Either get SpiderMonkey to build as C++, or write a C wrapper for MMgc.
- Convince the SpiderMonkey and Tamarin build systems to cooperate.
- Change the few places where SpiderMonkey is directly using malloc() and free() to use a new internal API (lowercase
js_malloc
).
Retain as many JSAPI functions as possible:
- Tracing API. This is used by the cycle collector.
- API for tracing private data. DOM objects use this to participate in GC.
- Rooting API. This can be implemented in terms of
MMgc::GCRoot
. - Object pinning API. Same here.
- XPConnect garbage-collects
XPCWrapNative
objects and its own data structures. This needs some more research. JS_IsAboutToBeFinalized()
needs to be implemented for MMgc.JS_AddExternalStringFinalizer()
needs to be implemented, probably usingMMgc::GCFinalizedObject
.
We will, for the moment, lose one thing: the threading model where a single JSRuntime
has multiple threads, each with its own JSContext
.
Modify stuff that is not using the JSAPI but is cheating:
- Change the XPCOM cycle collector (crash of thunder) to use a separate trace phase instead of depending on the SpiderMonkey GC mark phase to generate certain information it needs for cycle detection.
At the end of this stage, the work will show up somewhere on hg.mozilla.org (TBD); for now jorendorff is working in a fork of hg.mozilla.org/mozilla-central.