Javascript:Hazard Builds
Goal
The goal of this project is to know the exact locations of all GC Cell pointers stored on the stack. This will enable further development of compacting and generational GC modes.
Dynamic Rooting Analysis
Since a failure to root a stack variable properly will become a use-after-free error after we have moving GC's, it is vitally important that we catch and fix all rooting violations now, rather than later. To this end, we have enabled a dynamic correctness checker that runs on every push to mozilla-inbound. It verifies that no stack pointers are left unrooted.
Style Guidelines: Outside SpiderMonkey
Now that SpiderMonkey allows C++ in its official API, we are working towards a fully type-protected interface. Once this work has been completed, it should be almost impossible to use SpiderMonkey incorrectly without a C++ compile error.
Style Guidelines: In SpiderMonkey
There are many places in SpiderMonkey core where doing correct rooting at all times is prohibitively expensive. We have added an RAII assertion guard that can create "GC Safe Zones," where correct rooting is optional. These zones should be placed around code that cannot GC that has performance hazards that C++ cannot optimize sufficiently with the extra indirection of rooting.