-
Notifications
You must be signed in to change notification settings - Fork 274
Machine learning support #633
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
Changes from 13 commits
f5f7b24
23287ed
456088a
ddc580d
928865f
611c905
def160b
14fde02
09565f7
7d6191b
d5691f6
3ceed49
d0a5d31
3c33f66
27da466
e47fd39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ Author: Daniel Kroening, [email protected] | |
#include <util/symbol_table.h> | ||
#include <util/source_location.h> | ||
#include <util/std_expr.h> | ||
#include <util/irep_hash.h> | ||
|
||
typedef enum | ||
{ | ||
|
@@ -263,6 +264,11 @@ class goto_program_templatet | |
instruction_id_builder << type; | ||
return instruction_id_builder.str(); | ||
} | ||
|
||
std::size_t stable_hash() const | ||
{ | ||
return hash_combine(code.stable_hash(), guard.stable_hash()); | ||
} | ||
}; | ||
|
||
typedef std::list<instructiont> instructionst; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ void cover_goalst::mark() | |
prop_conv.l_get(g.condition).is_true()) | ||
{ | ||
g.status=goalt::statust::COVERED; | ||
g.seconds=(current_time()-start_time); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this about? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is used to track the progression of coverage (i.e: at what time is each goal covered). |
||
_number_covered++; | ||
|
||
// notify observers | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ Author: Daniel Kroening, [email protected] | |
#define CPROVER_SOLVERS_PROP_COVER_GOALS_H | ||
|
||
#include <util/message.h> | ||
#include <util/time_stopping.h> | ||
|
||
#include "prop_conv.h" | ||
|
||
|
@@ -29,6 +30,7 @@ class cover_goalst:public messaget | |
explicit cover_goalst(prop_convt &_prop_conv): | ||
prop_conv(_prop_conv) | ||
{ | ||
start_time=current_time(); | ||
} | ||
|
||
virtual ~cover_goalst(); | ||
|
@@ -41,6 +43,7 @@ class cover_goalst:public messaget | |
struct goalt | ||
{ | ||
literalt condition; | ||
time_periodt seconds; | ||
enum class statust { UNKNOWN, COVERED, UNCOVERED, ERROR } status; | ||
|
||
goalt():status(statust::UNKNOWN) | ||
|
@@ -92,6 +95,7 @@ class cover_goalst:public messaget | |
} | ||
|
||
protected: | ||
absolute_timet start_time; | ||
std::size_t _number_covered; | ||
unsigned _iterations; | ||
prop_convt &prop_conv; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,12 @@ inline size_t hash_string(const dstringt &s) | |
return s.hash(); | ||
} | ||
|
||
inline size_t stable_hash_string(const dstringt &s) | ||
{ | ||
return hash_string(string_container.get_string(s.get_no())); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In line with what @martin-cs said: what exactly does this seek to achieve? In particular, this actually invokes the much more costly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @martin-cs, @tautschnig: There is a need for us to identify goto-program hashes across commits (of the target software) in the case of differential analysis (specifically, we record hash-tagged information from an analysis and need to relate it to a new analysis done after some changes to the code). The current hash uses the id no. which can change from build to build while we actually hash the string. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, thanks for clarifying. May I ask for such information to be included in commit messages for others to understand what's happening - that would be very helpful. Also, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. Done. |
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit picking: a single blank line will do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thx for the catch, fixed |
||
inline std::ostream &operator<<(std::ostream &out, const dstringt &a) | ||
{ | ||
return a.operator<<(out); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -923,6 +923,49 @@ std::size_t irept::full_hash() const | |
|
||
/*******************************************************************\ | ||
|
||
Function: irept::stable_hash | ||
|
||
Inputs: | ||
|
||
Outputs: | ||
|
||
Purpose: Stable hash, hashes the actual content of the string. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit confusing: it will hash the actual contents of all contained strings (as is, the comment would rather fit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the comment to reflect this |
||
Can be used to identify hashes across commits | ||
(of the target software) | ||
|
||
\*******************************************************************/ | ||
|
||
std::size_t irept::stable_hash() const | ||
{ | ||
const irept::subt &sub=get_sub(); | ||
const irept::named_subt &named_sub=get_named_sub(); | ||
const irept::named_subt &comments=get_comments(); | ||
|
||
std::size_t result=stable_hash_string(id()); | ||
|
||
forall_irep(it, sub) result=hash_combine(result, it->full_hash()); | ||
|
||
forall_named_irep(it, named_sub) | ||
{ | ||
result=hash_combine(result, stable_hash_string(it->first)); | ||
result=hash_combine(result, it->second.full_hash()); | ||
} | ||
|
||
forall_named_irep(it, comments) | ||
{ | ||
result=hash_combine(result, stable_hash_string(it->first)); | ||
result=hash_combine(result, it->second.full_hash()); | ||
} | ||
|
||
result=hash_finalize( | ||
result, | ||
named_sub.size()+sub.size()+comments.size()); | ||
|
||
return result; | ||
} | ||
|
||
/*******************************************************************\ | ||
|
||
Function: indent | ||
|
||
Inputs: | ||
|
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.
What are those changes about and why do they belong in here?
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.
In order to extract the dependency information from the graph in order to create our input dependency, we need access to the data (ie control_deps and data_deps). These are getters for those structures.