Skip to content

Clean up in the value set API #4690

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
merged 7 commits into from
Jun 3, 2019

Conversation

romainbrenguier
Copy link
Contributor

Several methods/members of value set are actually not used and should be deprecated to simplify the API.
The get_value_set interface in which the result has to be given as argument is also not clear and it is better to return the result.

  • 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).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@tautschnig
Copy link
Collaborator

@romainbrenguier Various CI steps in Travis are failing.

class object_map_dt
: public std::map<object_numberingt::number_type, offsett>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This basically is a revert of 3b5263f. We should have really good reasons if that's what should happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I see. I will drop that commit for now and try to find a better solution

@@ -276,6 +277,7 @@ class value_sett
const namespacet &ns) const;

/// Appears to be unimplemented.
DEPRECATED(SINCE(2019, 05, 22, "Unimplemented"))
expr_sett &get(const irep_idt &identifier, const std::string &suffix);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can just remove what isn't even implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know. In test-gen there were cases of cpp files used instead of the cbmc ones which could add new implementation not existing in cbmc

@smowton
Copy link
Contributor

smowton commented May 22, 2019

@owen-jones-diffblue could you check if local_value_sett uses location_number?

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.

Suggest dropping the std::map-inheriting commit, which is a straight revert of #919, for the reasons given in that PR

void
get_value_set(const exprt &expr, value_setst::valuest &dest) const override;

std::list<exprt> get_value_set(const exprt &expr) const override;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're adding a new entry-point we probably shouldn't use std::list, there's no call for a doubly-linked list here AFAICT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but it is a list, and the fact that value_setst::valuest is a list is public, by writing value_setst::valuest we are just making it more complicated for the reader

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not suggesting valuest, I'm suggesting std::vector because that's the most performant C++ sequence container when you don't have a good reason for something else (e.g. deque or list)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh right

@romainbrenguier
Copy link
Contributor Author

@tautschnig @smowton here is a PR to go instead of the std::map inheritance #4694

@owen-mc-diffblue
Copy link
Contributor

@smowton It does, but we can just add that field ourselves

@romainbrenguier
Copy link
Contributor Author

actually it seems location_number is used by value_set_domain_templatet so I will have to drop that commit too...

@romainbrenguier romainbrenguier force-pushed the clean-up/value-set branch 3 times, most recently from f015a95 to 1d13bfa Compare May 24, 2019 14:23
@romainbrenguier
Copy link
Contributor Author

@smowton I have now replace the use of list by vector

@@ -34,9 +34,12 @@ class symex_dereference_statet:
goto_symext::statet &state;
const namespacet &ns;

DEPRECATED(SINCE(2019, 05, 22, "use list returning version instead"))
Copy link
Contributor

Choose a reason for hiding this comment

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

vector returning

@@ -29,9 +29,12 @@ class dereference_callbackt
public:
virtual ~dereference_callbackt() = default;

DEPRECATED(SINCE(2019, 05, 22, "use list returning version instead"))
Copy link
Contributor

Choose a reason for hiding this comment

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

vector returning

@@ -28,12 +28,19 @@ class value_setst
typedef std::list<exprt> valuest;

// this is not const to allow a lazy evaluation
DEPRECATED(SINCE(2019, 05, 22, "use list returning version instead"))
Copy link
Contributor

Choose a reason for hiding this comment

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

vector returning

@romainbrenguier romainbrenguier force-pushed the clean-up/value-set branch 4 times, most recently from c138014 to 9b387f1 Compare May 28, 2019 14:52
@romainbrenguier
Copy link
Contributor Author

@owen-jones-diffblue @smowton I've added a commit which gets rid of doxygen warning that were generated for this pull request, in case you want to have a look

@tautschnig
Copy link
Collaborator

@romainbrenguier Please rebase now that #4729 is in to make CI happy.

@romainbrenguier romainbrenguier force-pushed the clean-up/value-set branch 2 times, most recently from 40b65af to 27f87e8 Compare May 31, 2019 06:18
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.

✔️
Passed Diffblue compatibility checks (cbmc commit: 27f87e8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113842424

This avoids having to create a tmp expression and allows moving into the function.
This is not implemented.
These return the computed value, which makes the information flow
clearer in the program.
We deprecate at the same time the functions from the previous version.
vectors are generally more efficient than list, unless we use
concatenation or insertion which doesn't appear to be case here.
This prevents the macro from making doxyfile miss method definitions
that are deprecated and automatically add the deprecated methods to the
Deprecated List generated by doxygen
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.

✔️
Passed Diffblue compatibility checks (cbmc commit: fa1412c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/114073541

@tautschnig tautschnig merged commit f175f75 into diffblue:develop Jun 3, 2019
@romainbrenguier romainbrenguier deleted the clean-up/value-set branch June 3, 2019 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants