Skip to content
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

Move goto_convert files #8253

Merged
merged 2 commits into from
May 7, 2024
Merged

Move goto_convert files #8253

merged 2 commits into from
May 7, 2024

Conversation

kroening
Copy link
Member

The goto_convertt class and associated helpers convert a C parse tree into a set of GOTO functions. They are specific to C, and hence, should be in the ansi-c/ directory.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a 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

codecov bot commented Mar 24, 2024

Codecov Report

Attention: Patch coverage is 66.04361% with 327 lines in your changes are missing coverage. Please review.

Project coverage is 78.02%. Comparing base (4f5b402) to head (2b3d12c).

Files Patch % Lines
src/ansi-c/goto-conversion/builtin_functions.cpp 49.46% 94 Missing ⚠️
.../ansi-c/goto-conversion/string_instrumentation.cpp 28.70% 77 Missing ⚠️
src/ansi-c/goto-conversion/format_strings.cpp 36.97% 75 Missing ⚠️
src/ansi-c/printf_formatter.cpp 68.00% 56 Missing ⚠️
src/ansi-c/goto-conversion/goto_convert.cpp 91.61% 13 Missing ⚠️
src/ansi-c/goto-conversion/goto_convert_class.h 90.24% 4 Missing ⚠️
...ansi-c/goto-conversion/goto_convert_exceptions.cpp 66.66% 3 Missing ⚠️
...nsi-c/goto-conversion/goto_convert_side_effect.cpp 96.66% 3 Missing ⚠️
...ecode/java_virtual_functions/virtual_functions.cpp 0.00% 1 Missing ⚠️
...i-c/goto-conversion/goto_convert_function_call.cpp 88.88% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8253      +/-   ##
===========================================
+ Coverage    78.00%   78.02%   +0.01%     
===========================================
  Files         1721     1721              
  Lines       188940   188868      -72     
  Branches     18415    18447      +32     
===========================================
- Hits        147388   147369      -19     
+ Misses       41552    41499      -53     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -16,7 +16,7 @@ Author: Diffblue Ltd.
#include <util/symbol_table_base.h>
#include <util/unicode.h>

#include <goto-programs/allocate_objects.h>
#include <ansi-c/allocate_objects.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this one really C specific? It appears to be used by JBMC, and perhaps more so than anywhere else?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd say it tries to do too much. Object construction is clearly language specific, and this should get split up.

@tautschnig
Copy link
Collaborator

I have a couple of concerns:

  • The ansi-c folder is starting to become unmanageable. At bare minimum I'd suggest that we have a new subfolder ansi-c/goto-conversion/ (or some similar name) to hold those files.
  • As indicated by my comment, but perhaps applicable in more cases: are all those files really all about goto conversion?
  • Is it really correct to assert that only C parse trees can be converted? Isn't it rather the case that we actually have a further intermediate language of codet statements?
  • Do we perhaps need to become a lot more clinical on where we use goto_convert? As this PR documents, we make use of it in a number of places well outside the C front-end. To that effect, I'd like to put up for debate whether we do such cleanup before moving files.

@kroening
Copy link
Member Author

  • The ansi-c folder is starting to become unmanageable. At bare minimum I'd suggest that we have a new subfolder ansi-c/goto-conversion/ (or some similar name) to hold those files.

Ok, will do.

  • As indicated by my comment, but perhaps applicable in more cases: are all those files really all about goto conversion?

No, there's also object construction, but that appears to be intertwined with the conversion. As said in the comment about it, it's also language specific, and hence should move out of the goto-programs folder.

  • Is it really correct to assert that only C parse trees can be converted? Isn't it rather the case that we actually have a further intermediate language of codet statements?

This is getting reduced, and I'd like to get rid of it altogether.

  • Do we perhaps need to become a lot more clinical on where we use goto_convert? As this PR documents, we make use of it in a number of places well outside the C front-end. To that effect, I'd like to put up for debate whether we do such cleanup before moving files.

We realistically won't do the cleanup. For symtab2gb, this lives outside of the codebase. For jbmc, we don't have the person to do it.

@tautschnig
Copy link
Collaborator

  • The ansi-c folder is starting to become unmanageable. At bare minimum I'd suggest that we have a new subfolder ansi-c/goto-conversion/ (or some similar name) to hold those files.

Ok, will do.
[...]

Happy to approve once this is done: I think this goes a long way towards making all of my other concerns easy to track (and, if resources ever permit: fix).

@kroening kroening force-pushed the move-goto-convert branch from 5744353 to 9f75d3b Compare March 27, 2024 15:43
@kroening
Copy link
Member Author

Now with ansi-c/goto-conversion subdirectory.

@kroening kroening force-pushed the move-goto-convert branch 5 times, most recently from 8a7dcf8 to 4c01328 Compare April 1, 2024 21:10
@kroening kroening enabled auto-merge April 1, 2024 21:55
@@ -1,3 +1,4 @@
ansi-c
Copy link
Member

Choose a reason for hiding this comment

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

❓ Isn't linking a pure GOTO thing? Why is there a dependency on ansi-c now? This seems to indicate that either some functionality has been moved that should not be moved or that some functionality is used in other modules that shouldn't be used there.

Copy link
Member Author

Choose a reason for hiding this comment

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

The culprit for this is recreate_initialize_function. I'd like to kill it, and one benefit would be to remove this coupling.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Being the one who introduced this function in the first place: can you share some ideas on how to replace it?

Copy link
Member Author

Choose a reason for hiding this comment

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

As mentioned out-of-band, simply create the goto instructions directly. This should be done separately.

The goto_convertt class and associated helpers convert a C parse tree into a
set of GOTO functions.  They are specific to C, and hence, should be in the
ansi-c/ directory.
@kroening kroening force-pushed the move-goto-convert branch from 4c01328 to a5cc785 Compare May 6, 2024 00:33
@kroening kroening force-pushed the move-goto-convert branch from a5cc785 to 2b3d12c Compare May 6, 2024 01:06
@kroening kroening merged commit 7eb77a8 into develop May 7, 2024
40 of 41 checks passed
@kroening kroening deleted the move-goto-convert branch May 8, 2024 00:23
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.

5 participants