Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Actor's ID should be a long, and should be named AID
[simgrid.git] / src / mc / api.cpp
index 8b0c516b30d68c93aa4b30a69c4fab514f148c21..6f54255a5cfd76c15892750509b3f67c0f040bed 100644 (file)
@@ -92,7 +92,7 @@ static inline smx_simcall_t MC_state_choose_request_for_process(const RemoteProc
 {
   /* reset the outgoing transition */
   simgrid::mc::ActorState* procstate = &state->actor_states_[actor->get_pid()];
-  state->transition_.pid_            = -1;
+  state->transition_.aid_              = -1;
   state->transition_.times_considered_ = -1;
   state->transition_.textual[0]        = '\0';
   state->executed_req_.call_         = Simcall::NONE;
@@ -170,7 +170,7 @@ static inline smx_simcall_t MC_state_choose_request_for_process(const RemoteProc
   if (not req)
     return nullptr;
 
-  state->transition_.pid_ = actor->get_pid();
+  state->transition_.aid_ = actor->get_pid();
   state->executed_req_    = *req;
 
   // Fetch the data of the request and translate it:
@@ -367,14 +367,15 @@ xbt::string const& Api::get_actor_host_name(smx_actor_t actor) const
   // Read the simgrid::xbt::string in the MCed process:
   simgrid::mc::ActorInformation* info = actor_info_cast(actor);
 
-  Remote<s4u::Host> temp_host = process->read(remote(actor->get_host()));
-  auto temp_host_name_address = &temp_host.get_buffer()->get_impl()->get_name();
-  auto remote_string_address  = remote(reinterpret_cast<const simgrid::xbt::string_data*>(temp_host_name_address));
-  simgrid::xbt::string_data remote_string = process->read(remote_string_address);
-  std::vector<char> hostname(remote_string.len + 1);
-  // no need to read the terminating null byte, and thus hostname[remote_string.len] is guaranteed to be '\0'
-  process->read_bytes(hostname.data(), remote_string.len, remote(remote_string.data));
-  info->hostname = &mc_model_checker->get_host_name(hostname.data());
+  if (not info->hostname) {
+    Remote<s4u::Host> temp_host = process->read(remote(actor->get_host()));
+    auto remote_string_address  = remote(&xbt::string::to_string_data(temp_host.get_buffer()->get_impl()->get_name()));
+    simgrid::xbt::string_data remote_string = process->read(remote_string_address);
+    std::vector<char> hostname(remote_string.len + 1);
+    // no need to read the terminating null byte, and thus hostname[remote_string.len] is guaranteed to be '\0'
+    process->read_bytes(hostname.data(), remote_string.len, remote(remote_string.data));
+    info->hostname = &mc_model_checker->get_host_name(hostname.data());
+  }
   return *info->hostname;
 }