-
Notifications
You must be signed in to change notification settings - Fork 0
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
[TG-1404] Specific implementation of cover basic block for Java #4
[TG-1404] Specific implementation of cover basic block for Java #4
Conversation
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.
LGTM
@@ -117,4 +101,33 @@ class cover_basic_blockst : public cover_blocks_baset | |||
std::vector<block_infot> block_infos; | |||
}; | |||
|
|||
class cover_basic_blocks_javat : public cover_blocks_baset |
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 add mark cover_basic_blocks_javat
as final
.
@@ -28,21 +28,26 @@ Date: May 2016 | |||
void instrument_cover_goals( |
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.
Since this function has so many arguments, could they be packed into an instrument_cover_goals_infot
struct?
{ | ||
block_infos.push_back(it); | ||
index_to_block.insert( | ||
std::make_pair(bytecode_index, block_infos.size() - 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.
You write it as insert({ bytecode_index, block_infos.size() - 1})
or emplace(bytecode_index, block_infos.size() - 1)
to avoid std::make_pair
.
message_handlert &message_handler){}; | ||
}; | ||
|
||
class cover_basic_blockst : public cover_blocks_baset |
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 mark cover_basic_blockst
as final
.
56faac0
to
0c5925a
Compare
3ef6759
to
3454ef1
Compare
efddc26
to
eb6463f
Compare
The operator() functions in goto_symext now have explicit names. Previous commits have overloaded these functions with several combinations of arguments; the renaming is in preparation for a future commit that would necessitate even more overloadings, with the same parameter types. Several of goto_symext's functions have been made protected rather than public, as they are only called from the top-level goto_symext functions. The two_argument operator() function is removed completely, as it was only called from a single place and was only two lines long. Its implementation is moved to the caller.
eb6463f
to
6492b3a
Compare
…ge-instrumentation Refactoring in coverage instrumentation
…ogram This was supplying synthetic --unwind parameters for each loop found in the GOTO program, but that required early access to the GOTO code, which will not be available under symex- driven lazy loading. Therefore we replace that pass with a handler mechanism that allows the driver program to provide its own callback to make unwinding decisions, and use it in JBMC to ensure that enumeration type static initialisers are unwound sufficiently.
This used to be necessary to account for stub globals and stub class fields that were discovered during method elaboration; however, now that they are all discovered up front there is no need.
0c5925a
to
f8a159d
Compare
[path explore 1/8] Tidy up symext top-level funs
f8a159d
to
20f8bb2
Compare
This sets the string refinement iteration limit to zero, i.e. unlimited. The mechanism for providing a limit is left in place, for use probably driven by a command-line argument by the first user to need that facility.
…recreate-initialize Remove __CPROVER_initialize recreation
…-clinit-unwinder Reimplement remove-static-init-loops to avoid need to inspect GOTO program
The unused capture breaks the build when compiling with clang++ >= 5.0.1.
Symex class cleanup
…-capture Remove unused lambda capture
1083f74
to
f540273
Compare
…ng-solver-iteration-limit Remove string solver iteration limit
Normally this situation (a reference to static field A.x, when neither A nor any of its ancestors either define a field x or are opaque stubs) would be an error, probably indicating a class version mismatch, but at present some of our library models intentionally exploit this behaviour to obtain a nondet- initialised field. Therefore for the time being we tolerate the situation, initialising such fields in __CPROVER_initialize, as we cannot attach a synthetic clinit method to a non-stub type.
No functional changes.
Previously clinit wrappers that had been generated but never actually called would remain in the GOTO program as empty, uncalled functions. Now they are cleaned up in the same way as unused user functions.
These check that direct and indirect clinit wrappers, as well as stub class synthetic static initialisers, are removed if they are generated but not subsequently called.
These cover various permutations of static fields defined on parents, on interfaces, and those parents and/or interfaces being opaque (stubs). They check both that jbmc doesn't outright crash, and in some cases that jbmc correctly determines that two static fields must be the same one, and therefore cannot differ.
Library preconditions
Emit timestamps on each line of output
…ted-static-fields Add support for inheritence of Java static fields. Fixes TG-2457
…sed-clinits Java frontend: clean up unused clinit symbols
The block numbers in cover_basic_blockst are obtained from `block_info.size() - 1`, they should have type std::size_t rather than unsigned. Also mark const a couple of arguments that are constant.
This will allow to have two implementations for this functor.
This is a specific implementation of cover block for Java. It uses the bytecode index to determine blocks and replace the use of select_unique_java_bytecode_indices.
The index is checked against the size before end so there is no need to use at there.
JBMC use to group together several lines within the same block. This is no longer the case for the Java specific block instrumentation. Each line is part of a different goal.
750cbfc
to
788ba62
Compare
This checks that coverage instrumentation assertions are added at the first instruction with given bytecode index. And that there is no such assertion in the middle of instructions with same bytecode index.
788ba62
to
2ef935e
Compare
actual PR on cbmc diffblue#1830 |
This global name map will be used to check what generation is currently available for each level1 name, and shared across all states. This will only be used when a particular state tries to find out what the next free generation is. The main draw of this is that all branches will now assign unique generations that won't clash with assignments done across other branches. One minor downside is that in VCC's the generation number might jump sporadically (say from #4 to diffblue#40).
The current implementation of
cover_basic_blockt
does a first pass on the goto-program without using the bytecode index information, and then later select instruction for bytecode indices.The process is a bit complicated and sometimes instruments instruction that are after an IF of the same bytecode indices, leading to wrong information about bytecode coverage.
This PR intruduce an alternative
cover_basice_block_javat
, which for Java use the bytecode information to determine what are the blocks of the program, and selects the first instruction with that bytecode index as a representative.This strategy is simple and ensures each goal corresponds to a bytecode index coverage.