-
Notifications
You must be signed in to change notification settings - Fork 23
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
Implement type-safe attributes #983
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Baltoli
changed the title
Rethink attribute infrastructure
Implement type-safe attributes
Feb 15, 2024
Scott-Guest
reviewed
Feb 15, 2024
Scott-Guest
approved these changes
Feb 15, 2024
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.
LGTM
theo25
approved these changes
Feb 15, 2024
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.
This looks good to me. I left a few minor comments but I will approve and leave to you to decide if you want to address them.
rv-jenkins
pushed a commit
that referenced
this pull request
Feb 16, 2024
Following runtimeverification/k#3989, the KORE attribute that encodes "this axiom declares an overload equality over two symbols `X` and `Y`" is being gradually renamed from `overload(_,_)` to `symbol-overload(_,_)`. This PR moves the LLVM backend over to accepting the new attribute rather than the old one; doing so is a simple renaming process on the attribute following #983. The checked-in KORE test files are updated by a simple renaming of the attribute.[^1] ~~Blocked on: #983~~ [^1]: See #987; it's a pain to regenerate all the KORE at the moment so I've edited the files manually using `sed` rather than the actual K frontend. This is fine for this case in the frontend, but in the future if we make more complex changes to the structure of compiled KORE definitions we should implement a more robust way of rebuilding the test suite to pin against a particular frontend version.
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a more limited version of the type-safe attribute infrastructure that we use in the K frontend; by doing so we can construct a canonical list of the attributes that we actually use in the backend, and avoid working with string data when we don't need to be.
The core of the change is a new
attribute_set
structure that accepts attributes permissively from the parser, but only allows key-value lookup via a limited set of whitelisted attribute keys. There are a couple of places in the code that need to access the full set of attributes, ignoring the whitelist:Both of these code paths have comments to make sure they are used cautiously.
The bulk of the changes are 1:1 and can be reviewed pretty easily in the split diff; there's only a small API change in code that consumes attributes in the backend.
There is a small papercut in that the syntax to reference an attribute key is quite verbose (
attribute_set::key::name
); when we upgrade to C++20 in the near future we get access tousing enum attribute_set::key;
which solves this problem and makes the code nicer to read.I've tested the change upstream against the K integration test suite.