Skip to content

Codegen new intrinsic raw_eq#331

Merged
adpaco-aws merged 1 commit intomodel-checking:main-153-2021-07-15from
adpaco-aws:raw_eq
Jul 15, 2021
Merged

Codegen new intrinsic raw_eq#331
adpaco-aws merged 1 commit intomodel-checking:main-153-2021-07-15from
adpaco-aws:raw_eq

Conversation

@adpaco-aws
Copy link
Contributor

Description of changes:

This allows us to codegen the intrinsic raw_eq which has been introduced in the latest rebase. See #292 for the report.

Resolved issues:

Resolves #330
Unblocks #292

Call-outs:

Codegen can be improved to avoid calling memcmp in some cases.

Testing:

  • How is this change tested? Existing regression plus one new test for this intrinsic.

  • Is this a refactor change? No.

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Copy link

@chinmaydd chinmaydd left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +675 to +677
// TODO: Handle more cases in this intrinsic by looking into the parameters' layouts.
// TODO: Fix soundness issues in this intrinsic. It's UB to call `raw_eq` if any of
// the bytes in the first or second arguments are uninitialized.
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there things we could assert on here? Or for the first TODO would it already crash in the unhandled cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The soundness check has to come in before the rest of the code. Then you can decide based on layouts and finally use memcmp for the general case. The cranelift backend does this.

Copy link
Contributor

@vecchiot-aws vecchiot-aws left a comment

Choose a reason for hiding this comment

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

👍

@adpaco-aws adpaco-aws merged commit 1f8c9af into model-checking:main-153-2021-07-15 Jul 15, 2021
adpaco-aws added a commit that referenced this pull request Jul 26, 2021
adpaco-aws added a commit that referenced this pull request Aug 2, 2021
@zhassan-aws zhassan-aws mentioned this pull request Aug 6, 2021
4 tasks
adpaco-aws added a commit that referenced this pull request Aug 6, 2021
adpaco-aws added a commit that referenced this pull request Aug 17, 2021
adpaco-aws added a commit that referenced this pull request Aug 24, 2021
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 26, 2022
tedinski pushed a commit that referenced this pull request Apr 27, 2022
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.

4 participants