s_smx_synchro_t comm;
mc_model_checker->process().read(&comm, remote(comm_addr));
- smx_process_t src_proc = MC_smx_resolve_process(comm.comm.src_proc);
- smx_process_t dst_proc = MC_smx_resolve_process(comm.comm.dst_proc);
+ smx_process_t src_proc = MC_smx_resolve_process(simgrid::mc::remote(comm.comm.src_proc));
+ smx_process_t dst_proc = MC_smx_resolve_process(simgrid::mc::remote(comm.comm.dst_proc));
comm_pattern->src_proc = src_proc->pid;
comm_pattern->dst_proc = dst_proc->pid;
comm_pattern->src_host = MC_smx_process_get_host_name(src_proc);
char* remote_name = mc_model_checker->process().read<char*>(
(std::uint64_t)(synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name));
pattern->rdv = mc_model_checker->process().read_string(remote_name);
- pattern->src_proc = MC_smx_resolve_process(synchro.comm.src_proc)->pid;
+ pattern->src_proc = MC_smx_resolve_process(simgrid::mc::remote(synchro.comm.src_proc))->pid;
pattern->src_host = MC_smx_process_get_host_name(issuer);
struct s_smpi_mpi_request mpi_request =
mc_model_checker->process().read(&remote_name,
remote(synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name));
pattern->rdv = mc_model_checker->process().read_string(remote_name);
- pattern->dst_proc = MC_smx_resolve_process(synchro.comm.dst_proc)->pid;
+ pattern->dst_proc = MC_smx_resolve_process(simgrid::mc::remote(synchro.comm.dst_proc))->pid;
pattern->dst_host = MC_smx_process_get_host_name(issuer);
} else
xbt_die("Unexpected call_type %i", (int) call_type);
#include "src/mc/mc_forward.hpp"
#include "src/mc/mc_base.h"
+#include "src/mc/RemotePtr.hpp"
#include "src/mc/AddressSpace.hpp"
#include "src/mc/mc_protocol.h"
#include "src/mc/ObjectInformation.hpp"
class SimixProcessInformation {
public:
/** MCed address of the process */
- void* address = nullptr;
+ RemotePtr<s_smx_process_t> address = nullptr;
union {
/** (Flat) Copy of the process data structure */
struct s_smx_process copy;
RemotePtr(T* address) : address_((std::uintptr_t)address) {}
std::uint64_t address() const { return address_; }
+ /** Turn into a local pointer
+ *
+ (if the remote process is not, in fact, remote) */
+ T* local() { return (T*) address_; }
+
operator bool() const
{
return address_;
else
#if HAVE_MC
// TODO, *(mutex->owner) :/
- return MC_smx_resolve_process(mutex->owner)->pid ==
- MC_smx_resolve_process(req->issuer)->pid;
+ return MC_smx_resolve_process(simgrid::mc::remote(mutex->owner))->pid ==
+ MC_smx_resolve_process(simgrid::mc::remote(req->issuer))->pid;
#else
return mutex->owner->pid == req->issuer->pid;
#endif
} else
act = remote_act;
- smx_process_t src_proc = MC_smx_resolve_process(act->comm.src_proc);
- smx_process_t dst_proc = MC_smx_resolve_process(act->comm.dst_proc);
+ smx_process_t src_proc = MC_smx_resolve_process(simgrid::mc::remote(act->comm.src_proc));
+ smx_process_t dst_proc = MC_smx_resolve_process(simgrid::mc::remote(act->comm.dst_proc));
args = bprintf("comm=%s [(%lu)%s (%s)-> (%lu)%s (%s)]", p,
src_proc ? src_proc->pid : 0,
src_proc ? MC_smx_process_get_host_name(src_proc) : "",
type = "Test TRUE";
p = pointer_to_string(remote_act);
- smx_process_t src_proc = MC_smx_resolve_process(act->comm.src_proc);
- smx_process_t dst_proc = MC_smx_resolve_process(act->comm.dst_proc);
+ smx_process_t src_proc = MC_smx_resolve_process(simgrid::mc::remote(act->comm.src_proc));
+ smx_process_t dst_proc = MC_smx_resolve_process(simgrid::mc::remote(act->comm.dst_proc));
args = bprintf("comm=%s [(%lu)%s (%s) -> (%lu)%s (%s)]", p,
src_proc->pid,
MC_smx_process_get_name(src_proc),
args = bprintf("locked = %d, owner = %d, sleeping = %d",
mutex.locked,
- mutex.owner != nullptr ? (int) MC_smx_resolve_process(mutex.owner)->pid : -1,
+ mutex.owner != nullptr ? (int) MC_smx_resolve_process(simgrid::mc::remote(mutex.owner))->pid : -1,
mutex_sleeping.count);
break;
}
mc_model_checker->process().read_bytes(&synchro,
sizeof(synchro), remote(remote_act));
- smx_process_t src_proc = MC_smx_resolve_process(synchro.comm.src_proc);
- smx_process_t dst_proc = MC_smx_resolve_process(synchro.comm.dst_proc);
+ smx_process_t src_proc = MC_smx_resolve_process(simgrid::mc::remote(synchro.comm.src_proc));
+ smx_process_t dst_proc = MC_smx_resolve_process(simgrid::mc::remote(synchro.comm.dst_proc));
if (issuer->host)
label = simgrid::xbt::string_printf("[(%lu)%s] Wait [(%lu)->(%lu)]",
issuer->pid,
return req->issuer;
// This is the address of the smx_process in the MCed process:
- void* address = req->issuer;
+ auto address = simgrid::mc::remote(req->issuer);
// Lookup by address:
for (auto& p : mc_model_checker->process().simix_processes())
xbt_die("Issuer not found");
}
-smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address)
+smx_process_t MC_smx_resolve_process(
+ simgrid::mc::RemotePtr<s_smx_process_t> process_remote_address)
{
if (!process_remote_address)
return nullptr;
if (mc_mode == MC_MODE_CLIENT)
- return process_remote_address;
+ return process_remote_address.local();
- simgrid::mc::SimixProcessInformation* process_info = MC_smx_resolve_process_info(process_remote_address);
+ simgrid::mc::SimixProcessInformation* process_info =
+ MC_smx_resolve_process_info(process_remote_address);
if (process_info)
return &process_info->copy;
else
return nullptr;
}
-simgrid::mc::SimixProcessInformation* MC_smx_resolve_process_info(smx_process_t process_remote_address)
+simgrid::mc::SimixProcessInformation* MC_smx_resolve_process_info(
+ simgrid::mc::RemotePtr<s_smx_process_t> process_remote_address)
{
if (mc_mode == MC_MODE_CLIENT)
xbt_die("No process_info for local process is not enabled.");
/* ***** Resolve (local/MCer structure from remote/MCed addresses) ***** */
/** Get a local copy of the process from the process remote address */
-XBT_PRIVATE smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address);
+XBT_PRIVATE smx_process_t MC_smx_resolve_process(
+ simgrid::mc::RemotePtr<s_smx_process_t> process_remote_address);
/** Get the process info structure from the process remote address */
-XBT_PRIVATE simgrid::mc::SimixProcessInformation* MC_smx_resolve_process_info(smx_process_t process_remote_address);
+XBT_PRIVATE simgrid::mc::SimixProcessInformation* MC_smx_resolve_process_info(
+ simgrid::mc::RemotePtr<s_smx_process_t> process_remote_address);
XBT_PRIVATE unsigned long MC_smx_get_maxpid(void);