-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace uses of Box with the new fallible-allocation-aware GlobalBox type. Unfortunately, replacing the Box used in the RB tree for virtual mappings is very involved. In short, the intrusive_collections crate provides an intrusive_adapter macro, which generates a new adapter type that handles the insertion and deletion of any type into an intrusive collection. Sadly, this macro is only prepared to work with the smart pointer types in the standard library. This is done by implementing the PointerOps trait for DefaultPointerOps<T>, where T is one of the regular smart pointer types (Rc, Arc, Box, etc.). The macro then generates an implementation of Adapter for the newly generated type, which uses the selected smart pointer. We define a substitute for DefaultPointerOps, CustomPointerOps, and implement PointerOps for CustomPointerOps<GlobalBox>. We then add a manual implementation of Adapter for VMMAdapter, which uses GlobalBox under the hood. Signed-off-by: Carlos López <[email protected]>
- Loading branch information
Showing
2 changed files
with
124 additions
and
14 deletions.
There are no files selected for viewing
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
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