gen-guest-c: scalar enum result -> bool return, ok & err ptrs#450
Merged
guybedford merged 6 commits intomainfrom Dec 9, 2022
Merged
gen-guest-c: scalar enum result -> bool return, ok & err ptrs#450guybedford merged 6 commits intomainfrom
guybedford merged 6 commits intomainfrom
Conversation
alexcrichton
approved these changes
Dec 9, 2022
Member
alexcrichton
left a comment
There was a problem hiding this comment.
I think it'd also be reasonable to take a union out-ptr (C union) for the return payload as well rather than two, but either way works IMO.
Contributor
Author
|
I've updated the PR in the latest commit to avoid double writing to both the err and ok return pointers using a singular store function approach. |
alexcrichton
approved these changes
Dec 9, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the result error enum handling to return a boolean instead of a flattened enum, with two possible return pointers - one for the success value and one for the error value.
It does seem slightly higher bandwidth in comparison to what we had before, in that there are three values and three writes instead of two values and two writes now.
I'm going to test out this diff in the js-compute-runtime bindings work, and see how noisy it looks.
The alternative is to completely unflatten the result and just have the double pointer situation from result -> ok / err pointer writes... still somewhat on the fence between the two approaches.
Fixes #449.