Skip to content
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

Support lvalue expressions #839

Merged
merged 1 commit into from
Dec 31, 2019
Merged

Conversation

antoninbas
Copy link
Member

The bmv2 expression engine can now returns references to bmv2 primitive
objects (Data, Header, ...) when the expression being evaluated is an
lvalue. This means that we can now handle assignments to complex lvalue
expressions which do not statically resolve to a field / header /
union. One example would be an assignment to a header stack field
accessed through a runtime index.

Unit tests were added, although at the moment they do not support all
the possible cases (e.g. expressions which evaluate to a header union).

The JSON version number was bumped up to 2.23. Even though no additions
were made to the format, we now support additional cases and the
documentation now includes an example of a "complex" assignment
statement.

Fixes #838

The bmv2 expression engine can now returns references to bmv2 primitive
objects (Data, Header, ...) when the expression being evaluated is an
lvalue. This means that we can now handle assignments to complex lvalue
expressions which do not statically resolve to a field / header /
union. One example would be an assignment to a header stack field
accessed through a runtime index.

Unit tests were added, although at the moment they do not support all
the possible cases (e.g. expressions which evaluate to a header union).

The JSON version number was bumped up to 2.23. Even though no additions
were made to the format, we now support additional cases and the
documentation now includes an example of a "complex" assignment
statement.

Fixes #838
@codecov-io
Copy link

Codecov Report

Merging #839 into master will decrease coverage by 0.21%.
The diff coverage is 78.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #839      +/-   ##
==========================================
- Coverage   74.77%   74.56%   -0.22%     
==========================================
  Files         115      115              
  Lines       10193    10207      +14     
==========================================
- Hits         7622     7611      -11     
- Misses       2571     2596      +25
Impacted Files Coverage Δ
include/bm/bm_sim/P4Objects.h 86.95% <ø> (ø) ⬆️
src/bm_sim/P4Objects.cpp 80.06% <100%> (+0.89%) ⬆️
include/bm/bm_sim/expressions.h 88.88% <100%> (+1.38%) ⬆️
include/bm/bm_sim/actions.h 41.97% <22.22%> (-1.62%) ⬇️
src/bm_sim/actions.cpp 89.27% <56%> (-4.1%) ⬇️
src/bm_sim/expressions.cpp 90.21% <82.75%> (-6.68%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14f705b...bdbe514. Read the comment docs.

@antoninbas antoninbas merged commit 3d0ca48 into master Dec 31, 2019
@antoninbas antoninbas deleted the antonin/support-lvalue-expressions branch December 31, 2019 20:16
antoninbas added a commit that referenced this pull request May 10, 2020
When adding support for returning lvalues in the expression evaluation
engine (#839), we
introduced support for using expressions which do not evaluate to a
simple Data value as primitive arguments. In particular, we can use an
expression which evaluates to a Header object as a primitive
argument. However, the code responsible for parsing the bmv2 input JSON
and instantiating Action objects was treating all expressions used as
primitive arguments as "Data expressions", thus causing bmv2 to crash
when it was actually not the case.

Fixes #887
antoninbas added a commit that referenced this pull request May 10, 2020
When adding support for returning lvalues in the expression evaluation
engine (#839), we
introduced support for using expressions which do not evaluate to a
simple Data value as primitive arguments. In particular, we can use an
expression which evaluates to a Header object as a primitive
argument. However, the code responsible for parsing the bmv2 input JSON
and instantiating Action objects was treating all expressions used as
primitive arguments as "Data expressions", thus causing bmv2 to crash
when it was actually not the case.

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

Successfully merging this pull request may close these issues.

Support expressions as l-values for action primitives
2 participants