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

JSIL front-end: no need for parser reentrancy #8153

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

tautschnig
Copy link
Collaborator

@tautschnig tautschnig commented Jan 9, 2024

Just make sure it isn't used in a reentrant manner.

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

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (69bb2b6) 79.09% compared to head (6682802) 79.09%.

Files Patch % Lines
src/jsil/jsil_parser.h 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8153      +/-   ##
===========================================
- Coverage    79.09%   79.09%   -0.01%     
===========================================
  Files         1695     1695              
  Lines       196583   196589       +6     
===========================================
- Hits        155496   155493       -3     
- Misses       41087    41096       +9     

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

@kroening
Copy link
Member

kroening commented Jan 9, 2024

Where does the bison state go?

@tautschnig tautschnig force-pushed the cleanup/jsil-reentrant branch 2 times, most recently from 800522a to 43fa0d5 Compare January 9, 2024 14:20
@tautschnig tautschnig requested review from a team and peterschrammel as code owners January 9, 2024 14:20
@tautschnig
Copy link
Collaborator Author

Where does the bison state go?

Good call, this is now fixed (by using %pure-parser -- see comments and commit messages for more on this choice).

@kroening
Copy link
Member

kroening commented Jan 9, 2024

Good call, this is now fixed (by using %pure-parser -- see comments and commit messages for more on this choice).

Sure this is worth it? We currently don't need reentrant parsing, and if all you want is to remove set_message_handler call, you could achieve that with a simple precondition in the constructor.

@tautschnig
Copy link
Collaborator Author

Good call, this is now fixed (by using %pure-parser -- see comments and commit messages for more on this choice).

Sure this is worth it? We currently don't need reentrant parsing, and if all you want is to remove set_message_handler call, you could achieve that with a simple precondition in the constructor.

Added commits to just do the precondition. The overall change should now accomplish the simpler approach, while the individual commits could be reverted in case we ever wish to use full reentrancy.

src/jsil/jsil_parser.h Outdated Show resolved Hide resolved
@tautschnig tautschnig force-pushed the cleanup/jsil-reentrant branch 2 times, most recently from eab428d to 9b220d6 Compare January 10, 2024 09:30
@kroening
Copy link
Member

There are still lots of changes to the scanner left, which are probably not needed?

@tautschnig
Copy link
Collaborator Author

tautschnig commented Jan 10, 2024

There are still lots of changes to the scanner left, which are probably not needed?

We can stick with the existing jsil_scanner_init and the file-local global pointer, in which case we indeed don't need those changes as we aren't going for a reentrant setup anyway. We could then just have the new PRECONDITION as about the only change for added safety.

I believe the reentrant lexer makes for cleaner code, but I acknowledge that we don't actually need that capability and it might just be seen as unnecessary code churn. So I am ok producing a (much simpler) variant of this PR that just introduces the additional safety check. Just let me know.

Edit: and I will use the outcome of this PR to inform how to proceed with #8135, #8138, #8141.

@kroening
Copy link
Member

kroening commented Jan 10, 2024

I believe the reentrant lexer makes for cleaner code, but I acknowledge that we don't actually need that capability and it might just be seen as unnecessary code churn. So I am ok producing a (much simpler) variant of this PR that just introduces the additional safety check. Just let me know.

For reentrant lexing, we should consider generating C++ lexers, which would be possibly easier to understand.

The flex-generated C++ code seems to be sensible. However, attempts to have bison generate C++ have apparently been abandoned.

Just make sure it isn't used in a reentrant manner.
@tautschnig tautschnig changed the title JSIL front-end: make parser and lexer reentrant JSIL front-end: no need for parser reentrancy Jan 11, 2024
@tautschnig
Copy link
Collaborator Author

The changes in this PR are now limited to just guarding against attempts of reentrant parser use.

@kroening kroening merged commit 9d7eced into diffblue:develop Jan 11, 2024
37 of 39 checks passed
@martin-cs
Copy link
Collaborator

I'm a bit late to the party do the following exist or are there plans for them to exist?

  • A maintained tool the produces JSIL.
  • A documented process of how to use that tool with CBMC.

Because if not, I could suggest a much more radical PR which would also solve this problem. Last I spoke to Philippa I got the impression that she and her group had stopped working on this.

@tautschnig tautschnig deleted the cleanup/jsil-reentrant branch January 11, 2024 16:53
@tautschnig
Copy link
Collaborator Author

I'm a bit late to the party do the following exist or are there plans for them to exist?

* A maintained tool the produces JSIL.

* A documented process of how to use that tool with CBMC.

Because if not, I could suggest a much more radical PR which would also solve this problem. Last I spoke to Philippa I got the impression that she and her group had stopped working on this.

#8158

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