-
Notifications
You must be signed in to change notification settings - Fork 273
JBMC: Remove-returns per function #1730
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
JBMC: Remove-returns per function #1730
Conversation
Test-gen bump: https://github.com/diffblue/test-gen/pull/1364 |
Could you please clarify what the first commit is supposed to achieve on its own? Only the second commit has a detailed commit message, yet is somewhat confusing as it heavily touches |
I don't yet buy this one: my approach would have been to alter the type of a function If the string solver expects some functions to always have non-void return types, then the string solver needs to be fixed -- it should be able to handle the two cases (1) has a non-void return type and (2) has void type -> look at Surely I'm missing something, so why is it that the string solver can't be fixed? |
@tautschnig fixed the commits; the first one was supposed to do the real work, and the second one activate it in jbmc. The string solver can be fixed, but my concern is any frontend pass that happens to examine the type of another function, e.g. to generate a call sequence, will need to be taught about I can also run a whole-program-level cleanup pass that makes the type void so everything is consistent then -- thus only passes that run during the loading process will need to care about the distinction. |
Would you have a concrete example of such a pass? The notion of "frontend" isn't perfectly clear to me here (I would not consider any analysis running on goto programs a "frontend" type pass anymore as, to me, the transition from |
The string solver is the only one I know about so far. The plan here is for symex to load functions on demand, so in practice, briefly defining "front-end" as anything that sees the code before loading is finished, the front-end will constitute everything from java-bytecode-convert-method through to the solver. Everything in |
Just had some out-of-band sync, @smowton will post updates. |
Going to try the approach where we do alter the types in remove-returns just as in the whole-program case, but teach the Java frontend and related passes not to assume the symbol table is accurate, but rather to always use |
f59587e
to
fa04804
Compare
@tautschnig updated this to your design idea; in fact it turned out the string solver doesn't inspect other functions' types; rather it was failing because string-related functions can initially be created as stubs, and then later provided with a body. I worked around this by having Long story short, remove-returns now edits types just like the whole-program pass, and it appears that the frontend components are not perturbed, at least in the tests supplied with jbmc and deeptest. Please re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok, but it's too late to call this a serious review.
src/goto-programs/remove_returns.cpp
Outdated
@@ -194,11 +219,45 @@ void remove_returnst::operator()(goto_functionst &goto_functions) | |||
{ | |||
Forall_goto_functions(it, goto_functions) | |||
{ | |||
replace_returns(it); | |||
do_function_calls(goto_functions, it->second.body); | |||
auto function_is_stub = [&goto_functions](const irep_idt &function_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOLINT needed
src/goto-programs/remove_returns.cpp
Outdated
if(goto_function.body.empty()) | ||
return; | ||
|
||
auto function_is_stub = [&symbol_table](const irep_idt &function_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOLINT needed
// Consider some sort of annotation indicating a global variable that | ||
// doesn't require initialisation? | ||
return !has_suffix(id2string(sym.name), RETURN_VALUE_SUFFIX); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? The annotation you could use is marking it extern
, which will avoid such initialisation in the C front-end. That might work for Java as well, because Java would not be using is_extern
natively, I believe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disinclined to abuse the flag so, since I am providing a definition of the symbol, it just doesn't need start-of-day initialisation because we know it is always written before reading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just strikes me as something very magical, and very much of unclear value. I accept that it may not be necessary to do the initialisation, but is it really that much harm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment at least with a largeish JAR available you'd get thousands of lines of __CPROVER_initialize
that you didn't need, and therefore thousands of lines of state in goto-symex. Still, would it make you happier to invent a special value
(no_initialisation_required_exprt
?) that makes this clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I get that this may yield many avoidable instructions. What makes me unhappy is this special casing and dependency of otherwise completely unrelated bits of code.
What about renaming the is_extern
flag and making it no longer C-specific? It could be do_not_initialize
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want to rename it, but I'll gladly add an extra flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would impact (de)serialisation of goto binaries, so take extra care!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, then I won't. A comment on the type seems like the least invasive solution in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might just want to tell me to shut up and go with your existing solution plus a TODO saying that a different approach would fall into the class of #1148 :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah that's okay, a type-comment (AKA an annotation, but that's an extra symbol field (which is a #1148 matter)) is strictly nicer than what I have now. I'll make a new version of this shortly, as the is-a-stub-callsite thing should be solved better anyhow.
if((!driver_program_provides_stubs) && | ||
(!string_preprocess.implements_function(id))) | ||
{ | ||
symbol.type.set(ID_C_incomplete, ID_1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use true
instead of ID_1
. The right thing will happen.
src/goto-programs/remove_returns.cpp
Outdated
/// the function being altered *and* any callees. | ||
/// | ||
/// Unlike the whole-model version of remove-returns, this will *not* alter the | ||
/// function's return type, because other passes are likely to use that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still accurate?
478f92f
to
abcf36f
Compare
@tautschnig comments applied except for |
f6b2989
to
032b299
Compare
@peterschrammel I suspect this is one you ought to review? Or possibly @cesaro? |
new_symbol.mode = function_symbol.mode; | ||
// If we're creating this for the first time, the target function cannot have | ||
// been remove_return'd yet, so this will still be the "true" return type: | ||
new_symbol.type = return_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we should have a consistency check function that could be used to add a debug-mode invariant whether a function has been remove_return'd or not. (Not TBD in this PR, but a note for future hardening of goto passes.)
src/goto-programs/remove_returns.cpp
Outdated
i_it->code=assignment; | ||
} | ||
// now turn the `return' into `assignment' | ||
i_it->type=ASSIGN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use i_it->make_assignment(assignment)
@@ -81,6 +83,10 @@ class java_bytecode_convert_methodt:public messaget | |||
/// Initialized in `convert`. | |||
unsigned slots_for_parameters; | |||
|
|||
/// True if the driver program will provide bodies for all stub functions; | |||
/// will be used to annotate stubs created upon discovery of a callsite. | |||
bool driver_program_provides_stubs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a use case for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test-gen acts this way: stub functions are given a body shortly after creation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to understand how this will fit with the discussions around #1585 in the end...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment if you (the driver program) have a non-default plan for stubs, you should set this parameter. For example, test-gen derives from java_bytecode_languaget
in order to make similar customisations, and will set this once this change hits CBMC.
Later I would like for stubbing to take place via a standard callback provided by languaget, such that the driver program supplies an implementation there instead of customising the language frontend. There could be standard implementations (replace with assume-false, add a Java-style nondet-object-graph stub, ...), or the driver could do something cleverer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea about urgencies, but really I'd want to see this addressed before merging this PR (knowing that this blocks a series of other PRs). My problem with the chosen approach is that function_is_stub
is a piece of configuration information, yet is never documented as such in, e.g., the symbol table. That is, the semantics of the program depend on function_is_stub
, but there is no way to recover from one choice or the other.
There is an ugly option of delaying things until symbolic execution, which would figure out that no function definition is present, and thus create an assignment to the return-value variable instead (where the communication that a return value is required is implicit via the existence of the return-value symbol). The advantage is that goto programs can be changed up to the very last moment.
The proposed "standard callback" solution seems preferable, but is possibly more work. Indeed the discussion in #1585 should be driven to a conclusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this actually isn't quite the same as the please-provide-a-stub callback, rather the question is, of a function that has not yet been loaded, will a body ever be provided? Therefore I propose for this PR I'll implement function_will_have_body
, a callback provided by the driver program (jbmc will check language_filest::lazy_method_map
to determine this, test-gen will always answer yes). That will remove the need for annotation on stub creation as is happening in this PR.
The provide-stub-body callback is an entirely separate matter, and should be pursued independently.
032b299
to
b1e2eea
Compare
@peterschrammel done one of your changes, replied to the other. |
b1e2eea
to
43b2d6d
Compare
@tautschnig made both these updates:
|
ba655c4
to
6daa808
Compare
@tautschnig @peterschrammel Travis failure is only on Mac builds cancelled due to problems at their end; this is ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good apart from some methods not having doxygen yet.
src/goto-programs/remove_returns.cpp
Outdated
i_it->code=assignment; | ||
} | ||
// now turn the `return' into `assignment' | ||
i_it->make_assignment(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a make_assignment variant that takes a codet.
I have restarted the Mac builds: https://www.traviscistatus.com/ suggests that even the Mac side of the house should be back. |
@@ -99,6 +99,11 @@ class lazy_goto_functions_mapt final | |||
return ensure_function_loaded_internal(name).second; | |||
} | |||
|
|||
bool can_produce_function(const key_type &name) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs documentation.
src/goto-programs/lazy_goto_model.h
Outdated
@@ -15,11 +15,18 @@ | |||
class cmdlinet; | |||
class optionst; | |||
|
|||
/// Interface | |||
struct can_produce_functiont |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interface to ... what?
/// Model that holds partially loaded map of functions | ||
class lazy_goto_modelt | ||
class lazy_goto_modelt : public can_produce_functiont |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what a can_produce_functiont
is supposed to be, hence I can't judge whether this is-a relation is justified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See new docs on the interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the clarification!
@@ -46,74 +51,91 @@ class remove_returnst | |||
void undo_function_calls( | |||
goto_functionst &goto_functions, | |||
goto_programt &goto_program); | |||
|
|||
symbol_exprt get_or_create_return_value_symbol(const irep_idt &function_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference: it would have been nice to place the refactoring (which is where this function came about) in a separate commit. I believe this refactoring is a big improvement, but also it caused the biggest code churn here.
new_symbol.type = return_type; | ||
// Return-value symbols will always be written before they are read, so there | ||
// is no need for __CPROVER_initialize to do anything: | ||
new_symbol.type.set(ID_C_no_initialization_required, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I should have commented on this days ago, but anyway: I like the idea, but would feel the .value
field is a better place for that than the .type
? It's not a property that is tied to the type, is it? I'm also saying this as the type continues to exist (that very same irept
can be shared across all the instantiations), while the value will be overwritten anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither is ideal -- really I want a map<irep_idt, irept> attributes
defined for each symbol and GOTO function, but that's a breaking change. I chose the type because I thought it less likely to get copied into a place where the annotation no longer makes sense. I also wanted this to work with symbols with value nil
, and nil-with-annotation-comment seemed dubious if anyone uses full_eq
to compare them. However I can switch it if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, one of the variants that are a breaking change is the right way to go. With that agreed, I'd think that .value
is a better place for it isn't getting duplicated during symbolic execution, but for sure it's not the perfect place either. I'll leave it to you to decide, certainly not a blocker in any way.
src/goto-programs/remove_returns.cpp
Outdated
typet return_type=f_it->second.type.return_type(); | ||
|
||
const irep_idt function_id=f_it->first; | ||
typet return_type=function.type.return_type(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest following clang-format
's suggestions throughout this patch as at least some of the changes do use the proposed formatting.
src/jbmc/jbmc_parse_options.cpp
Outdated
!available_functions.can_produce_function(id); | ||
}; | ||
|
||
// remove returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit pick: I don't think this comment adds value.
6daa808
to
ce3ea29
Compare
@tautschnig @peterschrammel changes applied. |
@tautschnig I also note that traviscistatus.com reports a 1800 job backlog for OSX nodes and 180 OSX nodes total, so I'm guessing it'll be at least half a day before anything runs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this now, with one proposed change left at @smowton's discretion.
/// Model that holds partially loaded map of functions | ||
class lazy_goto_modelt | ||
class lazy_goto_modelt : public can_produce_functiont |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the clarification!
This converts functions from conventional to via-global-variable return style on a function-by-function basis. It results in some complication, as the globals are now seen by the language's final pass, meaning it must ignore them for initialisation purposes, and we must cope with functions not having their "true" type while other functions are still being loaded. One test in cbmc-java failed because it was written in C, which we don't adapt to support incremental loading yet, so it is moved to the cbmc test directory, where it can still achieve its goal of checking whether uncaught_exceptions_analysist can tolerate CPROVER_assert and similar builtins, since cbmc also runs the remove_exceptions pass.
ce3ea29
to
96569c3
Compare
Confirmed with @peterschrammel in person that he is happy, so I'll merge this once Travis is done with this and the test-gen bump. |
I'll start reviewing the PRs based off of that one once merged and rebased. I'd appreciate a ping once that's the case. |
Only OSX pending. Merging rather than wait for more merge conflicts as the OSX builds take days at the moment. |
f7602af Merge commit 'bb88574aaa4043f0ebf0ad6881ccaaeb1f0413ff' into merge-develop-20180327 906aeb3 Merge pull request diffblue#349 from diffblue/owen-jones-diffblue/fix-compilation-for-release 3d8423c Merge pull request diffblue#350 from diffblue/owen-jones-diffblue/skip-duplicate-callsites-in-lazy-methods 73fb488 bugfix from upstream repo for generic crash fd76555 Speed up resolution of virtual callsites in lazy loading 3fd28f3 Replace assert(X) by UNREACHABLE/INVARIANT(X) 557158e Merge pull request diffblue#334 from diffblue/pull-support-20180216 1e48132 Merge from master, 20180216 ad7b28e Updates requsted in the PR: mostly rename 'size -> length'. e3fcb9b Introducing MAX_FILE_NAME_SIZE constant. bb88574 Merge pull request diffblue#1806 from thk123/refactor/address-review-comments-from-1796 db9c214 Merge pull request diffblue#1850 from tautschnig/include-cleanup 78fbf08 Merge pull request diffblue#1844 from smowton/smowton/feature/prepare-symex-for-lazy-loading 4098ed5 Merge pull request diffblue#1849 from smowton/smowton/cleanup/java-main-function-types 06f3e83 Use C++ headers instead of their C variants e918a91 Goto-symex: add support for general function accessor 9e31303 Symex: switch to incrementally populating address-taken locals ac5af68 Address-taken locals analysis: support incremental analysis fe775f3 Merge pull request diffblue#1843 from peterschrammel/instructions-function a6fd729 Cleanup tests with anomalous main functions 5df3fca Clean up get_function_id hacks 552b100 Set function member of each goto instruction in goto program passes 38e6e4a Merge pull request diffblue#1813 from smowton/smowton/fix/cleanup-unused-clinits 278e4e6 Merge pull request diffblue#1826 from smowton/smowton/fix/java-inherited-static-fields a2ebb33 Merge pull request diffblue#1713 from karkhaz/kk-debug-timestamps 7b5dd17 Merge pull request diffblue#1834 from diffblue/library-preconditions 1da5be1 Add tests for inherited static fields 19d622b Add tests to verify that synthetic method removal is performed adc9fd4 Java frontend: clean up unused clinit symbols f15c312 Exclude j.l.O from possible static field hosts. afa443c US spelling of initialize d4d4a9a Tolerate stub static fields defined on non-stub types 873e1f6 Guess public access for stub globals d6783d8 Java method converter: look for inherited static fields 32cc538 Insert stub static globals onto any incomplete ancestor class b2d3d61 Search static fields inherited from interfaces 045ac05 Create stub globals on the first parent incomplete class 5b3cde5 Use a common instance of class_hierarchyt in get_inherited_component e73e756 Create stub globals: check for inherited globals bea6371 Annotate static fields with accessibility 168c2a8 Generalise get_inherited_method f3160e1 resolve_concrete_function_callt -> resolve_inherited_componentt 82549de Emit timestamps on each line of output 3f6965b Replace util/timer* with std::chrono ef08ae2 Merge pull request diffblue#1820 from smowton/smowton/fix/remove-string-solver-iteration-limit 0f20482 Merge pull request diffblue#1836 from karkhaz/kk-remove-unused-lambda-capture e8105bd Merge pull request diffblue#1833 from diffblue/symex_class_cleanup f6f45fc turn some assertions in the stdlib.h models into preconditions 9ea0cc6 pre-conditions for strings fbd54df Remove unused lambda capture 9620802 Merge pull request diffblue#1815 from smowton/smowton/feature/replace-clinit-unwinder 9b59631 Merge pull request diffblue#1828 from smowton/smowton/cleanup/remove-recreate-initialize 1ac9abe Remove string refinement iteration limit c94548c preconditions for delete and delete[] 9ba7fe2 cleanup of some noise (mostly obvious declarators) in the goto_symext class bb64ea6 clean up symex_assign vs. symex_assign_rec 932a38f Merge pull request diffblue#1827 from karkhaz/kk-symex-operator-tidy 968d97e Remove __CPROVER_initialize recreation 06a220a Reimplement remove-static-init-loops to avoid need to inspect GOTO program 2bb98d9 Merge pull request diffblue#1819 from romainbrenguier/refactor/coverage-instrumentation 6492b3a Rearrange cover_basic_blocks header a9549e7 Define constants as const fa35ccd Pull continuation_of_block function out 560d712 Declare constants as const 35422f3 Make update_covered_lines a static function b4cadf8 [path explore 1/8] Tidy up symext top-level funs 0f3ae1a Make representative_inst an optional dc696a4 Make format_number_range function instead of class 678218a Merge pull request diffblue#1825 from thk123/refactor/corrected-path-of-language-file ba76a8f Merge pull request diffblue#1751 from tautschnig/fix-1748 b665269 Correcting path to a file d0889a8 Merge pull request diffblue#1822 from diffblue/legacy-language 441f706 Merge pull request diffblue#1823 from diffblue/cleanup 11714b2 use constant_exprt version of to_integer 733f3b8 remove old-style constructor for member_exprt 63f09ac remove unused function make_next_state 77c8b9c remove translation for certain boolean program constructs 1bac484 cleanout decision_proceduret::in_core d8967f5 moving language.h and language_file.h to langapi folder f9b9599 Merge pull request diffblue#1761 from diffblue/function_typet dd040e5 Added function_typet. bcd88a0 Merge pull request diffblue#1821 from smowton/smowton/feature/test-pl-tags 45f0939 test.pl: add support for tagging test-cases 40b8c03 Updates requested in PR - mainly rename of functions. 7f868e2 Reused private code in 'remove_virtual_functions.cpp' by making it public. ae6775a Merge pull request diffblue#1790 from martin-cs/fix/correct-domain-interface d7bb937 Catch the case when a GOTO instruction is effectively a SKIP. b2fba97 Correct domain transformers so that they meet the preconditions. d447c26 Document the invariants on iterators arguments to transform and merge. e3db794 Whitespace changes to keep clang-format happy. 1990994 Revert "Add edge type parameter to ai transform method" 3ca91bc Revert "Fix iterator comparison bug in reaching_definitions.cpp" ac036fd Revert "Fix iterator equality check bug in dependence_graph.cpp" 86cadcd Revert "Fix iterator equality check bug in custom_bitvector_analysis.cpp" db925de Revert "Fix iterator equality check bug in constant_propagator.cpp" 2c69364 Merge pull request diffblue#1811 from cesaro/iterator-fix 807268e Fixes the symbol_base_tablet iterator 0df054c Merge pull request diffblue#1781 from smowton/smowton/feature/java-create-stub-globals-earlier e163ab6 Java frontend: create synthetic static initialisers for stub globals fbcb423 Merge pull request diffblue#1802 from NathanJPhillips/feature/symbol_iterator e106cf8 Merge pull request diffblue#1793 from smowton/smowton/cleanup/remove-java-new-lowering-pass 52dfc36 Merge pull request diffblue#1731 from diffblue/bugfix/all_resolved_calls f123ae9 Adding comment referencing where the invariant comes from f7c89e1 Add iterator for symbol_table_baset 150f826 Merge pull request diffblue#1801 from hannes-steffenhagen-diffblue/add-idea-gitignore 745afbc Merge pull request diffblue#1796 from thk123/refactor/bytecode-parsing-tidy 6362295 Add .idea (CLion) directory to .gitignore 31da890 Revert "Do lowering of java_new as a function-level pass" 6f6fda7 Merge pull request diffblue#1794 from smowton/smowton/fix/goto-diff-test-escapes 4a538d2 Adding comments on the non-standard patternt 9bfe177 Adding an early guard for correctly parsed exception table 6fe1808 Improved error reporting on invalid constant pool index 93dab4c Escape curly braces in regexes 814cfcc Adapt failing unit test for value set analysis 3ff90bc Add unit test e67a96e Add regression test 3df5348 Adapt regression tests for virtual functions. 09efc90 Re-Resolve function calls if only java.lang.Object was found. a619e48 Merge pull request diffblue#1763 from jeannielynnmoulton/base_class_info_tg1287 0b8dd57 Merge pull request diffblue#1785 from smowton/smowton/fix/core-models-cmake-script 50dcec8 Adding unit tests for extracting generic bases' info 54df3a1 Correcting generic parameters in bases for implicitly generic classes 6d691d7 Parsing generic bases' information into the class symbol 7d041f0 Defining a new type for generic bases f10eb71 Fix Java core-models build script 8d66028 Merge pull request diffblue#1774 from smowton/smowton/feature/java-create-clinit-state-earlier 679d9b8 Java frontend: create static initialiser globals ahead of time 4a93a29 Merge pull request diffblue#1788 from smowton/smowton/fix/java_tcmp_nan 6ad8ffd Fix Java ternary-compare against NaN 1e0ac30 Turn get_may, set_may, etc into irep_ids b0cb1ee Merge pull request diffblue#1766 from smowton/smowton/feature/java-frontend-create-literal-globals-early a2e3af5 Merge pull request diffblue#1744 from smowton/smowton/feature/instrument_cover_per_function 22ae7aa Merge pull request diffblue#1637 from tautschnig/bswap a1a972f Merge pull request diffblue#1776 from smowton/smowton/feature/class-hierarchy-grapht ef3c598 Merge pull request diffblue#1775 from diffblue/refactor/set_classpath 45dd840 Merge pull request diffblue#1728 from romainbrenguier/refactor/split-axiom-vectors 8a27950 Java frontend: create String an Class literals earlier d95cb12 Move string literal initialisation into separate file 515ebdd CI lazy methods: scan global initialisers for global references cab7b52 C front-end: fix promotion order for types ranking lower than int c450328 Support for --16 on Visual Studio, no _WIN64 in 32-bit mode b2c4188 Do not use non-trivial system headers with --32 80b972b Use split_string in set_classpath fdb2ebc Merge pull request diffblue#1773 from smowton/smowton/feature/string-solver-ensure-class-graph-consistency a6eed7c Add class-hierarchy variant based on grapht 311af6d Coverage: fully support instrumenting one function at a time ceafd85 Java string solver: ensure base types are loaded 1e17db6 Merge pull request diffblue#1735 from cesaro/core-models 6844760 Merge pull request diffblue#1769 from smowton/smowton/fix/nondet-initialize-after-initialize a8e659c Fixed CMake linker ODR violations caused by a regression-test f66288b Internalize core models of the Java Class Library 34216f5 Refactor jar loading ed008f9 Add constructors for having memory-loaded jar files This allows the jar_file class to load from a buffer (c array) as opposed to a file 86a34c9 Merge pull request diffblue#1765 from smowton/smowton/fix/ci-lazy-methods-array-element-types 1e11f6d Add test for multiple array types in single method 5009cbb CI lazy methods: re-explore array types with different element types 857fcf9 Cleanup unused fields in string refinement 51d86f5 Adapt unit tests for splitted axiom vectors 1843e44 Split string generator axioms into separate vectors 5669d9b Java: run nondet-initialize method *after* initialization 0b5a5c3 Rename test case 3440018 Provide function name in goto_model_functiont f17e2c8 Merge pull request diffblue#1741 from smowton/smowton/feature/add_failed_symbols_per_function f65f0fd Merge pull request diffblue#1764 from smowton/smowton/feature/java-infer-opaque-type-fields-earlier dbc00a7 Add doxygen to add-failed-symbols 3788467 JBMC: add failed symbols on a per-function basis e934867 Provide a journalling symbol table to process-goto-function e86e2a0 Java: infer opaque type fields before method conversion f0f50e3 Journalling symbol table: enable nesting 58d5980 Merge pull request diffblue#1740 from smowton/smowton/feature/adjust_float_expressions_per_function c91ff69 JBMC: adjust float expressions per function eed983a JBMC: add property checks on a per-function basis db3bc99 JBMC: run convert-nondet on a per-function basis 99ea8fe JBMC: run replace-Java-nondet on function-by-function basis bfd4f50 Merge pull request diffblue#1730 from smowton/smowton/feature/remove_returns_per_function 96569c3 JBMC: remove return values on a per-function basis a7595c1 Remove returns: support running per-function fd6e195 Merge pull request diffblue#1718 from cesaro/concurrency-team-small-fixes e6fe617 Merge pull request diffblue#1705 from jgwilson42/goto-diff-tests 22afc5c Fixes wrong invocation order for static initializers 5c3997d Refectors how CBMC interprets a codet thread-block 001c1a2 ireps of type "ID_atomic_begin" and "ID_atomic_end" will now be properly displayed when the "show-symbol-table" flag is specified. d978ef9 Folder build/ ignored. bc145fd Merge pull request diffblue#1756 from romainbrenguier/tests/index-of-corrections#TG-2246 47b4ee9 Merge pull request diffblue#1725 from cesaro/exception-handlig-fixes d397d6a Merge pull request diffblue#1726 from diffblue/multi_ary_expr2c bd95317 Merge pull request diffblue#1753 from diffblue/xor_exprt 1d4af6d Merge pull request diffblue#1747 from NathanJPhillips/feature/upstream-cleanup 9c7debb Merge pull request diffblue#1750 from pkesseli/feature/sat-interrupt f11c995 Merge pull request diffblue#1749 from pkesseli/ci/remove-unapproved 981c8e0 Merge pull request diffblue#1743 from tautschnig/dump-c-fix bcb076b Correct tests for String.indexOf ef5c6f0 Merge pull request diffblue#1742 from owen-jones-diffblue/owen-jones-diffblue/small-shared-ptr 6c9f05e Fixes to exception handling behaviour 80dd48a added multi-ary xor_exprt 703e4a3 Remove unapproved C++11 header warning. bf7ed1a Merge pull request diffblue#313 from diffblue/owen-jones-diffblue/add-structured-lhs-to-value-set cc9398d Expose MiniSAT's `interrupt()` 8360233 Merge pull request diffblue#1646 from peterschrammel/list-goto-functions e4a2763 Tests for scope changes for variables and functions 8ee1956 goto-diff tests for package name changes ce3a5e9 Basic tests for java goto-diff 3bf9987 Compare access qualifiers in goto-diff f71cc7f Attach class name to method symbol 1f06d35 Merge pull request diffblue#312 from diffblue/pull-support-20180112 fda9daa Cleanup of create-and-swap to emplace e42e97a Merge commit '23666e3af35673c734c9816ffc131b6b9a379e86' into pull-support-20180112 53f1a41 Populate structured_lhs in all `entryt`s d7121f2 dump-c: fix support of use-system-headers eb5ec24 Merge pull request diffblue#1736 from hannes-steffenhagen-diffblue/develop_fix-bitfield-pretty-printing 7a0de46 Add comment suggested by @owen-jones-diffblue b741d4b Use small intrusive pointer in irep 434cc99 Merge pull request diffblue#1732 from peterschrammel/catch-sat-memout 8ae53bb Merge pull request diffblue#1733 from peterschrammel/mem-limit 574101c Add `structured_lhs` field to entryt 4f1a67a Uses alternatives to get_string in type2name when possible b46149d Merge pull request diffblue#1719 from smowton/smowton/cleanup/remove_exceptions_single_global 82a7ec6 Adds regression test for bitfield naming bug 651d8d1 Fixes use of wrong identifier when pretty printing bitfield types 638937a Merge pull request diffblue#1709 from romainbrenguier/doc/string-solver-intro 1d1be4c Move non-string-specific part of doc to solvers 549eb57 Delete trailing whitespaces db3e044 Add introduction to string solver documentation 74be7fb Merge pull request diffblue#1729 from romainbrenguier/refactor/unused-nonempty-option d101b22 Set memory limit utility ef45a1d Replace assertions by invariants 84e04a7 Catch Glucose::OutOfMemoryException 89fc48d Replace assertions by invariants 5e85701 Catch Minisat::OutOfMemoryException b8cee29 Enable list-goto-functions in clobber d902ec8 Replace cout by message stream in show-goto-functions d970673 Move show-loops in the right place in goto-diff e1227ef Enable list-goto-functions in goto diff 7e1110c Enable list-goto-functions in goto-instrument 0fb4868 Enable list-goto-functions in goto-analyzer e67abfa Remove exceptions: switch to single inflight exception global 2fabbd4 Enable list-goto-functions in JBMC 9e1705f Enable list-goto-functions in CBMC ebd8248 Add list-goto-functions command line option 2fe43a9 Add parameter to list goto functions without printing bodies 3d492fe Add documentation of return values 5a8eea5 Remove the string-non-empty option 9810f92 Drop string_non_empty field for string refinement fec16d7 expr2c now distinguishes binary and multi-ary expressions d16a918 C library: network byteorder functions 05bc9ed Implement bswap in SAT back-end 4f37035 Introduce bswap_exprt git-subtree-dir: cbmc git-subtree-split: f7602af
Another day, another pass converted to per-function operation. This one is really quite awkward, though: remove-returns transforms
x = f();
intof(); x = f#return_value;
, and doing this function-by-function with other passes interleaved necessarily introduces some discord when a caller that hasn't been converted deals with a callee that has, or vice versa.I've had a stab at a least-bad solution, and come up with:
#return_value
variables on demand.#return_value
. However such a pass would normally assume all functions are void-typed in any case.In summary, remove-returns is a really messy pass. The "proper" solution would be to separate the notions of return type and result type, and always use the latter plus a "get result" function that hides whether a function is in conventional or via-global style. However I suspect attempting to implement that now would be a fool's errand.