-
Notifications
You must be signed in to change notification settings - Fork 37
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
Bitfield improvements #1492
Merged
Merged
Bitfield improvements #1492
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
rsmmr
force-pushed
the
topic/robin/bitfield-improvements
branch
5 times, most recently
from
August 11, 2023 10:20
de71633
to
32dd7fa
Compare
The `isEqual` method was implemented in the base class, which led to wrong template types being used. A subsequent commit will depend on this working correctly, including a test breaking if not.
This prepares for making `bitfield` a fully-supported HILTI type. This change only moves existing code over to HILTI without breaking Spicy-side functionality. There are still HILTI-side pieces missing for providing full support, which will come next.
We keep representing bitfields as a C++ tuple behind the scenes, but no longer map it into a HILTI-side tuple as well. Instead `Bitfield` is now a regular type with corresponding operators and runtime functionality. The one change to the C++ tuple representation is that we add an additional hidden tuple element at the end that stores the original integer value. That allows for displaying it (which we will do for now only inside Spicy debug output) and could later also facilitate modifying fields and reconstructing an integer.
rsmmr
force-pushed
the
topic/robin/bitfield-improvements
branch
from
August 14, 2023 13:45
32dd7fa
to
b681a4d
Compare
bbannier
requested changes
Aug 14, 2023
This works now: type Foo = unit { : bitfield(8) { x: 0..3; y: 4..7; }; on %done { print self.x, self.y; } }; Closes #1468.
…s anonymous. This preservers the information if a field had a name even though internally we do carry a generated dummy name around in that case. For now, we just adapt `spicy-dump` to not print the dummy name in that case in its text output. Later, Zeek will leverage this when auto-generating record types.
We now render them as key/value form in both text and JSON output.
We were including offsets into spicy-dumps JSON output, but there was no information in there saying which offsets belong to what field. Turning `__offsets` from an array into a map indexed by field name now.
Spicy-dump now renders items of anonymous bitfields at the parent level. Offsets are added accordingly as well if requested.
rsmmr
force-pushed
the
topic/robin/bitfield-improvements
branch
from
August 22, 2023 10:04
51dfa0d
to
33f5855
Compare
bbannier
approved these changes
Aug 22, 2023
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 was referenced Sep 18, 2023
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 addresses #1032, #1468, and #1484.