Implement our OOM-handling SecondaryMap from scratch#12621
Implement our OOM-handling SecondaryMap from scratch#12621fitzgen wants to merge 6 commits intobytecodealliance:mainfrom
SecondaryMap from scratch#12621Conversation
And also make it so that cloning it doesn't actually require any allocations by wrapping the inner `GcStructLayout` in an `Arc`.
I realized we need to adjust its `V: Clone` bound into `V: TryClone` which means that we can no longer actually just wrap an inner `cranelift_entity::SecondaryMap<K, V>` and need to instead implement our own. This also made me realize that we need `remove` to be fallible because, when the entry being removed is in bounds, it overwrites the entry with the default value, but that default value needs to be `TryClone`d now which is, of course, a fallible operation.
|
I'll be honest in that I continue to not really understand |
Subscribe to Label Actioncc @fitzgen DetailsThis issue or pull request has been labeled: "cranelift", "fuzzing", "wasmtime:api", "wasmtime:ref-types"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
It is for whenever you want to associate extra data with a For example, in the
The key is already bounded by |
To say it another way that may also help (I've had this question too in the past):
So in Cranelift we tend to use them where we know most IDs will have an entry. Using a |
I realized we need to adjust its
V: Clonebound intoV: TryClonewhich meansthat we can no longer actually just wrap an inner
cranelift_entity::SecondaryMap<K, V>and need to instead implement ourown. This also made me realize that we need
removeto be fallible because,when the entry being removed is in bounds, it overwrites the entry with the
default value, but that default value needs to be
TryCloned now which is, ofcourse, a fallible operation.
Depends on
TryCloneforArc<T>,Option<T>, andResult<T, E>#12615TryCloneforGcLayout#12616TryCloneforPackedOption#12617TryCloneforRegisteredTypeandRecGroupEntryin the types registry #12619clearmethod to our OOM-handlingVec#12620