Skip to content

abstract_environmentt::eval rework #5644

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 16 commits into from
Dec 15, 2020

Conversation

jezhiggins
Copy link
Contributor

Refactoring work centred on abstract_environmentt::eval, trying to reduce the volume of special case handling.

Moved implementation of indexing, member access, and pointer dereferencing out into the target object types. This allowed us to combine several of the if-ladder cases together.

@jezhiggins jezhiggins force-pushed the abstract_environmentt-eval branch 3 times, most recently from 2af2fcf to 5e51e4c Compare December 9, 2020 11:28
Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

Yes; this is directly in the right direction and does simplify things.

Request changes because it would be good if it could go a little bit further and remove abstract_objectt::read completely by calling the internal functions read_* of the relevant classes.

@@ -0,0 +1,15 @@
CORE
union.c
--variable-sensitivity --vsd --verify
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 --vsd and --variable-sensitivity should do the same thing. One was for backwards compatibility.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please can you go down to just one of these two?

^\[main.assertion.5\] line 19 x.a==0: UNKNOWN$
^\[main.assertion.6\] line 20 x.a==1: UNKNOWN$
^\[main.assertion.7\] line 21 x.b==0: UNKNOWN$
^\[main.assertion.8\] line 22 x.b==1: UNKNOWN$
Copy link
Collaborator

Choose a reason for hiding this comment

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

With a "most recently written" abstraction for unions it should be possible to turn about half of these into successes but for now all unknown is the best that can be done.

namespacet &ns
);

SCENARIO(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unit tests are good. In theory much of VSD should be testable via unit tests so having more is a good thing.

return array_abstract_object->read(*this, index_expr, ns);
}
else if(simplified_id == ID_array)
else if(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes; these are all basically the same constant case.

@martin-cs
Copy link
Collaborator

Reflecting on this, I think the only uses of read_index, read_component, etc. are in read so you could inline the contents of these into the expression_transform and remove everything read related.

@martin-cs
Copy link
Collaborator

Better -- thank you.

@jezhiggins jezhiggins force-pushed the abstract_environmentt-eval branch from 7c136ef to c16842d Compare December 15, 2020 13:40
union_abstract_object is only top or bottom, consequently this test
tells us very little beyond telling us union member access works doesn't
explode. However there is nowhere else in the tests that  doing anything
at all with unions, so it is a least a little backstop.
Move it out of abstract_environment. union_abstract_objects can also
be the target of member expressions, but this is not implemented in the
current code so I've left it out of here too.
Move it out of abstract_environment.
Now we've moved some work into expression_transform, we don't need a
read member on the base class.
@jezhiggins jezhiggins force-pushed the abstract_environmentt-eval branch from c16842d to 97b6d87 Compare December 15, 2020 13:42
@codecov
Copy link

codecov bot commented Dec 15, 2020

Codecov Report

Merging #5644 (7ead4af) into develop (5167ef5) will increase coverage by 0.02%.
The diff coverage is 95.23%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5644      +/-   ##
===========================================
+ Coverage    69.41%   69.44%   +0.02%     
===========================================
  Files         1243     1243              
  Lines       100609   100584      -25     
===========================================
+ Hits         69839    69846       +7     
+ Misses       30770    30738      -32     
Flag Coverage Δ
cproversmt2 43.14% <ø> (ø)
regression 66.32% <95.23%> (+0.01%) ⬆️
unit 32.28% <71.42%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
.../analyses/variable-sensitivity/abstract_object.cpp 73.40% <ø> (+1.52%) ⬆️
...rc/analyses/variable-sensitivity/abstract_object.h 91.42% <ø> (ø)
...lyses/variable-sensitivity/array_abstract_object.h 50.00% <ø> (ø)
...s/variable-sensitivity/context_abstract_object.cpp 50.00% <ø> (-2.64%) ⬇️
...ses/variable-sensitivity/context_abstract_object.h 92.30% <ø> (ø)
...ses/variable-sensitivity/pointer_abstract_object.h 50.00% <ø> (ø)
...yses/variable-sensitivity/struct_abstract_object.h 50.00% <ø> (ø)
...ses/variable-sensitivity/union_abstract_object.cpp 66.66% <ø> (+66.66%) ⬆️
...lyses/variable-sensitivity/union_abstract_object.h 50.00% <ø> (+50.00%) ⬆️
...variable-sensitivity/value_set_abstract_object.cpp 69.74% <ø> (+2.26%) ⬆️
... and 14 more

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 5167ef5...7ead4af. Read the comment docs.

@jezhiggins jezhiggins marked this pull request as ready for review December 15, 2020 14:21
@jezhiggins jezhiggins requested a review from martin-cs December 15, 2020 14:22
Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

One tweak to the union regression test and should be good to merge.

@@ -0,0 +1,15 @@
CORE
union.c
--variable-sensitivity --vsd --verify
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please can you go down to just one of these two?

@martin-cs martin-cs merged commit fd8af8a into diffblue:develop Dec 15, 2020
@jezhiggins jezhiggins deleted the abstract_environmentt-eval branch December 19, 2020 14:35
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.

2 participants