RecordTrace CommunicationDeterminismChecker::getRecordTrace() // override
{
RecordTrace res;
- for (auto const& state : stack_) {
- int value = 0;
- smx_simcall_t saved_req = MC_state_get_executed_request(state.get(), &value);
- const smx_process_t issuer = MC_smx_simcall_get_issuer(saved_req);
- const int pid = issuer->pid;
- res.push_back(RecordTraceElement(pid, value));
- }
+ for (auto const& state : stack_)
+ res.push_back(state->getRecordElement());
return res;
}
{
std::vector<std::string> trace;
for (auto const& state : stack_) {
- int value;
- smx_simcall_t req = MC_state_get_executed_request(state.get(), &value);
+ smx_simcall_t req = &state->executed_req;
if (req)
trace.push_back(simgrid::mc::request_to_string(
- req, value, simgrid::mc::RequestType::executed));
+ req, state->req_num, simgrid::mc::RequestType::executed));
}
return trace;
}
/* Get an enabled process and insert it in the interleave set of the initial state */
for (auto& p : mc_model_checker->process().simix_processes())
if (simgrid::mc::process_is_enabled(&p.copy))
- MC_state_interleave_process(initial_state.get(), &p.copy);
+ initial_state->interleave(&p.copy);
stack_.push_back(std::move(initial_state));
}
int CommunicationDeterminismChecker::main(void)
{
- int value;
std::unique_ptr<simgrid::mc::VisitedState> visited_state = nullptr;
smx_simcall_t req = nullptr;
mc_stats->visited_states++;
if (stack_.size() <= (std::size_t) _sg_mc_max_depth
- && (req = MC_state_get_request(state, &value))
+ && (req = MC_state_get_request(state)) != nullptr
&& (visited_state == nullptr)) {
+ int req_num = state->req_num;
+
XBT_DEBUG("Execute: %s",
simgrid::mc::request_to_string(
- req, value, simgrid::mc::RequestType::simix).c_str());
+ req, req_num, simgrid::mc::RequestType::simix).c_str());
std::string req_str;
if (dot_output != nullptr)
- req_str = simgrid::mc::request_get_dot_output(req, value);
+ req_str = simgrid::mc::request_get_dot_output(req, req_num);
- MC_state_set_executed_request(state, req, value);
mc_stats->executed_transitions++;
/* TODO : handle test and testany simcalls */
call = MC_get_call_type(req);
/* Answer the request */
- simgrid::mc::handle_simcall(req, value); /* After this call req is no longer useful */
+ simgrid::mc::handle_simcall(req, req_num); /* After this call req is no longer useful */
if(!initial_global_state->initial_communications_pattern_done)
- MC_handle_comm_pattern(call, req, value, initial_communications_pattern, 0);
+ MC_handle_comm_pattern(call, req, req_num, initial_communications_pattern, 0);
else
- MC_handle_comm_pattern(call, req, value, nullptr, 0);
+ MC_handle_comm_pattern(call, req, req_num, nullptr, 0);
/* Wait for requests (schedules processes) */
mc_model_checker->wait_for_requests();
/* Get enabled processes and insert them in the interleave set of the next state */
for (auto& p : mc_model_checker->process().simix_processes())
if (simgrid::mc::process_is_enabled(&p.copy))
- MC_state_interleave_process(next_state.get(), &p.copy);
+ next_state->interleave(&p.copy);
if (dot_output != nullptr)
fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",