Skip to content

Commit 4ee0c97

Browse files
committed
wmm/musketeer: Use wmm_grapht::node_indext instead of unsigned
1 parent 2da51e7 commit 4ee0c97

File tree

7 files changed

+187
-186
lines changed

7 files changed

+187
-186
lines changed

src/goto-instrument/wmm/event_graph.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Function: event_grapht::print_rec_graph
3434
3535
\*******************************************************************/
3636

37-
void event_grapht::print_rec_graph(std::ofstream& file, unsigned node_id,
38-
std::set<unsigned>& visited)
37+
void event_grapht::print_rec_graph(std::ofstream& file, event_idt node_id,
38+
std::set<event_idt>& visited)
3939
{
4040
const abstract_eventt& node=operator[](node_id);
4141
file << node_id << "[label=\"" << node << ", " << node.source_location <<
@@ -76,8 +76,8 @@ Function: event_grapht::print_graph
7676

7777
void event_grapht::print_graph() {
7878
assert(po_order.size()>0);
79-
std::set<unsigned> visited;
80-
unsigned root=po_order.front();
79+
std::set<event_idt> visited;
80+
event_idt root=po_order.front();
8181
std::ofstream file;
8282
file.open("graph.dot");
8383
file << "digraph G {" << std::endl;
@@ -99,8 +99,8 @@ Function: event_grapht::copy_segment
9999
100100
\*******************************************************************/
101101

102-
void event_grapht::explore_copy_segment(std::set<unsigned>& explored,
103-
unsigned begin, unsigned end) const
102+
void event_grapht::explore_copy_segment(std::set<event_idt>& explored,
103+
event_idt begin, event_idt end) const
104104
{
105105
//std::cout << "explores " << begin << " against " << end << std::endl;
106106
if(explored.find(begin)!=explored.end())
@@ -117,7 +117,7 @@ void event_grapht::explore_copy_segment(std::set<unsigned>& explored,
117117
explore_copy_segment(explored, it->first, end);
118118
}
119119

120-
unsigned event_grapht::copy_segment(unsigned begin, unsigned end)
120+
event_idt event_grapht::copy_segment(event_idt begin, event_idt end)
121121
{
122122
const abstract_eventt& begin_event=operator[](begin);
123123
const abstract_eventt& end_event=operator[](end);
@@ -137,25 +137,25 @@ unsigned event_grapht::copy_segment(unsigned begin, unsigned end)
137137

138138
message.status() << "tries to duplicate between " << begin_event.source_location
139139
<< " and " << end_event.source_location << messaget::eom;
140-
std::set<unsigned> covered;
140+
std::set<event_idt> covered;
141141

142142
/* collects the nodes of the subgraph */
143143
explore_copy_segment(covered, begin, end);
144144

145145
if(covered.size()==0)
146146
return end;
147147

148-
// for(std::set<unsigned>::const_iterator it=covered.begin(); it!=covered.end(); ++it)
148+
// for(std::set<event_idt>::const_iterator it=covered.begin(); it!=covered.end(); ++it)
149149
// std::cout << "covered: " << *it << std::endl;
150150

151-
std::map<unsigned, unsigned> orig2copy;
151+
std::map<event_idt, event_idt> orig2copy;
152152

153153
/* duplicates nodes */
154-
for(std::set<unsigned>::const_iterator it=covered.begin();
154+
for(std::set<event_idt>::const_iterator it=covered.begin();
155155
it!=covered.end();
156156
++it)
157157
{
158-
const unsigned new_node=add_node();
158+
const event_idt new_node=add_node();
159159
operator[](new_node)(operator[](*it));
160160
orig2copy[*it]=new_node;
161161
}
@@ -165,11 +165,11 @@ unsigned event_grapht::copy_segment(unsigned begin, unsigned end)
165165
// (working on back-edges...)
166166

167167
/* replicates the po_s forward-edges -- O(#E^2) */
168-
for(std::set<unsigned>::const_iterator it_i=covered.begin();
168+
for(std::set<event_idt>::const_iterator it_i=covered.begin();
169169
it_i!=covered.end();
170170
++it_i)
171171
{
172-
for(std::set<unsigned>::const_iterator it_j=covered.begin();
172+
for(std::set<event_idt>::const_iterator it_j=covered.begin();
173173
it_j!=covered.end();
174174
++it_j)
175175
{
@@ -187,11 +187,11 @@ unsigned event_grapht::copy_segment(unsigned begin, unsigned end)
187187

188188
// TODO: to move to goto2graph, after po_s construction
189189
/* replicates the cmp-edges -- O(#E x #G) */
190-
for(std::set<unsigned>::const_iterator it_i=covered.begin();
190+
for(std::set<event_idt>::const_iterator it_i=covered.begin();
191191
it_i!=covered.end();
192192
++it_i)
193193
{
194-
for(unsigned it_j=0;
194+
for(event_idt it_j=0;
195195
it_j<size();
196196
++it_j)
197197
{
@@ -547,8 +547,8 @@ bool event_grapht::critical_cyclet::is_unsafe(memory_modelt model, bool fast)
547547
if(first.unsafe_pair(second,model)
548548
&& (first.thread!=second.thread || egraph.are_po_ordered(back(),*s_it)))
549549
{
550-
std::list<unsigned>::const_iterator before_first;
551-
std::list<unsigned>::const_iterator after_second;
550+
std::list<event_idt>::const_iterator before_first;
551+
std::list<event_idt>::const_iterator after_second;
552552

553553
before_first = end();
554554
--before_first;
@@ -581,8 +581,8 @@ bool event_grapht::critical_cyclet::is_unsafe(memory_modelt model, bool fast)
581581
if(first.unsafe_pair_lwfence(second,model)
582582
&& (first.thread!=second.thread || egraph.are_po_ordered(back(),*s_it)))
583583
{
584-
std::list<unsigned>::const_iterator before_first;
585-
std::list<unsigned>::const_iterator after_second;
584+
std::list<event_idt>::const_iterator before_first;
585+
std::list<event_idt>::const_iterator after_second;
586586

587587
before_first = end();
588588
--before_first;
@@ -1332,7 +1332,7 @@ Function: event_grapht::critical_cyclet::hide_internals
13321332

13331333
void event_grapht::critical_cyclet::hide_internals(critical_cyclet& reduced) const
13341334
{
1335-
std::set<unsigned> reduced_evts;
1335+
std::set<event_idt> reduced_evts;
13361336
const_iterator first_it, prev_it=end();
13371337

13381338
/* finds an element first of its thread */

0 commit comments

Comments
 (0)