-
Notifications
You must be signed in to change notification settings - Fork 274
Share a common class_hierarchyt instance across multiple users #3216
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
Share a common class_hierarchyt instance across multiple users #3216
Conversation
@thk123 note this breaks test-gen; the fix is to mirror the change made in |
Would it be possible to have the first four commits in a separate PR? It seems those should go in without debate and wouldn't break TG either. Only the last one is really what #3204 was about?! |
@tautschnig they're just incidental cleanups in the immediate vicinity of the main change, which I split into their own commits to avoid dirtying the main functional ones. I don't think they're significant enough to bother making their own PR. |
Up to you, but I think we might become better at getting changes merged if we were to arrive at a one-commit-per-PR model. There's a cost in rebasing changes to PR authors and re-reviewing to reviewers. |
f32775c
to
fff81e8
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: fff81e8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88804165
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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
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, but needs a TG bump, @thk123.
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 is in place of the analysis cache I assume? Will make a TG bump now. Otherwise LGTM.
jbmc/src/jbmc/jbmc_parse_options.cpp
Outdated
@@ -529,6 +529,9 @@ int jbmc_parse_optionst::doit() | |||
*this, options, get_message_handler()); | |||
lazy_goto_model.initialize(cmdline, options); | |||
|
|||
class_hierarchy = util_make_unique<class_hierarchyt>(); | |||
(*class_hierarchy)(lazy_goto_model.symbol_table); |
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.
😕 Can't think of a better way to write this, but is a bit of a head scratcher. 💡 Perhaps pull into a static method in class_hierachy.h
: std::unique_ptr<class_hierachyt> create_hierachy(const symbol_tablet &)`?
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.
Added an extra constructor, take another look?
fff81e8
to
5b71f90
Compare
9998ed8
to
734dedf
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 making the TG bump
@@ -57,6 +57,10 @@ class class_hierarchyt | |||
void operator()(const symbol_tablet &); | |||
|
|||
class_hierarchyt() = default; | |||
explicit class_hierarchyt(const symbol_tablet &symbol_table) |
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.
💚 Why even have the default constructor + operator? This is perfect!
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.
for cases where the user wants to allocate it in advance, e.g. as a member of another class that won't have access to the symbol table until its own operator()
, so I won't kill the no-arg constructor. However agreed this is better when possible.
jbmc/src/jbmc/jbmc_parse_options.cpp
Outdated
@@ -606,12 +609,13 @@ int jbmc_parse_optionst::get_goto_program( | |||
*this, options, get_message_handler()); | |||
lazy_goto_model.initialize(cmdline, options); | |||
|
|||
class_hierarchy = util_make_unique<class_hierarchyt>(); |
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.
⛏️ Use the new constructor
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: 9998ed8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88821470
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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
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: 734dedf).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88824136
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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
734dedf
to
1b43a8a
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: 1b43a8a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88835479
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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
jbmc/src/jbmc/jbmc_parse_options.cpp
Outdated
class_hierarchyt hierarchy; | ||
hierarchy(lazy_goto_model.symbol_table); | ||
show_class_hierarchy(hierarchy, ui_message_handler); | ||
show_class_hierarchy((*class_hierarchy), ui_message_handler); |
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.
Why the extra brackets?
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.
oops, fixed
1b43a8a
to
cf4c264
Compare
Merging blocked for now because test-gen can't be validated due to problems with a previous PR merged against cbmc/develop. |
Allows alloc-and-init in one go.
The class hierarchy never changes once the symbol table is computed. By sharing one instance owned by the driver program, particularly across function passes, we can avoid many potentially expensive recomputations.
To pacify clang-format. All hail clang-format.
cf4c264
to
5e9aba8
Compare
Rebased on fixed cbmc/develop |
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: 5e9aba8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88984909
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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
@@ -552,6 +552,9 @@ int jbmc_parse_optionst::doit() | |||
*this, options, get_message_handler()); | |||
lazy_goto_model.initialize(cmdline, options); | |||
|
|||
class_hierarchy = | |||
util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table); |
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.
Why is this needed here?
This is an alternative to #3204, see that PR for details.