CBMC
memory_model_pso.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Memory model for partial order concurrency
4 
5 Author: Michael Tautschnig, michael.tautschnig@cs.ox.ac.uk
6 
7 \*******************************************************************/
8 
11 
12 #include "memory_model_pso.h"
13 
15 operator()(symex_target_equationt &equation, message_handlert &message_handler)
16 {
17  messaget log{message_handler};
18  log.statistics() << "Adding PSO constraints" << messaget::eom;
19 
20  build_event_lists(equation, message_handler);
22 
23  read_from(equation);
25  program_order(equation);
26 #ifndef CPROVER_MEMORY_MODEL_SUP_CLOCK
27  from_read(equation);
28 #endif
29 }
30 
34 {
35  PRECONDITION(e1->is_shared_read() || e1->is_shared_write());
36  PRECONDITION(e2->is_shared_read() || e2->is_shared_write());
37 
38  // no po relaxation within atomic sections
39  if(e1->atomic_section_id!=0 &&
40  e1->atomic_section_id==e2->atomic_section_id)
41  return false;
42 
43  // no relaxation if induced wsi
44  if(e1->is_shared_write() && e2->is_shared_write() &&
45  address(e1)==address(e2))
46  return false;
47 
48  // only read/read and read/write are maintained
49  return e1->is_shared_write();
50 }
void read_from(symex_target_equationt &equation)
For each read r from every address we collect the choice symbols S via register_read_from_choice_symb...
virtual bool program_order_is_relaxed(partial_order_concurrencyt::event_it e1, partial_order_concurrencyt::event_it e2) const
virtual void operator()(symex_target_equationt &equation, message_handlert &)
void from_read(symex_target_equationt &equation)
void write_serialization_external(symex_target_equationt &equation)
void program_order(symex_target_equationt &equation)
Class that provides messages with a built-in verbosity 'level'.
Definition: message.h:154
static eomt eom
Definition: message.h:289
void build_event_lists(symex_target_equationt &equation, message_handlert &message_handler)
First call add_init_writes then for each shared read/write (or spawn) populate: 1) the address_map (w...
irep_idt address(event_it event) const
Produce an address ID for an event.
void build_clock_type()
Initialize the clock_type so that it can be used to number events.
eventst::const_iterator event_it
Inheriting the interface of symex_targett this class represents the SSA form of the input program as ...
double log(double x)
Definition: math.c:2776
Memory models for partial order concurrency.
#define PRECONDITION(CONDITION)
Definition: invariant.h:463