-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce code bloat from generics monomorphization
For large functions with generic parameters that are called with many different generic parameters, move as much code as possible within those functions into separate, non-generic functions. This ensures that when Rust monomorphizes those functions, only the portions of code which actually need to be duplicated are duplicated. The approach here is similar to that described in https://www.possiblerust.com/pattern/non-generic-inner-functions, except that it is applied to methods rather than functions. This change reduces code size by 4016 bytes, most of which comes from the changes to Grant::enter(). A corresponding PR has been sent to upstream Tock: tock#2648 . That PR is for the Tock 2.0 version of grant.rs, and thus makes some different decisions based on the updated grant design. BUG=None, TEST=make build; Change-Id: I5fc0a360c9a37852746ebb32e83de2a03dc1e957 Reviewed-on: https://chrome-internal-review.googlesource.com/c/ti50/third_party/tock/tock/+/3947379 Reviewed-by: Andrey Pronin <[email protected]> Reviewed-by: Jett Rink <[email protected]> Commit-Queue: Hudson Ayers <[email protected]> Tested-by: Hudson Ayers <[email protected]>
- Loading branch information
1 parent
1e299d0
commit 7c96a73
Showing
2 changed files
with
169 additions
and
128 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