From d36e9a7ac2032c4fddcb236753b99c6573129893 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 15 Aug 2019 15:37:24 +0200 Subject: [PATCH] small comments improvements around a complex code --- src/kernel/activity/ActivityImpl.hpp | 7 +++++-- src/mc/checker/SimcallInspector.hpp | 8 ++++++++ src/mc/mc_state.cpp | 6 +++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/kernel/activity/ActivityImpl.hpp b/src/kernel/activity/ActivityImpl.hpp index d8d591466d..f9532eb13f 100644 --- a/src/kernel/activity/ActivityImpl.hpp +++ b/src/kernel/activity/ActivityImpl.hpp @@ -32,8 +32,11 @@ public: virtual void suspend(); virtual void resume(); virtual void cancel(); - virtual void post() = 0; // What to do when a simcall terminates - virtual void finish() = 0; + + virtual void post() = 0; // Called by the main loop when the activity is marked as terminated or failed by its model. + // Setups the status, clean things up, and call finish() + virtual void finish() = 0; // Unlock all simcalls blocked on that activity, either because it was marked as done by + // the model or because it terminated without waiting for the model virtual void register_simcall(smx_simcall_t simcall); void clean_action(); diff --git a/src/mc/checker/SimcallInspector.hpp b/src/mc/checker/SimcallInspector.hpp index d1327f3c20..07715401e9 100644 --- a/src/mc/checker/SimcallInspector.hpp +++ b/src/mc/checker/SimcallInspector.hpp @@ -20,6 +20,14 @@ public: */ virtual bool is_enabled() { return true; } + /** Execute the simcall, from the kernel POV. + * + * Most of the time, this action is in charge of doing what the perf models would have done if not in MC mode. + * For example, if it's a random(), choose the value to explore next. If it's a waitany, choose the terminated + * communication to consider now. + */ + virtual void fire(); + /** Some simcalls may only be observable under some circomstances. * Most simcalls are not visible from the MC because they don't have an inspector at all. */ virtual bool is_visible() { return true; } diff --git a/src/mc/mc_state.cpp b/src/mc/mc_state.cpp index acb6bc200e..88254304b8 100644 --- a/src/mc/mc_state.cpp +++ b/src/mc/mc_state.cpp @@ -118,12 +118,12 @@ static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* mc_model_checker->process().read(temp_act, remote_act); simgrid::kernel::activity::CommImpl* act = temp_act.get_buffer(); if (act->src_actor_.get() && act->dst_actor_.get()) - state->transition_.argument_ = 0; + state->transition_.argument_ = 0; // OK else if (act->src_actor_.get() == nullptr && act->type_ == simgrid::kernel::activity::CommImpl::Type::READY && act->detached()) - state->transition_.argument_ = 0; + state->transition_.argument_ = 0; // OK else - state->transition_.argument_ = -1; + state->transition_.argument_ = -1; // timeout procstate->set_done(); req = &actor->simcall; break; -- 2.20.1