In a way, but you're saving on the dynamic overhead of constantly pinning and unpinning. In any case, I think most of the time values pointed to by stack roots are allowed to move in cases like that, except when the trace and copy phases have to be split up for whatever reason.
-
-
Replying to @awesomeintheory @aaron_turon
No I mean if you say you can’t move anything that’s alive, you can’t move anything..
1 reply 0 retweets 0 likes -
Replying to @withoutboats @aaron_turon
Oh. No, I didn't mean that transitively--was just talking about the stack roots (and globals I guess, but I think all the safe GC interfaces I've ever seen in Rust rely on lifetimes so you don't have to worry about that).
1 reply 0 retweets 0 likes -
Replying to @awesomeintheory @aaron_turon
Gotcha. That’s even tricksier tho because you have to map references you get out of the gc, not just the original roots
1 reply 0 retweets 0 likes -
Replying to @withoutboats @aaron_turon
Well, the idea would be that all the roots are whatever's currently live on the stack *right now* and you somehow know how to trace from that to all Gc'd values. The trick is limiting the places Gc'd values can be hiding... which is a tall order in Rust, as you noted.
1 reply 0 retweets 0 likes -
This is also assuming a stop the world GC; for parallel GCs it's harder, but I haven't focused too much on that since Rust already has solutions for concurrent data structures that beat general purpose GCs.
1 reply 0 retweets 0 likes -
But yeah, the alternative is to have the user basically set up their own "safepoints" by making it explicit when collection can occur and requiring you to put all GC'd references into designated locations before it can run. Which is a lot more tedious than stack maps could be...
1 reply 0 retweets 0 likes -
Replying to @awesomeintheory @aaron_turon
I don’t know how you could possibly implement stack maps sufficiently for this. If you can get an &T into the gc heap you can’t distinguish it in the map
2 replies 0 retweets 0 likes -
Actually I can think of a way that I would call pseudo conservative
1 reply 0 retweets 0 likes -
Replying to @withoutboats @aaron_turon
I'm honestly not sure, I haven't tried to make a version with actual stack roots work. But I think something opaque type-like could probably help (you could make sure that the type couldn't directly move so there was some pointer to follow on the actual stack).
1 reply 0 retweets 0 likes
Either way, I'm reluctant to say it's impossible to write a certain kind of API in Rust, since I keep getting proven wrong :)
-
-
Replying to @awesomeintheory @aaron_turon
Here’s something... maybe rustc can know which objects are borrowed at each collection point from *its* lifetime analysis
1 reply 0 retweets 1 like - 4 more replies
New conversation -
-
-
Er, s/stack roots/stack maps.
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.