Make DynamicRootSet store bare types rather than Gc pointers#54
Make DynamicRootSet store bare types rather than Gc pointers#54
Conversation
|
Added a few general fixes to the dynamic roots stuff as well. |
|
Talked about this in Discord a bit, but just writing this here so I remember it later... One thing I didn't think about is that following the held If we were concerned about API stability, it would lock us out of a potentially faster API later, but... we could also just add a faster API in addition to this one, since It's still a bit obnoxious to root a non-Gc type with the old API. We could probably make something that didn't require a pointer indirection to check the set ID, and then having the object pointer right there would be a win, but even then there's still going to be pointer indirection to change the Rc count... I'm really not knowledgable enough to know what the exact impact would be. The main case I see here for this is simplification, I have a big Value type enum with 9 variants, then some of those variants have other variants, some of which contain Gc internally and some contain GcCell internally. This allows you to make registered types without having to "unfold" enums like this, makes it so i don't have to write a parallel |
Improves the usability of the
DynamicRootSetby a great deal, also reduces the size ofDynamicRoottypes.Also makes #53 not strictly necessary anymore.
There is one situation where one might be slightly worse off this way, which is that there will be an extra pointer indirection if the user was already going to store a
Gc<'gc, T>, but in all other cases this is a strict improvement.