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

Fix support for verify() and error type to fully support verify() in PSA/eBPF backend #3250

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

tatry
Copy link
Contributor

@tatry tatry commented Apr 25, 2022

This PR fixes the support for verify() and error type to fully support them in eBPF backend. Works for PSA and filter architecture.

Co-authored-by: Tomasz Osiński [email protected]
Co-authored-by: Mateusz Kossakowski [email protected]

…PSA/eBPF backend

This PR fixes the support for verify() and error type to fully support them in eBPF backend. Works for PSA and filter architecture.

Co-authored-by: Tomasz Osiński <[email protected]>
Co-authored-by: Mateusz Kossakowski <[email protected]>
@@ -27,6 +27,38 @@ limitations under the License.

namespace EBPF {

class PSAErrorCodesGen : public Inspector {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a midend pass called convertErrors that could perhaps be used to do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use this class only to iterate over error codes and emit them into C code. Similarly is done for filter architecture.

I've prepared a PR in my fork which shows difference with this midend pass, especially this commit. In my opinion there is no profits from using convertErrors pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds fine, it's a small amount of code.

BUG_CHECK(expression->arguments->size() == 2, "Expected 2 arguments: %1%", expression);

auto errorExpr = expression->arguments->at(1)->expression;
auto errorMember = errorExpr->to<IR::Member>();
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use the error elimination pass (see below) this code may need to change.

@mihaibudiu
Copy link
Contributor

Should I merge this or do you plan further changes?

@mihaibudiu
Copy link
Contributor

I will merge this anyway

@mihaibudiu mihaibudiu merged commit 5754d6c into p4lang:main Apr 26, 2022
osinstom pushed a commit to osinstom/p4c-1 that referenced this pull request Apr 27, 2022
…PSA/eBPF backend (p4lang#3250)

This PR fixes the support for verify() and error type to fully support them in eBPF backend. Works for PSA and filter architecture.

Co-authored-by: Tomasz Osiński <[email protected]>
Co-authored-by: Mateusz Kossakowski <[email protected]>
@tatry
Copy link
Contributor Author

tatry commented Apr 27, 2022

Thank you. I have no plans for further changes.

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.

2 participants