Closed yav closed 2 months ago
The cryptol value for words stored the length of the word and a WordValue:
WordValue
https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Eval/Value.hs#L127
But the WordValue also stored the length of the word:
https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend/WordValue.hs#L91
The only case that does not have an explicit value is the WordVal which uses the type family SWord to pick a type based on representation.
WordVal
SWord
In the Concrete backend this value is BV https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend/Concrete.hs#L135
Concrete
BV
which also has a length:
https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend/Concrete.hs#L57
In fact, any instance of SWord must store its length, because the backend contains this method:
https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend.hs#L298
I think we can remove the length from VWord and just get it from teh WordValue.
VWord
The cryptol value for words stored the length of the word and a
WordValue
:https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Eval/Value.hs#L127
But the
WordValue
also stored the length of the word:https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend/WordValue.hs#L91
The only case that does not have an explicit value is the
WordVal
which uses the type familySWord
to pick a type based on representation.In the
Concrete
backend this value isBV
https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend/Concrete.hs#L135which also has a length:
https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend/Concrete.hs#L57
In fact, any instance of
SWord
must store its length, because the backend contains this method:https://github.com/GaloisInc/cryptol/blob/09853251186d4590f3b093dbdf2b324c9a7e6ca0/src/Cryptol/Backend.hs#L298
I think we can remove the length from
VWord
and just get it from tehWordValue
.