-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: `AValue` contains operations not covered by `StarlarkValue` (GC and allocation payload). Historical context. Vtable in starlark was `trait AValue`: real trait vtable was stored in object header. `AValue` was implemented for `AValueImpl<T>`. This is long gone, now we have `AValueVTable` struct, which stores function pointers directly. This diff changes: - `trait AValue` is now implemented for marker types like `AValueSimple<T>` instead of `AValueImpl<Mode, T>` - `AValueImpl` now just a pair of `impl AValue, T` instead of `impl AValueMode, T` This makes code cleaner. Previously we passed `impl AValue` around, and assumed it is only implemented for `AValueImpl`, so we can safely transmute it to/from `AValue::StarlarkValue`. Now we explicitly pass `AValueImpl`. This legacy code cleanup, and should also make static allocation simpler. Previously code was written like this: ``` pub(crate) static VALUE_NONE: AValueRepr<AValueImpl<Basic, NoneType>> = alloc_static(Basic, NoneType); ``` meaning: find `AValue` implementation for a pair `Basic, NoneType`. and now it is this: ``` pub(crate) static VALUE_NONE: AValueRepr<AValueImpl<'static, AValueBasic<NoneType>>> = alloc_static(NoneType); ``` meaning: `AValue` implementation is `AValueBasic<NoneType>`. This diff also replaces a lot of `&mut` pointers with raw pointers, because there's no really any safety around memory management, proper pointer only mask problems if any, and dealing with typechecker is hard. Reviewed By: ndmitchell Differential Revision: D56382969 fbshipit-source-id: d02067e3da43034976d60fd271eeb52900f200dc
- Loading branch information
1 parent
bc3b943
commit 14ef8b4
Showing
22 changed files
with
410 additions
and
346 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.