Skip to content

Instantly share code, notes, and snippets.

# HG changeset patch
# Parent b857905d82b45456853866330c98b372b14f20db
# User Nicholas D. Matsakis <[email protected]>
Permit multiple ion compilation modes. This implies the possibility of
multiple ion scripts per JSScript.
* * *
Add abstractions for cases that handle all comp. modes at once.
* * *
split out separate fields for seq, par
* * *
@syg
syg / gc-embed.md
Created March 9, 2018 01:15 — forked from hotsphink/gc-embed.md
Spidermonkey GC API for Embedders

Managing pointers into the GC heap as an embedder

When you have GC pointers (pointers to JS objects, strings, etc.; anything stored directly in the GC heap), you need to handle them specially if they could ever be stored during a collection. I'll first describe what you need to do, then how to do it, and finally why and what happens if you get it wrong.

tracing - strong GC references must be traced so that the GC knows what to keep alive.

pre-write barriers aka delete barrier - if you overwrite a GC pointer, you'll need to let the GC know.

post-write barriers - after storing a GC pointer somewhere, you need to inform the GC of the new value (or more specifically, the address of the new value.)