Javascript:SpiderMonkey:ProjectGenerationGarbageCollection: Difference between revisions

Mark as Outdated
(Mark as Outdated)
 
(55 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{outdated}}
<p>Wiki conversion of original Google Document: https://docs.google.com/a/jamsni.com/document/d/1-GZ8F0ZabvdpCnRQaecId0yuu4QFYr5pAvnRC_KFchc/edit
</p>
== Objective ==
== Objective ==
Implement Generational Garbage collection in Spider Monkey. <Some goal based off V8 performance delta % on Earley Boyer benchmark>
<p>Implement Generational Garbage collection in Spider Monkey. &lt;Some goal based off V8 performance delta&#160;% on Earley Boyer benchmark&gt;</p>
<b>Accountable</b>: Naveed<br />
<b>Responsible</b>: Terrence, Steve, Jon, Nicholas, evilpie and Ms2ger<br />
<b>Consulted</b>: bhackett billm<br />
<b>Informed</b>: Product Marketing<br />
<br/>
<b>Tracking Bug:</b> [meta] Implement generational garbage collection - <span class="fck_mw_template"><span class="fck_mw_template"><span class="fck_mw_template">{{bug|619558}}</span></span></span>


* Accountable: Naveed
== Milestones ==


* Responsible: Terrence, Steve, Jon, Nicholas, and evilpie Ms2ger
=== Endgame schedule ===


* Consulted: bhackett billm
* Burndown of rooting hazards and unsafe references: https://people.mozilla.com/~sfink/analysis
* Burndown of bugs blocking Exact Rooting: [https://metrics.mozilla.com/bugzilla-analysis/Dashboard-FinalBurndown.html#esfilter=%257B%22or%22%3A%255B%0A%09%257B%22term%22%3A%257B%22bug_id%22%3A753203%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A745742%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A773686%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A789551%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A791022%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A906940%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A813244%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A848151%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A831379%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A868799%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A877658%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A884617%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A898220%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A898606%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A791062%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A834909%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A831409%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A898554%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A901731%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A898970%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A864785%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A868483%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A877699%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A898815%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A900144%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A899251%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A899251%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A900998%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A898608%257D%257D,%0A%09%257B%22term%22%3A%257B%22blocked_by%22%3A900713%257D%257D%0A%255D%257D&forTitle=Exact+Rooting&dueDate=2013-10-22&sampleMin=2013-08-01 https://metrics.mozilla.com/...]


* Informed: Product Marketing
{| class="wikitable"
! Milestone
! Bug
! Old Estimated Date
! Current Estimated Date
! Actual Date
! Nightly Version
|-
| ...
|
|
|
|
|-
| style="background:#def;" | [[RapidRelease/Calendar|Nightly 26 (B2G 1.2) is uplifted to Aurora]]
| style="background:#def;" |
| style="background:#def;" | 2013-09-16
| style="background:#def;" |
| style="background:#def;" |
| style="background:#def;" |
|-
| All unsafe references found by static analysis have been fixed
| [https://bugzilla.mozilla.org/show_bug.cgi?id=898608 898608]
| 2013-09-23
| 2013-10-02
|
| 27
|-
| Static analysis of unsafe references is unhidden on TBPL
| [https://bugzilla.mozilla.org/show_bug.cgi?id=834909 834909]
| 2013-09-25
| 2013-10-03
|
| 27
|-
| All rooting hazards found by static analysis have been fixed
| [https://bugzilla.mozilla.org/show_bug.cgi?id=898606 898606]
| 2013-10-18
| 2013-10-07
|
| 27
|-
| Static analysis of rooting hazards is unhidden on TBPL
| [https://bugzilla.mozilla.org/show_bug.cgi?id=834909 834909]
| 2013-10-22
| 2013-10-08
|
| 27
|-
| style="background:#def;" | [[RapidRelease/Calendar|Nightly 27 is uplifted to Aurora]]
| style="background:#def;" |
| style="background:#def;" | 2013-10-28
| style="background:#def;" |
| style="background:#def;" |
| style="background:#def;" |
|-
| ...
|
|
|
|
| 28
|-
| All GGC crashes found by fuzzers have been fixed
| [https://bugzilla.mozilla.org/show_bug.cgi?id=877471 877471]
| 2013-11-__
| 2013-10-__
|
| 28
|-
| AWFY with GGC >= AWFY without GGC
| [https://bugzilla.mozilla.org/show_bug.cgi?id=875863 875863]
| 2013-11-__
|
|
| 28
|-
| GGC is enabled for desktop and Android
| [https://bugzilla.mozilla.org/show_bug.cgi?id=619558 619558]
| 2013-11-__
|
|
| 28
|-
| GGC is enabled for B2G 1.3
| [https://bugzilla.mozilla.org/show_bug.cgi?id=619558 619558]
| 2013-11-__
|
|
| 28
|-
| ...
|
|
|
|
| 28
|-
| style="background:#def;" | [[RapidRelease/Calendar|Nightly 28 (B2G 1.3) is uplifted to Aurora]]
| style="background:#def;" |
| style="background:#def;" | 2013-12-09
| style="background:#def;" |
| style="background:#def;" |
| style="background:#def;" |
|-
| ...
|
|
|
|
| 29
|-
| style="background:#def;" | [[RapidRelease/Calendar|Nightly 29 is uplifted to Aurora]]
| style="background:#def;" |
| style="background:#def;" | 2014-01-20
| style="background:#def;" |
| style="background:#def;" |
| style="background:#def;" |
|-
| ...
|
|
|
|
| 30
|}


Generational GC - [https://bugzilla.mozilla.org/show_bug.cgi?id=619558 Bug 619558]
=== Original schedule ===


<h2> Steps </h2>
{| class="wikitable"
<ol>
! Milestone
<li>Exact Rooting done in JS Shell &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=753203"&gt;Bug 753203&lt;/a&gt; - 12 weeks started
! Task
<ol>
! Deliverable
<li>Rooting Analysis on TinderBox (sfink) - 3 weeks
! Assigned
<ol>
! Estimated Weeks
<li>patch is ready for review, would fix the problem with some pushes not getting builds
! Expected Date
<li>fix up other stuff broken by above change
! Actual Date
<li>fix up other stuff broken by above change
|-
<li>patch would fix last remaining problem with getting it on Try server
| 1
<li>Unhide it for inbound - keep it green
| Rooting analysis in the shell (x64)
</ol>
| green on mozilla-inbound
</ol>
| sfink, jonco, evilpie, Ms2ger
</ol>
| 2
<p><br />
| 3/7/2013
</p>
| 3/2/2013
<p>Exact Rooting done in JS Shell &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=753203"&gt;Bug 753203&lt;/a&gt; - 12 weeks started
|-
</p><p>Rooting Analysis on TinderBox (sfink) - 3 weeks
| 2
</p><p>patch is ready for review, would fix the problem with some pushes not getting builds
| Rooting analysis in the shell (arm)
</p><p>fix up other stuff broken by above change
| green on mozilla-inbound
</p><p>patch would fix last remaining problem with getting it on Try server
| sfink
</p><p>Unhide it for inbound - keep it green
| 2
</p><p>Get the root analysis build green - two weeks?
|
</p><p>Get jit-tests green &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=745742"&gt;Bug 745742&lt;/a&gt; - 2 days
| pending
</p><p>Get js ref tests green
|-
</p><p>Get jsapi-tests green &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=831376"&gt;Bug 831376&lt;/a&gt;
| 3
</p><p>Fuzzer coverage of code &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=773746"&gt;Bug 773746&lt;/a&gt;
| Exactly rooted shell (x64)
</p><p>rely on static analysis to make this not be a whack-a-mole game
| green on mozilla-inbound
</p><p>Remove E4X
| sfink, jonco, evilpie, Ms2ger
</p><p>Do something about JSD
| 2
</p><p>Add exact roots to stack structures - 2 weeks
| 3/14/2013
</p><p>AddRoot/RemoveRoot for Heap structures - 4 weeks
| done?
</p><p>Static code analysis &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=831409"&gt;Bug 831409&lt;/a&gt;
|-
</p><p>Fix all discovered rooting hazards (~800) (sfink,jonco) - 4 weeks
| 4
</p><p>Optimize all discovered over-rooting (~100)
| Exactly rooted shell (arm)
</p><p>Automate static analysis (sfink)
| green on mozilla-inbound
</p><p>Need a server (dm-sixgill01?)
| sfink
</p><p>http://people.mozilla.org/~bhackett/rootingHazards.html
| 2
</p><p>http://people.mozilla.org/~bhackett/gcFunctions.html
|
</p><p><br />
| pending
<p>JIT Integration with post barriers - 4 weeks, parallelized
|-
</p>
| 4.1
</p><p>IonMonkey &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=831506"&gt;Bug 831506&lt;/a&gt; - 1 week (bhackett)
| Exactly rooted js/src
</p><p>JaegerMonkey &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=764876"&gt;Bug 764876&lt;/a&gt; - 2 days (bhackett)
| green on mozilla-inbound
</p><p>Baseline JIT &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=831507"&gt;Bug 831507&lt;/a&gt; - &lt;ask jandem/djvj for an estimate&gt;
| jonco
</p><p>Generation Garbage Collection in the Shell
| 3
</p><p>Implement prototype algorithm (terrence) - 1 week
| 5/9/2013
</p><p>This is a potential milestone: we would need to build it and test it on TBPL similar to how |r| works now -- |GGCJS|.
| in progress
</p><p>Exactly Root the Browser &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=831379"&gt;Bug 831379&lt;/a&gt; - 10 weeks
|-
</p><p>This is a potential milestone: we would turn on exact rooting for release FF at this point. We would not get a performance boost from this (necessarily), but it would lock in our work to this point.
| 5
</p><p>Performance Tuning - 4 weeks (This should probably start asap)
| GGC no-jit shell only build on TBPL (x64)
</p><p>Test against V8 Earley-Boyer benchmark.
| green on mozilla-inbound
</p><p>Also v8 deltablue, raytrace
| terrence
</p><p>Implement a Nursery &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=706885"&gt;Bug 706885&lt;/a&gt; - 1 week
| 6
</p><p>We may need to Implement Bill’s Pools/Zones idea to get the nursery to the requisite perf - 6 weeks
| 2/21/2013
</p><p>Refactor code to avoid rooting on hot paths and keep rooter overhead acceptable -&#160;??? weeks (start early) (bhackett)
| 4/7/2013
</p><p>Re-implement HashTable rekeying
|-
</p><p>We undid this code because it was a perf regression and was still a bit buggy. (terrence) - 3 weeks
| 6
</p><p>Make the Post Barrier Verifier Green in the browser &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=764882"&gt;Bug 764882&lt;/a&gt;
| GGC no-jit shell only build on TBPL (arm)
</p><p>Investigate how long it will take to do generational barriers - 1 week
| green on mozilla-inbound
</p><p>We may need to rewrite the maps in xpconnect and the browser in terms of HashTable: this could be a bunch of work.
| sfink, terrence
<p>Make JS_IsAboutToBeFinalized indirect &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=765432"&gt;Bug 765432&lt;/a&gt; - 10 weeks
| 2
</p>
|
| pending
|-
| 7
| JIT support (x64) (Bug 706885)
| TBPL build using JITs and Ion+Baseline+GGC displayed on AWFY
| bhacket
| 8
| 3/15/2013
| 4/7/2013
|-
| 8
| JIT support (arm)
| TBPL build using JITs and Ion+Baseline+GGC displayed on AWFY
| bhacket
| 2
|
| pending
|-
| 9
| Optimized GGC in shell (x64 + arm)
| Ion+GGC faster than Ion-GGC on AWFY
| bhacket
| 12
| 6/1/2013   
| not started
|-
| 10
| Static rooting analysis - browser
| available via mrgiggles and URL
| sfink, bhacket
| 12
| 6/1/2013
| done
|-
| 10.1
| Static analysis on TBPL - browser
| visible on tbpl
| sfink
|
|
| not started           
|-
| 10.2
| Static rooting analysis - b2g
| available via mrgiggles and URL
| sfink
|
|
| pending
|-
| 10.3
| Static analysis on TBPL - b2g
| visible on tbpl
| sfink
|
|
| not started           
|-
| 11
| Exactly rooted browser (x64 + arm)
| green on mozilla-inbound
| sfink, jonco, evilpie, Ms2ger, terrence
| 16
| 7/1/2013   
| in progress
|-
| 12
| GGC in the browser (x64 + arm)
| green on AWFY
| terrence
| 16
| 10/1/2013
| not started
|}
 
== Steps ==
 
=== Exact Rooting done in JS Shell {{bug|753203}} ===
 
<p>12 weeks started
</p>
</p>
<ul><li> Dynamic rooting analysis on tbpl (sfink) - done
<ul><li> Unhidden on inbound</li></ul>
</li><li> Get the root analysis build green - done
<ul><li> Get jit-tests green <span class="fck_mw_template"><span class="fck_mw_template">{{bug|745742}}</span></span>
</li><li> Get js ref tests green
</li><li> Get jsapi-tests green <span class="fck_mw_template"><span class="fck_mw_template">{{bug|831376}}</span></span>
</li></ul>
</li><li> Rooting analysis fuzz bugs <span class="fck_mw_template"><span class="fck_mw_template">{{bug|773746}}</span></span>
<ul><li> Rely on static analysis to make this not be a whack-a-mole game
</li></ul>
</li><li> Remove E4X - done
</li><li> Do something about JSD
</li><li> Add exact roots to stack structures - 2 weeks
</li><li> AddRoot/RemoveRoot for Heap structures - 4 weeks
</li><li> Static code analysis <span class="fck_mw_template"><span class="fck_mw_template">{{bug|831409}}</span></span>
<ul><li> Fix all discovered rooting hazards (~800) (sfink,jonco) - 4 weeks
</li><li> Optimize all discovered over-rooting (~100)
</li><li> Automate static analysis <span class="fck_mw_template"><span class="fck_mw_template">{{bug|834912}}</span></span> - done (sfink)
</li><li> http://people.mozilla.org/~sfink/analysis/browser/rootingHazards.txt
</li><li> http://people.mozilla.org/~sfink/analysis/browser/gcFunctions.txt
</li><li> http://people.mozilla.org/~sfink/analysis/browser/allFunctions.txt
</li></ul>
</li></ul>
=== JIT Integration with post barriers - 4 weeks, parallelized ===


== Other ==
<ul><li> IonMonkey <span class="fck_mw_template"><span class="fck_mw_template">{{bug|831506}}</span></span> - 1 week (bhackett)
</li><li> JaegerMonkey <span class="fck_mw_template"><span class="fck_mw_template">{{bug|764876}}</span></span> - 2 days (bhackett)
</li><li> Baseline JIT <span class="fck_mw_template"><span class="fck_mw_template">{{bug|831507}}</span></span> - &lt;ask jandem/djvj for an estimate&gt;
</li></ul>


Should we establish a new  benchmark specifically for GGC. (sfink votes yes)
=== Generational Garbage Collection in the Shell ===


What would it measure? there are multiple goals, e.g. throughput/MMU/pause time
<ul><li> Implement prototype algorithm (terrence) - 1 week
</li><li> This is a potential milestone: we would need to build it and test it on TBPL similar to how |r| works now -- |GGCJS| - done.
</li><li> Re-implement HashTable rekeying
<ul><li> We undid this code because it was a perf regression and was still a bit buggy. (terrence) - 3 weeks
</li><li> at least part of this is <span class="fck_mw_template"><span class="fck_mw_template">{{bug|726687}}</span></span>
</li></ul>
</li></ul>


Should we make it a public benchmark?
=== Exactly Root the Browser <span class="fck_mw_template"><span class="fck_mw_template">{{bug|831379}}</span></span> - 10 weeks ===


What workloads should we consider?
<ul><li> This is a potential milestone: we would turn on exact rooting for release FF at this point. We would not get a performance boost from this (necessarily), but it would lock in our work to this point.
</li></ul>


compartmental GC very important to us, not necessarily applicable to other implementations
=== Performance Tuning - 4 weeks (This should probably start asap) ===
allocation rate (broken down into live vs garbage), steady behavior vs swapping between allocation + computation modes, etc.


How can we keep our advantage on Splay benchmark
<ul><li> Implement a Nursery <span class="fck_mw_template"><span class="fck_mw_template">{{bug|706885}}</span></span> - 1 week
possible to do with TI --- look at types of objects promoted from nursery to major heap, eventually start allocating them directly in the major heap
</li><li> Test against V8 Earley-Boyer benchmark.
<ul><li> Also v8 deltablue, raytrace
</li></ul>
</li><li> We may need to Implement Bill’s Pools/Zones idea to get the nursery to the requisite perf <span class="fck_mw_template"><span class="fck_mw_template">{{bug|759585}}</span></span> - 6 weeks - done
</li><li> Refactor code to avoid rooting on hot paths and keep rooter overhead acceptable <span class="fck_mw_template"><span class="fck_mw_template">{{bug|831886}}</span></span> (bhackett) - done
</li></ul>


Compacting GC - Revisit in Febuary/March - 1 Month
=== Make the Post Barrier Verifier Green in the browser <span class="fck_mw_template"><span class="fck_mw_template">{{bug|764882}}</span></span> ===
Delayed until exact rooting is fully done. We can add this in if we have time in the schedule that we cannot parallelize.


== Risks ==
<ul><li> Investigate how long it will take to do generational barriers - 1 week
</li><li> We may need to rewrite the maps in xpconnect and the browser in terms of HashTable: this could be a bunch of work.
</li><li> Make JS_IsAboutToBeFinalized indirect <span class="fck_mw_template"><span class="fck_mw_template">{{bug|765432}}</span></span> - 10 weeks
</li></ul>


* Team is responsible for many top crashers
== Other ==


* External rooting API has not been designed
<ul><li> Should we establish a new benchmark specifically for GGC. (sfink votes yes)
<ul><li> What would it measure? there are multiple goals, e.g. throughput/MMU/pause time
</li><li> Should we make it a public benchmark?
</li><li> What workloads should we consider?
</li><li> compartmental GC very important to us, not necessarily applicable to other implementations
</li><li> allocation rate (broken down into live vs garbage), steady behavior vs swapping between allocation + computation modes, etc.
</li></ul>
</li></ul>
<ul><li> How can we keep our advantage on Splay benchmark
<ul><li> possible to do with TI --- look at types of objects promoted from nursery to major heap, eventually start allocating them directly in the major heap
</li></ul>
</li></ul>
<ul><li> Compacting GC - Revisit in Febuary/March - 1 Month
<ul><li> Delayed until exact rooting is fully done. We can add this in if we have time in the schedule that we cannot parallelize.
</li></ul>
</li></ul>


* GGC algorithm has not been decided on - it may not be faster
== Risks ==


* JSD1 exact rooting is lurking
<ul>
<li> Team is responsible for many top crashers</li>
<li> External rooting API has not been designed</li>
<li> GGC algorithm has not been decided on - it may not be faster</li>
<li> JSD1 exact rooting is lurking</li>
</ul>
52

edits