Skip to content

Rip out the heart of bmct [depends: 3557, blocks: 3578, 3580, 3581] #3565

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

Merged

Conversation

peterschrammel
Copy link
Member

This breaks up bmct into reusable pieces with side effects made explicit. Follow up PRs will transform this into a new modular implementation.

Based on #3564
Review only the last 3 commits.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Contributor

@allredj allredj left a 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: bf74357).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/94676355
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.

@peterschrammel peterschrammel changed the title Factor out bmc utils Factor out bmc utils [depends: 3557] Dec 16, 2018
@peterschrammel peterschrammel changed the title Factor out bmc utils [depends: 3557] Factor out bmc utils [depends: 3557, blocks: 3578] Dec 16, 2018
@peterschrammel peterschrammel changed the title Factor out bmc utils [depends: 3557, blocks: 3578] Factor out bmc utils [depends: 3557, blocks: 3578, 3581] Dec 16, 2018
@peterschrammel peterschrammel changed the title Factor out bmc utils [depends: 3557, blocks: 3578, 3581] Factor out bmc utils [depends: 3557, blocks: 3578, 3580] Dec 16, 2018
@peterschrammel peterschrammel changed the title Factor out bmc utils [depends: 3557, blocks: 3578, 3580] Factor out bmc utils [depends: 3557, blocks: 3578, 3580, 3581] Dec 16, 2018
Copy link
Contributor

@allredj allredj left a 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: cd34e43).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/94899726
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.

@peterschrammel peterschrammel changed the title Factor out bmc utils [depends: 3557, blocks: 3578, 3580, 3581] Rip out the heart of bmct [depends: 3557, blocks: 3578, 3580, 3581] Dec 16, 2018
Copy link
Contributor

@romainbrenguier romainbrenguier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the functions one by one would make reviewing easier but otherwise looks fine.

@@ -40,6 +40,7 @@ OBJ += ../$(CPROVER_DIR)/src/ansi-c/ansi-c$(LIBEXT) \
../$(CPROVER_DIR)/src/json/json$(LIBEXT) \
../$(CPROVER_DIR)/src/cbmc/all_properties$(OBJEXT) \
../$(CPROVER_DIR)/src/cbmc/bmc$(OBJEXT) \
../$(CPROVER_DIR)/src/cbmc/bmc_util$(OBJEXT) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in commit message? "Factor out bmct building blocks int bmc_util" -> into?

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but I am wondering whether at some point all contents of the cbmc folder will have moved to the goto-checker folder? Is "bounded model checking"-specific code really something that should be placed in there?

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally not convinced at the granularity of these methods, especially the ones that just print an informational message before calling another method, or the ones that mess with symex internal state without being members of symex.

message_handlert &message_handler)
{
messaget msg(message_handler);
msg.status() << "converting SSA" << messaget::eom;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good time to improve this rubbish message :) "Converting VCCs to propositional formula"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although, this isn't a very useful utility-- print a message then call another public function? Probably just inline this?

ui_message_handlert &ui_message_handler)
{
messaget msg(ui_message_handler);
msg.status() << "Building error trace" << messaget::eom;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the symex case below, this isn't a very useful utility

if(!ns.lookup(INITIALIZE_FUNCTION, init_symbol))
symex.language_mode = init_symbol->mode;

msg.status() << "Starting Bounded Model Checking" << messaget::eom;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this message even true? Symex isn't really BMC any more than any of the prior passes were


symex.last_source_location.make_nil();

symex.unwindset.parse_unwind(options.get_option("unwind"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this method onto symex? It exclusively has effects on symex's members

}

void slice(
symex_bmct &symex,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Const reference?

}
}
}
msg.statistics() << "Generated " << symex.get_total_vccs() << " VCC(s), "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like symex_target_equation is assumed to be bound to symex at this point, such that slicing the target equation has an invisible side-effect on symex (so that get_remaining_vccs() reflects the result of slicing). That suggests moving this onto goto_symext

prop_convt &,
message_handlert &);

void report_failure(ui_message_handlert &);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these methods now have names that don't specify what they do that clearly, because they're no longer in bmct. Move them into a namespace bmc_utilt?

@peterschrammel
Copy link
Member Author

Maybe I was not sufficiently clear about the purpose of this PR: The point of this is to extract from bmct as much as possible so that I can use it "as is" in the new implementations and avoid having to backport changes that happen to bmct in the meanwhile. I am not going to change any functionality here.
One can discuss about the granularity, but this is secondary at this stage - we can easily refactor later and we can even decide that these utilities should get completely absorbed by the new implementation in the end.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go on then

This is an intermediate step in order to reuse
the building blocks in the new implementation of bmct.
The old implementation is functional until it can
be replaced by the new one.
Copy link
Contributor

@allredj allredj left a 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: c343989).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96683683
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.

@peterschrammel peterschrammel merged commit 387834c into diffblue:develop Jan 9, 2019
@peterschrammel peterschrammel deleted the factor-out-bmc-utils branch January 9, 2019 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants