Skip to content

Remove unnecessary copy and loss of state information #5778

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 1 commit into from
Jan 25, 2021

Conversation

TGWDB
Copy link
Contributor

@TGWDB TGWDB commented Jan 22, 2021

This removes a constructor that was not necessary
because it implemented the default behaviour of
the copy constructor (and thus created two places
to edit if changes were made to the class).

  • 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.

@@ -20,6 +20,9 @@ Author: Romain Brenguier, [email protected]

#include "renaming_level.h"

// 20210122 Forward declaration required
Copy link
Collaborator

Choose a reason for hiding this comment

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

We generally don't date comments, in favour of using git blame / praise. Maybe we should but at the moment we don't

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, why is it required? It doesn't look necessary if you are deleting the code that uses it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the comment to remove the date stamp. Also added more detail to the comment about the declaration of the child class inside the parent class. The parent class explicitly uses the child class, this was resolved before by declaring the constructor for the child class inline. I don't know why the child class needs to be used in the parent, this just removes the duplicate constructor declaration and handles the required (forward) declaration.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you for these updates, but can we please actually dig a little deeper here? It seems the apply_condition function is what uses goto_symex_statet, but then either 1) apply_condition could safely be used with a goto_statet instead of a goto_symex_statet, or 2) apply_condition should become a member function of goto_symex_statet instead of being a member of goto_statet. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The apply_condition code in goto_statet has special cases related to goto_symex_statet that are non-trivial to split from the parent class. To do this properly is a larger refactor that impacts several locations in the code and there are already comments related to this (e.g. see symex_goto.cpp lines 35-46).
I'm not comfortable taking on this larger refactor at the moment, specially since this PR is just to remove some redundant code.

@codecov
Copy link

codecov bot commented Jan 22, 2021

Codecov Report

Merging #5778 (c1938dc) into develop (4cc9611) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5778      +/-   ##
===========================================
- Coverage    69.54%   69.54%   -0.01%     
===========================================
  Files         1243     1243              
  Lines       100701   100697       -4     
===========================================
- Hits         70037    70033       -4     
  Misses       30664    30664              
Flag Coverage Δ
cproversmt2 43.32% <ø> (-0.01%) ⬇️
regression 66.44% <ø> (-0.01%) ⬇️
unit 32.25% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/goto-symex/goto_state.h 100.00% <ø> (ø)
src/goto-symex/goto_symex_state.h 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cc9611...c1938dc. Read the comment docs.

@tautschnig
Copy link
Collaborator

It may also be useful to add some history to the commit message: this constructor became obsolete as of 7938cd1.

This commit removes an inline constructor that performed
a copy of the state and thus could cause state information
to be lost.
@TGWDB TGWDB force-pushed the goto_statet_oddity branch from b3288be to c1938dc Compare January 25, 2021 09:16
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 we really need to clean up this mess of a parent class restricting itself to a particular form of inheritance.

@tautschnig tautschnig merged commit 3f41c03 into diffblue:develop Jan 25, 2021
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.

3 participants