From bee7d4b61138059d02b2f0b58b4ff38a8e5b5e82 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 12 Oct 2022 18:40:25 +0200 Subject: [PATCH 1/1] Remove redundant guard. AppSide::ignore_heap() already returns early when not MC_is_active(). --- src/kernel/context/Context.cpp | 5 +---- src/kernel/context/ContextRaw.cpp | 3 +-- src/msg/msg_global.cpp | 6 ++---- src/msg/msg_task.cpp | 3 +-- src/smpi/internals/smpi_actor.cpp | 3 +-- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index 6827ff96c4..7f050a0475 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -104,11 +104,8 @@ void Context::set_current(Context* self) void Context::declare_context(std::size_t size) { -#if SIMGRID_HAVE_MC /* Store the address of the stack in heap to compare it apart of heap comparison */ - if(MC_is_active()) - MC_ignore_heap(this, size); -#endif + MC_ignore_heap(this, size); } Context* ContextFactory::attach(actor::ActorImpl*) diff --git a/src/kernel/context/ContextRaw.cpp b/src/kernel/context/ContextRaw.cpp index 85e81698f7..5f5c842c73 100644 --- a/src/kernel/context/ContextRaw.cpp +++ b/src/kernel/context/ContextRaw.cpp @@ -203,8 +203,7 @@ RawContext::RawContext(std::function&& code, actor::ActorImpl* actor, Sw if (has_code()) { this->stack_top_ = raw_makecontext(get_stack(), actor->get_stacksize(), smx_ctx_wrapper, this); } else { - if (MC_is_active()) - MC_ignore_heap(&stack_top_, sizeof stack_top_); + MC_ignore_heap(&stack_top_, sizeof stack_top_); } } diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index a1d475bd28..e699e3f8cd 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -49,10 +49,8 @@ void MSG_init_nocheck(int* argc, char** argv) }); } - if(MC_is_active()){ - /* Ignore total amount of messages sent during the simulation for heap comparison */ - MC_ignore_heap(&msg_global->sent_msg, sizeof msg_global->sent_msg); - } + /* Ignore total amount of messages sent during the simulation for heap comparison */ + MC_ignore_heap(&msg_global->sent_msg, sizeof msg_global->sent_msg); if (simgrid::config::get_value("debug/clean-atexit")) atexit(MSG_exit); diff --git a/src/msg/msg_task.cpp b/src/msg/msg_task.cpp index fc934d2abb..146845c5cf 100644 --- a/src/msg/msg_task.cpp +++ b/src/msg/msg_task.cpp @@ -27,8 +27,7 @@ Task::Task(const std::string& name, double flops_amount, double bytes_amount, vo static std::atomic_ullong counter{0}; id_ = counter++; set_data(data); - if (MC_is_active()) - MC_ignore_heap(&id_, sizeof id_); + MC_ignore_heap(&id_, sizeof id_); } Task::Task(const std::string& name, std::vector&& hosts, std::vector&& flops_amount, diff --git a/src/smpi/internals/smpi_actor.cpp b/src/smpi/internals/smpi_actor.cpp index e513fabf8d..7c56710c3b 100644 --- a/src/smpi/internals/smpi_actor.cpp +++ b/src/smpi/internals/smpi_actor.cpp @@ -32,8 +32,7 @@ ActorExt::ActorExt(s4u::Actor* actor) : actor_(actor) timer_ = xbt_os_timer_new(); state_ = SmpiProcessState::UNINITIALIZED; info_env_ = MPI_INFO_NULL; - if (MC_is_active()) - MC_ignore_heap(timer_, xbt_os_timer_size()); + MC_ignore_heap(timer_, xbt_os_timer_size()); #if HAVE_PAPI if (not smpi_cfg_papi_events_file().empty()) { -- 2.30.2