3 ms·
> Subsequently in the 00's, escape analysis made pretty > giant leaps forward, leading to the memory system you > have in Rust today. Rust doesn't use es
by kibwen 11y ago
> Subsequently in the 00's, escape analysis made pretty
> giant leaps forward, leading to the memory system you
> have in Rust today.
Rust doesn't use escape analysis, its analyses are based on Cyclone's regions system (which did arise in the mid-'00s). Or are you implying that there's a lineage leading from escape analysis to regions systems? (I'm unclear on Cyclone's own heritage.)
- hinkley 11y agoI may be making a causal inference based on a correlation. What I had read about the compile time guarantees in Rust indicated that escape analysis was being used to implement them, but I don't know if I read that or assumed. I hadn't encountered Cyclone, but reading through a paper about it now, and it sounds a lot like reading about how Java uses escape analysis with its generational garbage collection to decide where to allocate objects. In fact in 8 goes a lot farther, and it can eliminate monitors, memory fences, and copy constructors that have no observable side effects. Of course if Java ever conservatively wrong (retaining a dead allocation), the GC will take care of it later. In a language without a collector you have to be right in both directions.
- pcwalton 11y agoEscape analysis uses somewhat similar machinery in that it cares about the scopes in which variables are used, but the similarity pretty much ends there. Lifetimes, by contrast, are a type system feature. The closest thing to lifetimes in terms of implementation is actually generics (which makes sense, because lifetimes are just another kind of generic type parameter).