-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[P4Testgen] Resolve method call arguments before stepping into an extern - preserve InOut references #4255
Merged
Conversation
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
fruffy
force-pushed
the
fruffy/resolve_args_before_enterning_extern
branch
4 times, most recently
from
November 19, 2023 17:38
5b014f7
to
b134e29
Compare
fruffy
force-pushed
the
fruffy/resolve_args_before_enterning_extern
branch
3 times, most recently
from
November 23, 2023 19:31
2e0a6f4
to
f9733b7
Compare
fruffy
force-pushed
the
fruffy/resolve_args_before_enterning_extern
branch
from
November 29, 2023 15:07
f9733b7
to
cc991df
Compare
fruffy
commented
Nov 30, 2023
vlstill
reviewed
Nov 30, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the way this simplifies writting extern implementations. I have some small questions and suggestions.
backends/p4tools/modules/testgen/core/small_step/extern_stepper.cpp
Outdated
Show resolved
Hide resolved
fruffy
force-pushed
the
fruffy/resolve_args_before_enterning_extern
branch
from
November 30, 2023 22:33
8554058
to
d84c89b
Compare
vlstill
approved these changes
Dec 1, 2023
fruffy
force-pushed
the
fruffy/resolve_args_before_enterning_extern
branch
from
December 1, 2023 19:19
1a849a6
to
a77b818
Compare
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.
Finally fixing this longstanding issue. We always had to resolve method call arguments within an extern, which often resulted in unnecessary redundant code. Further, for
InOut
parameters, the original reference was lost.Now we frontload this directly in the method call expression. We resolve arguments
In
andInOut
parameters before stepping into the extern. ForInOut
arguments, we replace the expression with anInOutReference
, which preserves the reference. This way we can read the input argument and also write to the original reference once we step into an extern. With #4215 merged, we can also pass in any complex expression such as header or struct expressions as arguments.