-
Notifications
You must be signed in to change notification settings - Fork 273
Revert irept change that stopped sharing and add unit test #1860
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
fae5b58
to
cffaf8b
Compare
6f51d21
to
83b1bb4
Compare
83b1bb4
to
e4a88e3
Compare
This seems to do more than the title suggests? |
The title might just have been very long and probably had priorities wrong - it's changed now. |
@NathanJPhillips any objections against this one? @smowton is out for the week; anyone else who wants to jump on this one? |
I should stress that I am happy to re-contemplate using C++ standard library idioms for irept, with a sufficiently strong case that it'll be robust. |
Adding a test and then immediately commenting it out because you know that it would fail seems like a red flag to me. Reuben's change may have been more conservative that it needed to be, but that is better than allowing incorrect behaviour. If you find a bug then it is fine to fix it straight away and then apply optimisations later: incremental is good. The performance impact of Reuben's fix was already analysed and accepted at the time it was applied. Reverting the fix would not be a good solution even if we didn't have the optimisation already in review. Saying that |
@NathanJPhillips Sentence-by-sentence response:
Ok, but it seems better than not having a test?
No, performance and memory consumption matter. "Allowing" incorrect behaviour is different from exhibiting it.
Incrementally following the wrong route permits backtracking, which is what this PR does.
Which simply shows that my performance analysis was not good enough.
Why? On the contrary, allowing people to use a broken solution is not a good solution.
The way you are conflating one data structure with the entire code base severely undermines the credibility of what you are saying.
I don't know what the size of your experimental corpus is. Mine is the >400 million lines of C code in Debian. |
I have no disagreements with @tautschnig response. If people aren't convinced by my earlier comment then go ahead with this revert. |
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.
Approve because I believe this to be a correct implementation of : #1855 (comment)
FWIW I have noticed a small but significant slow-down in a key use-case today. It was something that was added in the past ... 6-9 months and must be pretty core. I'll try with this patch and see if it changes anything.
src/util/irep.h
Outdated
@@ -122,6 +122,7 @@ class irept | |||
{ | |||
if(data!=&empty_d) | |||
{ | |||
// NOLINTNEXTLINE(build/deprecated) | |||
assert(data->ref_count!=0); |
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'd be kinda happier if this was an invariant for the sake of uniformity. I was going to add a comment along the lines of "but everywhere it is used also uses std_expr.h or std_types.h so it won't make much difference" but that's not true (shows how often I wander through the front-end!). Not exactly sure of the impact on build speed but ... I guess we can put off converting this until we've done things like minimising the use of headers to improve build speed.
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 am very open to resolving this in a different way, i.e., by actually using INVARIANT
. I just feared some undesirable impact.
@martin-cs, if you have any results on this then please let me know. |
743b042
to
3c3b88c
Compare
Marking this as do-not-merge as #1970 ought to be merged first and experiments to come up with memory regression tests are in progress. |
920f9e4
to
28b337b
Compare
68ef907
to
d2e2802
Compare
This one seems to be essential before we do the release. |
On top of 63acc5b on a customer-provided
User time (seconds): 16.42 #1855 + #2316 #1860 + #2316 #2316 |
This partially reverts commit b741d4b. While safer to use, these changes prevented sharing on irept's where non-const references had been taken to any irept stored in their sub/named_sub collections. The newly introduced cow.h and small_shared_ptr.h are kept in place, but all modifications to irept are reverted.
Using invariant.h would drag in a number of additional headers into almost every file thus it seems preferable to maintain the assert here.
Separately test irept and exprt, where the latter are expected to have the very same behaviour.
cc49fcb
to
cbce4bc
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.
This PR failed Diffblue compatibility checks (cbmc commit: cbce4bc).
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
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 needs an update PR to test-gen.
What is it that this PR breaks in test-gen? That's a bit unexpected, except if it is about missing include files (which should likely be fixed either way). |
Seems to be a missing include, indeed. |
Test-gen update is ready for review: https://github.com/diffblue/test-gen/pull/1941 |
Sorry the test-gen update exhibited a another bug. I'll try to fix all that as quickly as possible, but that might not be done today... |
This is getting urgent, as blocking release! |
The submodule update https://github.com/diffblue/test-gen/pull/1941 has now been rebase on the fix. Waiting for CI. |
@tautschnig could you please rebase on cbmc/develop? |
@kroening this needs a rebase on cbmc/develop. |
8a7893c Merge pull request diffblue#2375 from diffblue/unit-dependencies 9258284 fix build depenencies of unit test binary f7cd161 Merge pull request diffblue#2371 from diffblue/fix-tests2 82753bc make test independent of index type f5f32da Merge pull request diffblue#2364 from smowton/smowton/fix/autodetect-default-cxx-dialect d437f60 Merge pull request diffblue#2368 from polgreen/doc_replace_func_bodies 6048517 Merge pull request diffblue#2353 from tautschnig/g++8-fixes2 e2e6d82 Merge pull request diffblue#2190 from tautschnig/more-stats 7210136 Make it clearer that <=> will always be stringified 560f82b Travis: test more g++ and clang versions d46a55c Add new goto-instrument option print-global-state-size 961b29a Silence GCC 8's warning about using realloc/memmove on non-POD ca1b03c Documentation wording for replace function bodies d8c5a98 Cleanup options handling of count-eloc, list-eloc, print-path-lengths 6cd6d31 Unit test framwork: use references when catching exceptions 6882da6 Merge pull request diffblue#2367 from diffblue/fix-tests bcc3bef make regression/cbmc/bounds_check1 independent of types used 4de4538 switch regression/cbmc/Typecast2 to preprocessed code 91a9c64 Amend two tests that explicitly target C++98 2b2b797 goto-gcc: select default language standard depending on emulated compiler 52a8afc Merge pull request diffblue#1898 from tautschnig/always-inline cbe691b Merge pull request diffblue#2363 from diffblue/Makefile-TAR 9d40a9e Merge pull request diffblue#2365 from diffblue/solaris_errno 9efd705 add model for ___errno for Solaris 11 eaa2e05 update Solaris instructions 2f142d5 allow customizing the tar command for solver download 8cc1848 Merge pull request diffblue#1860 from tautschnig/restore-irept-sharing fea5db0 Merge pull request diffblue#2361 from diffblue/fix-goto2 7c0d750 Merge pull request diffblue#2362 from smowton/smowton/fix/tolerate-cxx-namespace-attribute e440a25 introduce INCOMPLETE_GOTO and turn guarded goto into a stateless pass 1f1835b C++ frontend: tolerate namespace attributes cbce4bc Unit test of irept's public API abdb044 Unit test to check that irept implements sharing d58fd18 Silence the linter on assert in irep.h 3d64070 Partially revert "Use small intrusive pointer in irep" 688a0ab Macros are not needed outside translation units 9c93f59 Fully interpret __attribute__((always_inline)) d1f617b Apply symbol replacement in type_arg members git-subtree-dir: cbmc git-subtree-split: 8a7893c
This is the test from #1855 provided by @NathanJPhillips, with the modification to only make it run when
SHARING
is enabled.