Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix privatisation support
[simgrid.git] / src / mc / ModelChecker.cpp
index 1c3b76a..2c7dac5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2014. The SimGrid Team.
+/* Copyright (c) 2008-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -6,6 +6,8 @@
 
 #include <cassert>
 
+#include "simgrid/sg_config.h" // sg_cfg_get_boolean
+
 #include "ModelChecker.hpp"
 #include "PageStore.hpp"
 
 namespace simgrid {
 namespace mc {
 
-ModelChecker::ModelChecker(pid_t pid, int socket)
-  : page_store_(500)
+ModelChecker::ModelChecker(pid_t pid, int socket) :
+  hostnames_(xbt_dict_new()),
+  page_store_(500),
+  process_(pid, socket),
+  parent_snapshot_(nullptr)
 {
-  this->hostnames_ = xbt_dict_new();
-  MC_process_init(&this->process(), pid, socket);
+  // TODO, avoid direct dependency on sg_cfg
+  process_.privatized(sg_cfg_get_boolean("smpi/privatize_global_variables"));
 }
 
 ModelChecker::~ModelChecker()
 {
-  MC_process_clear(&this->process_);
   xbt_dict_free(&this->hostnames_);
 }
 
@@ -32,11 +36,9 @@ const char* ModelChecker::get_host_name(const char* hostname)
   // Lookup the host name in the dictionary (or create it):
   xbt_dictelm_t elt = xbt_dict_get_elm_or_null(this->hostnames_, hostname);
   if (!elt) {
-    xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap);
     xbt_dict_set(this->hostnames_, hostname, NULL, NULL);
     elt = xbt_dict_get_elm_or_null(this->hostnames_, hostname);
     assert(elt);
-    mmalloc_set_current_heap(heap);
   }
   return elt->key;
 }