-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add size_of annotation to help CBMC's allocator #2395
Conversation
ee80124
to
6385b6f
Compare
a7f1712
to
d3bc70b
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.
Thanks for this detailed explanation, @tautschnig ! A few questions.
aaf2d64
to
293a50a
Compare
With thanks to @karkhaz for making this happen, and with the hope that this isn't just about some GitHub runner anomaly (but at least the numbers stack up with my local experiment):
|
It's looking great, @tautschnig ! Just wondering if you think we should add any more tests to the performance regression or not. Is |
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.
CBMC's heap allocator will produce objects that aren't just a byte array when a prior call to `size_of` was involved in computing the number of bytes to be allocated via malloc/calloc/realloc. This, in turn, permits type-safe member accesses to heap-allocated objects. This should speed up copying as well as all other operations on the resulting object (which will then not have to go through byte extract/byte update operations). It also seems that there no longer is a "size_of" intrinsic. Fixes: model-checking#1286
293a50a
to
fbd263b
Compare
My apologies, looks like I wrongly inferred this from #1286 (comment). I just confirmed that (as expected) #1781 is not fixed. |
That test is already there. |
Description of changes:
CBMC's heap allocator will produce objects that aren't just a byte array when a prior call to
size_of
was involved in computing the number of bytes to be allocated via malloc/calloc/realloc. This, in turn, permits type-safe member accesses to heap-allocated objects. This should speed up copying as well as all other operations on the resulting object (which will then not have to go through byte extract/byte update operations).It also seems that there no longer is a "size_of" intrinsic.
Resolved issues:
Fixes: #1286
Related RFC:
n/a
Call-outs:
n/a
Testing:
How is this change tested? Locally reviewed CBMC's
--program-only
output on some Vector examples.Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.