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

Address spec issue #915 - Specify the types allowed for header stack indexes #923

Conversation

jafingerhut
Copy link
Contributor

No description provided.

@jafingerhut
Copy link
Contributor Author

@jnfoster Here is a proposed change for issue #915.

I have no strong preference for or against allowing serializable enum types as header stack indexes. It seems reasonable to me to allow them, or not.

The rest seems fairly safe and conservative to me.

- `int<W>` - a `W`-bit signed integer where `W >= 1` (section
[#sec-signed-integers])
- a serializable `enum` with an underlying type that is `bit<W>` or
`int<W>` (section [#sec-enum-types]).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jafingerhut AI Andy to create a small test program and see whether p4c accepts a header stack index with type of serializable enum is supported today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple test program shows that recent versions of p4c given an error when one attempts to use an expression of type enum bit<8> ... as the index of a header stack reference: p4lang/p4c#2726

@mihaibudiu
Copy link
Contributor

Check whether the implementation supports enums.
Probably this should be accepted.

Copy link
Contributor

@mihaibudiu mihaibudiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler now supports all these cases: p4lang/p4c#2738

@jafingerhut jafingerhut force-pushed the spec-issue-915-specify-type-of-header-stack-index-expressions branch from 1279a8e to 6a36bd3 Compare May 3, 2021 22:17
@jafingerhut
Copy link
Contributor Author

@mbudiu-vmw I am pretty sure we agreed to merge this into the spec during the 2021-May-03 LDWG meeting. It had a conflict (in the change log section, as expected) which should now be resolved. I will let you push the merge button for this, in case I am mixed up on PRs.

@mihaibudiu mihaibudiu merged commit ea4a178 into p4lang:main May 3, 2021
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.

None yet

2 participants