Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initialize a field in the constructor (+cosmetics)
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 8 Jan 2017 15:36:20 +0000 (16:36 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 8 Jan 2017 15:36:20 +0000 (16:36 +0100)
src/mc/Process.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_snapshot.cpp
src/mc/mc_snapshot.h

index 2fc57aa..14f0890 100644 (file)
@@ -430,13 +430,10 @@ simgrid::mc::Variable* Process::find_variable(const char* name) const
 void Process::read_variable(const char* name, void* target, size_t size) const
 {
   simgrid::mc::Variable* var = this->find_variable(name);
-  if (!var->address)
-    xbt_die("No simple location for this variable");
-  if (!var->type->full_type)
-    xbt_die("Partial type for %s, cannot check size", name);
-  if ((size_t) var->type->full_type->byte_size != size)
-    xbt_die("Unexpected size for %s (expected %zi, was %zi)",
-      name, size, (size_t) var->type->full_type->byte_size);
+  xbt_assert(var->address, "No simple location for this variable");
+  xbt_assert(var->type->full_type, "Partial type for %s, cannot check size", name);
+  xbt_assert((size_t)var->type->full_type->byte_size == size, "Unexpected size for %s (expected %zi, was %zi)", name,
+             size, (size_t)var->type->full_type->byte_size);
   this->read_bytes(target, size, remote(var->address));
 }
 
index d17abc8..24a03ae 100644 (file)
@@ -563,10 +563,7 @@ std::shared_ptr<simgrid::mc::Snapshot> take_snapshot(int num_state)
 
   simgrid::mc::Process* mc_process = &mc_model_checker->process();
 
-  std::shared_ptr<simgrid::mc::Snapshot> snapshot =
-    std::make_shared<simgrid::mc::Snapshot>(mc_process);
-
-  snapshot->num_state = num_state;
+  std::shared_ptr<simgrid::mc::Snapshot> snapshot = std::make_shared<simgrid::mc::Snapshot>(mc_process, num_state);
 
   for (auto& p : mc_model_checker->process().simix_processes())
     snapshot->enabled_processes.insert(p.copy.getBuffer()->pid);
index 7e67049..0e92ed0 100644 (file)
@@ -159,13 +159,13 @@ int MC_snapshot_memcmp(
 namespace simgrid {
 namespace mc {
 
-Snapshot::Snapshot(Process* process) :
-  AddressSpace(process),
-  num_state(0),
-  heap_bytes_used(0),
-  enabled_processes(),
-  privatization_index(0),
-  hash(0)
+Snapshot::Snapshot(Process* process, int _num_state)
+    : AddressSpace(process)
+    , num_state(_num_state)
+    , heap_bytes_used(0)
+    , enabled_processes()
+    , privatization_index(0)
+    , hash(0)
 {
 
 }
index c799698..e224509 100644 (file)
@@ -133,7 +133,7 @@ namespace mc {
 
 class XBT_PRIVATE Snapshot final : public AddressSpace {
 public:
-  Snapshot(Process* process);
+  Snapshot(Process* process, int num_state);
   ~Snapshot();
   const void* read_bytes(void* buffer, std::size_t size,
     RemotePtr<void> address, int process_index = ProcessIndexAny,