X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e709643ef0c5b61c6c878016c418bffa2b1b20cd..5afd75483d80ccf2c678e50f82613b3556c7ca97:/src/simix/popping_private.hpp diff --git a/src/simix/popping_private.hpp b/src/simix/popping_private.hpp index 83e7c00935..13ab4f17ac 100644 --- a/src/simix/popping_private.hpp +++ b/src/simix/popping_private.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-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. */ @@ -9,17 +9,18 @@ #include "simgrid/forward.h" #include "src/kernel/activity/ActivityImpl.hpp" +#include #include /********************************* Simcalls *********************************/ -#include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */ +#include "popping_enum.hpp" /* Definition of Simcall, with one value per simcall */ -XBT_PUBLIC_DATA const char* simcall_names[]; /* Name of each simcall */ +XBT_PUBLIC_DATA const std::array simcall_names; /* Name of each simcall */ -typedef bool (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*); -typedef void (*simix_copy_data_func_t)(simgrid::kernel::activity::CommImpl*, void*, size_t); -typedef void (*simix_clean_func_t)(void*); -typedef void (*FPtr)(void); // Hide the ugliness +using simix_match_func_t = bool (*)(void*, void*, simgrid::kernel::activity::CommImpl*); +using simix_copy_data_func_t = void (*)(simgrid::kernel::activity::CommImpl*, void*, size_t); +using simix_clean_func_t = void (*)(void*); +using FPtr = void (*)(); // Hide the ugliness /* Pack all possible scalar types in an union */ union u_smx_scalar { @@ -43,21 +44,20 @@ union u_smx_scalar { * @brief Represents a simcall to the kernel. */ struct s_smx_simcall { - e_smx_simcall_t call_ = SIMCALL_NONE; - smx_actor_t issuer_ = nullptr; - smx_timer_t timeout_cb_ = nullptr; // Callback to timeouts - simgrid::mc::SimcallInspector* inspector_ = nullptr; // makes that simcall observable by the MC - int mc_value_ = 0; - u_smx_scalar args_[11] = {}; - u_smx_scalar result_ = {}; + simgrid::simix::Simcall call_ = simgrid::simix::Simcall::NONE; + smx_actor_t issuer_ = nullptr; + simgrid::kernel::timer::Timer* timeout_cb_ = nullptr; // Callback to timeouts + simgrid::kernel::actor::SimcallObserver* observer_ = nullptr; // makes that simcall observable by the MC + unsigned int mc_max_consider_ = + 0; // How many times this simcall should be used. If >1, this will be a fork in the state space. + int mc_value_ = 0; + std::array args_ = {}; + u_smx_scalar result_ = {}; }; -#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall).mc_value_ = (value)) -#define SIMCALL_GET_MC_VALUE(simcall) ((simcall).mc_value_) - /******************************** General *************************************/ -XBT_PRIVATE const char* SIMIX_simcall_name(e_smx_simcall_t kind); +XBT_PRIVATE const char* SIMIX_simcall_name(const s_smx_simcall& simcall); XBT_PRIVATE void SIMIX_run_kernel(std::function const* code); XBT_PRIVATE void SIMIX_run_blocking(std::function const* code); @@ -168,11 +168,11 @@ template inline void marshal(u_smx_scalar& simcall, T const& value) { return marshal(type(), simcall, value); } -template inline typename std::remove_reference::type unmarshal(u_smx_scalar& simcall) +template inline typename std::remove_reference_t unmarshal(u_smx_scalar& simcall) { return unmarshal(type(), simcall); } -template inline typename std::remove_reference::type unmarshal_raw(u_smx_scalar& simcall) +template inline typename std::remove_reference_t unmarshal_raw(u_smx_scalar& simcall) { return unmarshal(type(), simcall); } @@ -194,11 +194,11 @@ template inline void marshal_args(smx_simca } /** Initialize the simcall */ -template inline void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A const&... a) +template inline void marshal(smx_simcall_t simcall, Simcall call, A const&... a) { simcall->call_ = call; - memset(&simcall->result_, 0, sizeof(simcall->result_)); - memset(simcall->args_, 0, sizeof(simcall->args_)); + memset(&simcall->result_, 0, sizeof simcall->result_); + memset(simcall->args_.data(), 0, simcall->args_.size() * sizeof simcall->args_[0]); marshal_args<0>(simcall, a...); } }