Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No need to search twice in map.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 18 Nov 2017 20:46:54 +0000 (21:46 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 18 Nov 2017 20:46:54 +0000 (21:46 +0100)
src/msg/msg_vm.cpp

index 1a5a9ad..54a4928 100644 (file)
@@ -398,7 +398,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task)
   double remaining = MSG_task_get_flops_amount(task);
   char *key = bprintf("%s-%p", task->name, task);
 
-  dirty_page_t dp = xbt_new0(s_dirty_page, 1);
+  dirty_page_t dp = new s_dirty_page;
   dp->task = task;
   if (vm->pimpl_vm_->dp_enabled) {
     dp->prev_clock = MSG_get_clock();
@@ -418,8 +418,9 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task)
 
   char *key = bprintf("%s-%p", task->name, task);
   dirty_page_t dp = nullptr;
-  if (vm->pimpl_vm_->dp_objs.find(key) != vm->pimpl_vm_->dp_objs.end())
-    dp = vm->pimpl_vm_->dp_objs.at(key);
+  auto dp_obj = vm->pimpl_vm_->dp_objs.find(key);
+  if (dp_obj != vm->pimpl_vm_->dp_objs.end())
+    dp = dp_obj->second;
   xbt_assert(dp && dp->task == task);
 
   /* If we are in the middle of dirty page tracking, we record how much computation has been done until now, and keep