Skip to content

Support for an external lazy methods driver to control when the INITIALIZE_FUNCTION is generated #5156

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 4 commits into from
Oct 9, 2019

Conversation

thomasspriggs
Copy link
Contributor

@thomasspriggs thomasspriggs commented Oct 8, 2019

Support for an external lazy methods driver to control when the INITIALIZE_FUNCTION is generated. The INITIALIZE_FUNCTION needs to be generated after all needed string literals have been added to the symbol table. The existing implementation tied the generation of the INITIALIZE_FUNCTION, to the point where generate_support_functions is called. This PR frees an external loading driver to generate the INITIALIZE_FUNCTION separately.

  • 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/ - N/A
  • 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). Non 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.

@@ -58,4 +74,6 @@ void java_internal_additions(symbol_table_baset &dest)
symbol.is_static_lifetime = true;
dest.add(symbol);
}

create_java_initialize(dest);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't hide this inside internal_additions, just explicitly call it where needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -942,6 +944,8 @@ bool java_bytecode_languaget::typecheck(
convert_single_method(
method_sig.first, journalling_symbol_table, class_to_declared_symbols);
}
convert_single_method(
INITIALIZE_FUNCTION, journalling_symbol_table, class_to_declared_symbols);
Copy link
Contributor

Choose a reason for hiding this comment

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

What about old ci-lazy-methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is already indirectly tested via the regression tests. I chose to add a unit test of the new functionality in this PR, because it would otherwise be untested within this repository.

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 guess I could add a unit test of that...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

This allows for an external lazy methods driver to control when the
`INITIALIZE_FUNCTION` is generated.
This tests that an empty bodied initialize function is generated by
`typecheck` and that the body is then populated by `convert_lazy_method`
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: 3989689).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/131119343

Copy link
Contributor

@owen-mc-diffblue owen-mc-diffblue left a comment

Choose a reason for hiding this comment

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

All good

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.

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 082b368).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/131147875
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

@codecov-io
Copy link

Codecov Report

Merging #5156 into develop will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5156      +/-   ##
===========================================
- Coverage    67.12%   67.08%   -0.05%     
===========================================
  Files         1149     1149              
  Lines        94194    94037     -157     
===========================================
- Hits         63229    63082     -147     
+ Misses       30965    30955      -10
Flag Coverage Δ
#cproversmt2 42.7% <ø> (+0.01%) ⬆️
#regression 63.57% <100%> (-0.06%) ⬇️
#unit 31.98% <100%> (+0.08%) ⬆️
Impacted Files Coverage Δ
jbmc/src/java_bytecode/java_entry_point.h 100% <ø> (ø) ⬆️
jbmc/src/java_bytecode/java_entry_point.cpp 87.86% <100%> (-0.06%) ⬇️
jbmc/src/java_bytecode/java_bytecode_language.cpp 93.43% <100%> (+0.11%) ⬆️
src/json/json_interface.cpp 71.42% <0%> (-11.43%) ⬇️
src/util/xml.cpp 60.46% <0%> (-1.17%) ⬇️
src/solvers/smt2/smt2_solver.cpp 81.87% <0%> (-1.14%) ⬇️
src/solvers/smt2/smt2_parser.cpp 65.43% <0%> (-1.13%) ⬇️
src/util/simplify_expr.cpp 86.82% <0%> (-0.71%) ⬇️
src/cbmc/cbmc_parse_options.cpp 75.43% <0%> (-0.26%) ⬇️
src/util/cmdline.cpp 91.73% <0%> (-0.14%) ⬇️
... and 8 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 db4c76b...082b368. Read the comment docs.

@thomasspriggs thomasspriggs merged commit e1e7a74 into diffblue:develop Oct 9, 2019
@thomasspriggs thomasspriggs deleted the tas/lazy_initialize branch October 9, 2019 15:20
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