Abusing reborrowing for fun, profit, and a safepoint garbage collector

Day 1 | 13:10 | 00:40 | UB2.252A (Lameere) | Aapo Alasuutari


Note: I'm reworking this at the moment, some things won't work.

The stream isn't available yet! Check back at 13:10.

Rust's references adhere to a strict "one exclusive XOR many shared" model, which gives the language much of its greatest safety guarantees. Reborrowing is a feature that seems on surface to break this rule: An exclusive reference can be turned into shared references and those shared references can be used together with the exclusive reference as long as these are all used as if they were shared references. Only once the exclusive reference is used as exclusive, all the derived or "reborrowed" shared references are invalidated. The XOR rule is upheld, but in a way that breaks a literal reading of the rule.

Usually reborrowing is used temporarily but what if we make it our modus operandi? This talk explores using and slightly abusing reborrowing and comes out the other side with an awkward but functional safepoint garbage collector built upon reborrowing a ZST marker and a whole load of typed indexes. The garbage collector is part of the Nova JavaScript engine.

https://trynova.dev/