commit | 1e0836bd99fd09a289c9939fcf8b53f4f68e32ef | [log] [tgz] |
---|---|---|
author | Aaron Green <aarongreen@google.com> | Thu May 23 00:03:04 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu May 23 00:03:04 2024 +0000 |
tree | 5453057354f952e903779ae7e0f2de9d22455b22 | |
parent | 8b5396011e33fcb3beeeab6fbc43e4d1b4efe574 [diff] |
pw_allocator: Refactor optional Allocator methods This CL merges the optional GetRequestedLayout, GetUsableLayout, GetAllocatedLayout, GetCapacity, and Query methods into a single method that takes an enumerated InfoType. This has two distinct advantages: * It reduces boilerplate parameter checking, e.g. the BlockAllocators would perform the exact checks of given pointers for each of the methods. * It reduces the size of the vtable. Since every object dervied from Deallocator must pay a vtable cost for each virtual methods, it is desirable to keep the number of virtual methods to a minimum. The observed size report deltas are: * NullAllocator: -88 * BestFitBlockAllocator: -136 * BuddyAllocator: +112 * BumpAllocator: -8 * DualFirstFitBlockAllocator: -136 * FirstFitBlockAllocator: -144 * LastFitBlockAllocator: -136 * LibCAllocator: -8 * WorstFitBlockAllocator: -136 * FallbackAllocator: -192 * SynchronizedAllocator<sync::InterruptSpinLock>: -280 * SynchronizedAllocator<sync::Mutex>: -280 * TrackingAllocator<AllMetrics>: -88 * TrackingAllocator<NoMetrics>: -88 Change-Id: I0d2d2fa1be9fcad935f262355d577580af2a1aa3 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/210402 Commit-Queue: Aaron Green <aarongreen@google.com> Reviewed-by: Wyatt Hepler <hepler@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Taylor Cramer <cramertj@google.com> Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.