-
Notifications
You must be signed in to change notification settings - Fork 274
Byte extract lowering for vectors and array cleanup [blocks: #2068, #4187] #4124
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
Conversation
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: c21e390).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100140199
c21e390
to
f62cfae
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: f62cfae).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100907943
ff981ee
to
8836523
Compare
@smowton All comments addressed. |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 8836523).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100944534
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.
Looks good, thanks! One comment I think is wrong and a tiny nitpick -- one other thing: can we avoid the back-and-forth between constant_exprt
and optional<mp_integer>
that happens when we recurse into a member? That seems a little error-prone, as well as expensive.
@@ -111,7 +111,7 @@ static array_exprt unpack_array_vector( | |||
// recursively unpack each element until so that we eventually just have an | |||
// array of bytes left | |||
exprt sub = | |||
unpack_rec(element, little_endian, nil_exprt(), max_bytes, ns, true); | |||
unpack_rec(element, little_endian, nullopt, max_bytes, ns, true); |
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.
Usually {}
rather than nullopt
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.
We seem to have a small number of uses, but agreed that {}
is more common and thus to be used.
Refactor the code used for arrays to make it re-usable for vectors and arrays.
We already limited extraction at an uppper bound, but when we know the offset we can also start as late as possible. For structs, for example, we now do not expand components that will be irrelevant to the final result.
No need to construct index_exprt when we can just pick the operand out of a vector.
This makes the unit of measurement explicit and thus should help avoid bits/bytes confusion.
This makes the interface much more explicit about what is or isn't supported at moment.
Using |
8836523
to
bd30790
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: bd30790).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100967585
Only the last three commits are new, the rest is borrowed from #4123.