8000 Always call packet->reset_exit() at beginning of Pipeline::apply() by jafingerhut · Pull Request #1279 · p4lang/behavioral-model · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Always call packet->reset_exit() at beginning of Pipeline::apply() #1279

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jafingerhut
Copy link
Contributor

The only place the code checks for is_marked_for_exit() is inside of Pipeline::apply(), so by resetting exit flag at beginning of Pipeline::apply, no users of Pipeline class need to worry about the exit flag at all. It is handled completely locally within Pipeline::apply(), and could even be a local variable of Pipeline::appply() if the primitive made that straightforward (which it does not).

The only place the code checks for is_marked_for_exit() is inside of
Pipeline::apply(), so by resetting exit flag at beginning of
Pipeline::apply, no users of Pipeline class need to worry about the
exit flag at all.  It is handled completely locally within
Pipeline::apply(), and could even be a local variable of
Pipeline::appply() if the primitive made that straightforward (which
it does not).

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
@jafingerhut
Copy link
Contributor Author
jafingerhut commented Nov 10, 2024

I did not confirm whether there was a bug related to #1275, but in thinking about it a bit, the changes proposed in this PR seems to me to simplify the thinking about the question, and make it disappear as a concern. Users of the Pipeline class don't need to know about the exit flag at all, if Pipeline::apply() correctly initializes and uses it locally.

I ran a full test suite of p4c with these changes to behavioral-model, and they all passed.

Copy link

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days

@jafingerhut
Copy link
Contributor Author

@antoninbas I always hesitate to bug you about things, so feel free to ignore this if it is a bother. If you do have any comments or questions on this, I'd love to hear them. Based on what I know of the code, these look like reasonable safe changes, which would help future code maintainers avoid bugs in handling the behavior of exit statements.

If you do not have time or interest, no worries. I will consider merging in these changes after getting review from people working on BMv2 changes for Google Summer of Code 2025.

@antoninbas
Copy link
Member

Only concern for me is that the last part of the mark_for_exit comment is no longer valid:

//! afterwards; otherwise this other pipeline will just be skipped as well. If
//! this method is called from outside of an action, the flag will take effect
//! at the next pipeline, which will be skipped entirely (not a single table
//! will be applied).

Now I have no idea why I thought that was the desired behavior. But if someone calls exit in a parser, the new behavior doesn't match the old one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3CEE
Development

Successfully merging this pull request may close these issues.

3 participants
0