|
|
Line 1: |
Line 1: |
| XPCOMGC is the [[Mozilla 2]] project to convert the XPCOM object model from reference counting to use garbage collection. | | XPCOMGC is the [[Mozilla 2]] project to convert the XPCOM object model from reference counting to use garbage collection, and unify with the JS engine memory management. |
|
| |
|
| == General Info == | | == General Info == |
|
| |
|
| Tracking is {{bug|XPCOMGC}}. | | Tracking is {{bug|XPCOMGC}}. |
|
| |
| TODO: collect/format information from the [http://groups.google.com/group/mozilla.dev.tech.xpcom/browse_frm/thread/ed4c1390b5ea97c8/01d69c339743e04c#01d69c339743e04c newsgroup discussion].
| |
|
| |
|
| == Rationale == | | == Rationale == |
Line 35: |
Line 33: |
| '''Interoperability with languages other than C/C++ and JavaScript is not a priority.''' [[mdc:PyXPCOM|Python]] will have to catch up later, if anyone is willing and able to carry it forward. | | '''Interoperability with languages other than C/C++ and JavaScript is not a priority.''' [[mdc:PyXPCOM|Python]] will have to catch up later, if anyone is willing and able to carry it forward. |
|
| |
|
| == Tasks == | | == Building XPCOMGC == |
|
| |
|
| * Add the request model threadsafety to MMgc {{bug|395962}}
| | XPCOMGC work is currently taking place in the following Mercurial repository: http://hg.mozilla.org/users/bsmedberg_mozilla.com/gcmonkey |
| * Give MMgc the ability to recognize "inner" pointers to objects as typically used by C++ multiple inheritance {{bug|388070}}
| |
| * Make the world depend on a common MMgc
| |
| * Rewrite XPCOM addref/release handling
| |
| ** Remove the cycle collector
| |
| ** Use textual search/replace to remove most calls to NS_ADDREF/NS_RELEASE
| |
| ** Use automatic finding to identify remaining references for manual cleanup
| |
| ** [[XPCOMGC/GCObject Inheritance|Make all COM objects inherit from GCObject]]
| |
| ** [[XPCOMGC/nsCOMPtr rewrite|Rewrite nsCOMPtr+friends to be a lightweight wrapper for GC writebarriers]]
| |
| ** [[XPCOMGC/Stack Pointers|Make stack pointers raw pointers]]
| |
| ** Fix some COM-holding utility classes:
| |
| *** nsCOMArray
| |
| *** hashtables: nsInterfaceHashtable and nsInterfaceHashKey
| |
| ** Rewrite XPCOM weakrefs to be GCWeakRefs
| |
| *** And remove those that can be regular GC references
| |
| * Identify and deal with multi-threading, especially
| |
| ** Initialize and suspend requests around blocking activity
| |
| ** Analyze code for deadlock possibilities.
| |
| * [[XPCOMGC/Static Checker|Set up a static checker based on GCC to enforce common invariants]]
| |
|
| |
|
| == Building XPCOMGC ==
| | It is being maintained as a linear sets of changes on top of mozilla-central, rebased relatively frequently. Thus you will see old heads in the repository, and can ignore them (they are dead heads, though Mercurial doesn't have a way to notate that). |
|
| |
|
| The XPCOMGC work is currently taking place in mercurial patch queues on top of the ActionMonkey repositories. Follow the instructions below to build:
| | == Current Status == |
|
| |
|
| <pre>~ $ builddir=/builds/xpcomgc
| | * The build only works on Linux |
| ~ $ cd $builddir
| | * Boehm is inserted as a replacement for the C allocator malloc/free |
| /builds/xpcomgc $ hg clone http://hg.mozilla.org/actionmonkey/ src
| | * malloc/free allocations are treated as "uncollectable". That is, they are scanned for pointers but are not subject to being freed by the collector |
| /builds/xpcomgc $ cd src | | * XPCOM string buffers (nsStringBuffer) have been made collectable. They are no longer refcounted, but instead are made immutable-on-share |
| /builds/xpcomgc/src $ hg clone http://hg.mozilla.org/users/bsmedberg_mozilla.com/xpcomgc-patches/ .hg/patches
| | * The build runs and seems to perform "ok"... still trying to get quantified performance numbers |
| /builds/xpcomgc/src $ head .hg/patches/series
| | * Memory usage is 50-100% worse than using the jemalloc allocator |
| # Currently based against actionmonkey revision AA112233
| |
| /builds/xpcomgc/src $ hg up AA112233
| |
| /builds/xpcomgc/src $ hg qpush -a
| |
| /builds/xpcomgc/src $ hg clone http://hg.mozilla.org/actionmonkey-tamarin js/tamarin
| |
| /builds/xpcomgc/src/js/tamarin $ cd js/tamarin
| |
| /builds/xpcomgc/src/js/tamarin $ hg clone http://hg.mozilla.org/users/bsmedberg_mozilla.com/xpcomgc-tamarin-patches .hg/patches
| |
| /builds/xpcomgc/src/js/tamarin $ head .hg/patches/series
| |
| # Currently based against actionmonkey-tamarin revision BB445566
| |
| /builds/xpcomgc/src/js/tamarin $ hg up BB445566
| |
| /builds/xpcomgc/src/js/tamarin $ cd $builddir/src
| |
| /builds/xpcomgc/src $ python client.py checkout --skip-mozilla --skip-tamarin
| |
| /builds/xpcomgc/src $ autoconf-2.13
| |
| </pre>
| |
|
| |
|
| This will get you to a state before automatic patching occurs. This tree should build correctly, if you pass <tt>WARNINGS_AS_ERRORS=</tt> on the make command line. You can generate and apply the automatic patches using the script:
| | == Old Information == |
|
| |
|
| python /builds/xpcomgc/src/.hg/patches/generate-automatic-patches.py
| | A previous attempt at this project was made using the MMgc convervative collector. Because this collector requires programmatic write barriers, and for other reasons, this attempt was abandoned (though we learned a lot!) |
|
| |
|
| You will need the [[Static Analysis/Installing the Oink Stack|oink stack and pork-barrel]] installed, and you will need to create an <tt>xpcomgclocalpaths.py</tt> file with your local paths, as documented in generate-automatic-patches.py
| | TODO: collect/format information from the [http://groups.google.com/group/mozilla.dev.tech.xpcom/browse_frm/thread/ed4c1390b5ea97c8/01d69c339743e04c#01d69c339743e04c newsgroup discussion]. |