-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Vaporization is not yet implemented, as there are other features that need to be in place before it makes sense to add it in. Here's how we'd need to do this, from #52:
To do so, we'll need to add a new pass to the compiler, potentially named
last_use.rsor something, that walks the AST backwards and records the first occurrence (i.e. last use) of each variable. The second thing we need to do is add support for Rust'sCowpointers (clone on write) intagged.rs. After that, we'll need to modify the generation step (gen.rs) to take last use into account, and emit instructions for moving out of sharedCowreferences. Finally, the VM will need to add minor runtime support around instructions for copying shared references. I'll open an issue with a tracking list so we can keep track of work wrt that.
Here's that issue! And, as promised, the checklist:
- Remove mutation in closures, enforce only mutable in local scope rule.
- Add
last_usepass to compiler. - Add support for
CoWintagged. - Modify
gento work off oflast_usepass. - Add instructions that manage
CoWpointers. - Add support for instructions in
vm - Tests and so on - fine-grained extension to more complex data types, like slices of lists.
For those interested, there's a forever-WIP post on vaporization on my blog: https://slightknack.dev/blog/vaporization/.