-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
370: Add a simple way to convert a CommandReturn into a Result r=jrvanwhy a=kupiakos There are a few changes that this makes: - `CommandReturn` is `#[must_use]` - `ErrorCode` includes `BadRVal` - `CommandReturn` has a `to_result` method I experimented with a few methods of structuring `to_result` to have the smallest overhead per monomorphization. What you see here is the best I could do. I also tried: - Providing a `try_to_result` and using that (lots of overhead) - Preserving the error code of the failure variant on `BADRVAL` - Associated constant `FailureData::BADRVAL` - Associated fn `FailureData::from_wrong_variant(r1: ErrorCode) -> Self` - A helper function `fn to_result_helper(self, success_variant: ReturnVariant, error_variant: ReturnVariant) -> (bool, u32, u32, u32)` that would do the branches and replacing `r1` with `BadRVal` and other registers with `0` in the case of the wrong variant. I thought this would reduce things further but it seemed to make it worse in my tests. Then again - I only had one instance of each monomorphization. Co-authored-by: Alyssa Haroldsen <[email protected]>
- Loading branch information
Showing
8 changed files
with
440 additions
and
43 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
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
Oops, something went wrong.