X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/26d601ee6f656402ea2748b32db209318340f775..424f1543fca7f3d71e00c9b8b3156ba7dd43f57b:/src/mc/api.cpp?ds=sidebyside diff --git a/src/mc/api.cpp b/src/mc/api.cpp index 0fe5c332bf..cdb3224e49 100644 --- a/src/mc/api.cpp +++ b/src/mc/api.cpp @@ -1,3 +1,8 @@ +/* Copyright (c) 2020-2021. 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. */ + #include "api.hpp" #include "src/kernel/activity/MailboxImpl.hpp" @@ -5,6 +10,7 @@ #include "src/kernel/actor/SimcallObserver.hpp" #include "src/mc/Session.hpp" #include "src/mc/checker/Checker.hpp" +#include "src/mc/mc_base.hpp" #include "src/mc/mc_comm_pattern.hpp" #include "src/mc/mc_exit.hpp" #include "src/mc/mc_pattern.hpp" @@ -102,25 +108,23 @@ static inline smx_simcall_t MC_state_choose_request_for_process(const RemoteProc smx_simcall_t req = nullptr; if (actor->simcall_.observer_ != nullptr) { - state->transition_.times_considered_ = procstate->times_considered; - procstate->times_considered++; - if (actor->simcall_.mc_max_consider_ <= procstate->times_considered) + state->transition_.times_considered_ = procstate->get_times_considered_and_inc(); + if (actor->simcall_.mc_max_consider_ <= procstate->get_times_considered()) procstate->set_done(); req = &actor->simcall_; } else switch (actor->simcall_.call_) { case Simcall::COMM_WAITANY: state->transition_.times_considered_ = -1; - while (procstate->times_considered < simcall_comm_waitany__get__count(&actor->simcall_)) { - if (simgrid::mc::request_is_enabled_by_idx(process, &actor->simcall_, procstate->times_considered)) { - state->transition_.times_considered_ = procstate->times_considered; - ++procstate->times_considered; + while (procstate->get_times_considered() < simcall_comm_waitany__get__count(&actor->simcall_)) { + if (simgrid::mc::request_is_enabled_by_idx(process, &actor->simcall_, procstate->get_times_considered())) { + state->transition_.times_considered_ = procstate->get_times_considered_and_inc(); break; } - ++procstate->times_considered; + procstate->get_times_considered_and_inc(); } - if (procstate->times_considered >= simcall_comm_waitany__get__count(&actor->simcall_)) + if (procstate->get_times_considered() >= simcall_comm_waitany__get__count(&actor->simcall_)) procstate->set_done(); if (state->transition_.times_considered_ != -1) req = &actor->simcall_; @@ -128,16 +132,15 @@ static inline smx_simcall_t MC_state_choose_request_for_process(const RemoteProc case Simcall::COMM_TESTANY: state->transition_.times_considered_ = -1; - while (procstate->times_considered < simcall_comm_testany__get__count(&actor->simcall_)) { - if (simgrid::mc::request_is_enabled_by_idx(process, &actor->simcall_, procstate->times_considered)) { - state->transition_.times_considered_ = procstate->times_considered; - ++procstate->times_considered; + while (procstate->get_times_considered() < simcall_comm_testany__get__count(&actor->simcall_)) { + if (simgrid::mc::request_is_enabled_by_idx(process, &actor->simcall_, procstate->get_times_considered())) { + state->transition_.times_considered_ = procstate->get_times_considered_and_inc(); break; } - ++procstate->times_considered; + procstate->get_times_considered_and_inc(); } - if (procstate->times_considered >= simcall_comm_testany__get__count(&actor->simcall_)) + if (procstate->get_times_considered() >= simcall_comm_testany__get__count(&actor->simcall_)) procstate->set_done(); if (state->transition_.times_considered_ != -1) req = &actor->simcall_; @@ -828,7 +831,7 @@ std::string Api::request_to_string(smx_simcall_t req, int value) const break; default: - type = SIMIX_simcall_name(req->call_); + type = SIMIX_simcall_name(*req); args = "??"; break; }