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

Remove bitvectors width from the value tag. #1751

Merged
merged 6 commits into from
Sep 17, 2024
Merged

Remove bitvectors width from the value tag. #1751

merged 6 commits into from
Sep 17, 2024

Conversation

yav
Copy link
Member

@yav yav commented Sep 17, 2024

Fixes #1740. We can do this because the values (WordVal) already has its width, so we don't need to store it again.

Fixes #1740.  We can do this because the values (WordVal) already
has its width, so we don't need to store it again.
Copy link
Contributor

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

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

Please make sure to mention this in the changelog. (If nothing else, the API changes will impact SAW.)

@@ -295,7 +297,7 @@ class MonadIO (SEval sym) => Backend sym where
bitAsLit :: sym -> SBit sym -> Maybe Bool

-- | The number of bits in a word value.
wordLen :: sym -> SWord sym -> Integer
wordLen' :: f sym -> SWord sym -> Integer
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should rename f to proxy to signal the intent that this argument is never used at runtime.

@@ -813,3 +815,7 @@ type FPArith2 sym =
SFloat sym ->
SFloat sym ->
SEval sym (SFloat sym)

wordLen :: forall sym. Backend sym => sym -> SWord sym -> Integer
wordLen _ x = wordLen' (Nothing :: Maybe sym) x
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, I wonder if we should pass Proxy @sym instead of Nothing :: Maybe sym here (and elsewhere in this PR where we use Nothing :: Maybe sym.

valueToChar sym (VWord 8 wval) =
valueToChar sym (VWord wval) =
Copy link
Contributor

Choose a reason for hiding this comment

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

This change appears to have changed the semantics of this function slightly, as it now matches any word size instead of just 8-bit words. Perhaps the pattern guards below should check that the wordValWidth is 8?

@yav yav merged commit b1bdfd0 into master Sep 17, 2024
48 checks passed
@yav yav deleted the issue_1740 branch September 17, 2024 20:26
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.

Don't store widths of words twice
2 participants