- update_inst_tree(&inst_list);
- update_predicate_tree(&rw_act_list);
-
- // Revert back action types and free
- for (sllnode<ModelAction *> * it = act_list->begin(); it != NULL;) {
- ModelAction * act = it->getVal();
- // Do iteration early in case we delete read actions
- it = it->getNext();
-
- // Collect write actions and reads_froms
- if (act->is_read()) {
- if (act->is_rmw()) {
- write_actions.add(act);
- }
-
- ModelAction * rf = act->get_reads_from();
- write_actions.add(rf);
- } else if (act->is_write()) {
- write_actions.add(act);
- }
-
- // Revert back action types
- if (act->is_read()) {
- ModelAction * rf = act->get_reads_from();
- if (rf->get_swap_flag() == true)
- rf->use_original_type();
- }
-
- if (act->get_swap_flag() == true)
- act->use_original_type();
-
- // Free read actions
- if (act->is_read()) {
- if (act->is_rmw()) {
- // Do nothing. Its reads_from can not be READY_FREE
- } else {
- ModelAction *rf = act->get_reads_from();
- if (rf->is_free()) {
- model_print("delete read %d; %p\n", act->get_seq_number(), act);
- delete act;
- }
- }
+ if (act->is_read()) {
+
+ /* If func_inst may only read_from a single location, then:
+ *
+ * The first time an action reads from some location,
+ * import all the values that have been written to this
+ * location from ModelHistory and notify ModelHistory
+ * that this FuncNode may read from this location.
+ */
+ if (!read_locations->contains(loc) && func_inst->is_single_location()) {
+ read_locations->add(loc);
+ value_set_t * write_values = write_history->get(loc);
+ add_to_val_loc_map(write_values, loc);
+ history->update_loc_rd_func_nodes_map(loc, this);