-
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
Split state variables and symbolic variables. Stricter type checking. #3987
Conversation
a2a5804
to
7a6e937
Compare
910f0d3
to
192b85e
Compare
set (P4C_V1_TEST_SUITES_P416_PTF ${P4C_V1_TEST_SUITES_P416}) | ||
list(REMOVE_ITEM P4C_V1_TEST_SUITES_P416_PTF | ||
# A particular test (or packet?) combination leads to an infinite loop in the simple switch. | ||
"${P4C_SOURCE_DIR}/testdata/p4_16_samples/v1model-special-ops-bmv2.p4" |
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.
There is a bug in either PTF or the simple switch that cause it too loop packets infinitely under certain conditions. For now, I am disabling this test, but this is something we could look into.
This is great. Reviewing now... |
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.
A big change, but looks good!
This PR untangles the mix of symbolic variables and state variables and ensures that only symbolic variables remain part of the IR expressions. Previously, zombies and state variables were the same thing, which could easily lead to bugs and confusion because state variables are accidentally converted into zombie constants.
Now, state variables, which are members need to be resolved in the interpreter. A BUG will be thrown if there are any members left when we enter the final state. This cleanup required several changes.
zombies.h
and parts ofutils.h
intovariables.h
, which contains all operations related to tools-internal variables.const IR::StateVariable&
, not IR::Member.p4tools.def
files. Make the constructors of the IR classes less accepting. No Concolic or Symbolic variable can be constructed without also supplying a type.Other small changes:
@nikil21 @abhinav2sri
This clears up the distinction between state variables and zombies. Also renames zombies into "symbolic variables" to clear up which type of variable one is working with.
The refactoring also appears to improve performance:
Generating 10000 tests for
middleblock.p4
:Before:
After:
A ~15% reduction in time.