- // For read actions being used by ModelHistory, mark the reads_from as being used.
- if (act->is_read() && act->getFuncActRef() != NULL) {
- ModelAction * reads_from = act->get_reads_from();
- if (reads_from->getFuncActRef() == NULL)
- reads_from->setFuncActRef(HAS_REFERENCE);
+ // For read or rmw actions being used by ModelHistory, mark the reads_from as being used.
+ if (act->is_read()) {
+ if (act->is_rmw()) {
+ void * func_act_ref = act->getFuncActRef();
+ if (func_act_ref == WRITE_REFERENCED) {
+ // Only the write part of this rmw is referenced, do nothing
+ } else if (func_act_ref != NULL) {
+ // The read part of rmw is potentially referenced
+ ModelAction * reads_from = act->get_reads_from();
+ if (reads_from->getFuncActRef() == NULL)
+ reads_from->setFuncActRef(WRITE_REFERENCED);
+ }
+ } else {
+ if (act->getFuncActRef() != NULL) {
+ ModelAction * reads_from = act->get_reads_from();
+ if (reads_from->getFuncActRef() == NULL)
+ reads_from->setFuncActRef(WRITE_REFERENCED);
+ }
+ }