-
Notifications
You must be signed in to change notification settings - Fork 447
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] Refactor the P4Testgen extern implementation. #4728
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
changed the title
Refactor the P4Testgen extern implementation.
[P4Testgen] Refactor the P4Testgen extern implementation.
Jun 17, 2024
fruffy
force-pushed
the
fruffy/testgen_extern_refactoring
branch
3 times, most recently
from
June 17, 2024 20:07
dcc6c21
to
059c349
Compare
vlstill
reviewed
Jul 8, 2024
backends/p4tools/modules/testgen/targets/pna/test/PNAMetadataXfail.cmake
Outdated
Show resolved
Hide resolved
backends/p4tools/modules/testgen/targets/pna/shared_expr_stepper.cpp
Outdated
Show resolved
Hide resolved
backends/p4tools/modules/testgen/core/small_step/expr_stepper.h
Outdated
Show resolved
Hide resolved
backends/p4tools/modules/testgen/core/small_step/expr_stepper.h
Outdated
Show resolved
Hide resolved
backends/p4tools/modules/testgen/core/small_step/expr_stepper.h
Outdated
Show resolved
Hide resolved
backends/p4tools/modules/testgen/core/small_step/expr_stepper.h
Outdated
Show resolved
Hide resolved
backends/p4tools/modules/testgen/core/small_step/expr_stepper.h
Outdated
Show resolved
Hide resolved
backends/p4tools/modules/testgen/core/small_step/expr_stepper.h
Outdated
Show resolved
Hide resolved
fruffy
force-pushed
the
fruffy/testgen_extern_refactoring
branch
from
July 8, 2024 14:39
059c349
to
012681e
Compare
Signed-off-by: fruffy <fruffy@nyu.edu>
fruffy
force-pushed
the
fruffy/testgen_extern_refactoring
branch
from
July 8, 2024 15:54
3cc5e45
to
ac537e6
Compare
Signed-off-by: fruffy <fruffy@nyu.edu>
vlstill
approved these changes
Jul 17, 2024
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 PR cleans up some of the implementation of Extern functions in P4Testen. This is a breaking change. Part of this PR was prompted by #4706 which uncovered a nasty bug.
Currently, externs are defined as a static list of functions inside the expression stepper. This is necessary to access helper functions and members of the expression stepper. However one subtle consequence is that when the list of externs is instantiated the first time, the calling expression stepper object is bound to this last. Now for any future object this object will be invoked instead of a potentially different expression stepper.
The way to fix this is to make the stepper itself part of the parameters of the defined extern functions. This is a bit tricky to implement because of access protection rules hence we had to rewrite the structure of the extern function lists. They are now templates that are instantiated for each stepper class.
There are also more quality of life improvements. I folded the arguments for externs into an ExternInfo class and move the extern list out of the
evalExternMethodCall
which gives back some indentation space.