-
Notifications
You must be signed in to change notification settings - Fork 126
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
Conversation
Fixes #1740. We can do this because the values (WordVal) already has its width, so we don't need to store it again.
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.
Please make sure to mention this in the changelog. (If nothing else, the API changes will impact SAW.)
src/Cryptol/Backend.hs
Outdated
@@ -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 |
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.
I wonder if we should rename f
to proxy
to signal the intent that this argument is never used at runtime.
src/Cryptol/Backend.hs
Outdated
@@ -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 |
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.
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
.
src/Cryptol/Eval/Generic.hs
Outdated
valueToChar sym (VWord 8 wval) = | ||
valueToChar sym (VWord wval) = |
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 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?
Fixes #1740. We can do this because the values (WordVal) already has its width, so we don't need to store it again.