-/* Copyright (c) 2008-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
using simgrid::mc::remote;
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc,
- "Logging specific to MC (state)");
-
-/**
- * \brief Creates a state data structure used by the exploration algorithm
- */
-simgrid::mc::State* MC_state_new(unsigned long state_number)
-{
- simgrid::mc::State* state = new simgrid::mc::State();
- state->processStates.resize(MC_smx_get_maxpid());
- state->num = state_number;
- /* Stateful model checking */
- if((_sg_mc_checkpoint > 0 && (state_number % _sg_mc_checkpoint == 0)) || _sg_mc_termination){
- state->system_state = simgrid::mc::take_snapshot(state->num);
- if(_sg_mc_comms_determinism || _sg_mc_send_determinism){
- MC_state_copy_incomplete_communications_pattern(state);
- MC_state_copy_index_communications_pattern(state);
- }
- }
- return state;
-}
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc, "Logging specific to MC (state)");
namespace simgrid {
namespace mc {
-State::State()
+State::State(unsigned long state_number)
{
this->internal_comm.clear();
std::memset(&this->internal_req, 0, sizeof(this->internal_req));
std::memset(&this->executed_req, 0, sizeof(this->executed_req));
+
+ processStates.resize(MC_smx_get_maxpid());
+ num = state_number;
+ /* Stateful model checking */
+ if ((_sg_mc_checkpoint > 0 && (state_number % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
+ system_state = simgrid::mc::take_snapshot(num);
+ if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
+ MC_state_copy_incomplete_communications_pattern(this);
+ MC_state_copy_index_communications_pattern(this);
+ }
+ }
}
std::size_t State::interleaveSize() const
}
static inline smx_simcall_t MC_state_get_request_for_process(
- simgrid::mc::State* state, smx_process_t process)
+ simgrid::mc::State* state, smx_actor_t process)
{
simgrid::mc::ProcessState* procstate = &state->processStates[process->pid];
state->transition.pid = -1;
}
case SIMCALL_COMM_WAIT: {
- simgrid::mc::RemotePtr<simgrid::simix::Comm> remote_act = remote(
- static_cast<simgrid::simix::Comm*>(simcall_comm_wait__get__comm(&process->simcall)));
- simgrid::mc::Remote<simgrid::simix::Comm> temp_act;
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::Comm> remote_act = remote(
+ static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_wait__get__comm(&process->simcall)));
+ simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_act;
mc_model_checker->process().read(temp_act, remote_act);
- simgrid::simix::Comm* act = temp_act.getBuffer();
+ simgrid::kernel::activity::Comm* act = temp_act.getBuffer();
if (act->src_proc && act->dst_proc)
state->transition.argument = 0;
else if (act->src_proc == nullptr && act->type == SIMIX_COMM_READY
case SIMCALL_COMM_WAITANY: {
state->internal_req.call = SIMCALL_COMM_WAIT;
state->internal_req.issuer = req->issuer;
- smx_synchro_t remote_comm;
+ smx_activity_t remote_comm;
read_element(mc_model_checker->process(),
&remote_comm, remote(simcall_comm_waitany__get__comms(req)),
state->transition.argument, sizeof(remote_comm));
mc_model_checker->process().read(state->internal_comm, remote(
- static_cast<simgrid::simix::Comm*>(remote_comm)));
+ static_cast<simgrid::kernel::activity::Comm*>(remote_comm)));
simcall_comm_wait__set__comm(&state->internal_req, state->internal_comm.getBuffer());
simcall_comm_wait__set__timeout(&state->internal_req, 0);
break;
state->internal_req.issuer = req->issuer;
if (state->transition.argument > 0) {
- smx_synchro_t remote_comm = mc_model_checker->process().read(
+ smx_activity_t remote_comm = mc_model_checker->process().read(
remote(simcall_comm_testany__get__comms(req) + state->transition.argument));
mc_model_checker->process().read(state->internal_comm, remote(
- static_cast<simgrid::simix::Comm*>(remote_comm)));
+ static_cast<simgrid::kernel::activity::Comm*>(remote_comm)));
}
simcall_comm_test__set__comm(&state->internal_req, state->internal_comm.getBuffer());