X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d7fb52aa1f18cd70a51a6d8913c1a4513fea7ce7..a5da20e6d4fc6ad5b4a96b72d979a48b999838b2:/src/kernel/context/ContextSwapped.cpp diff --git a/src/kernel/context/ContextSwapped.cpp b/src/kernel/context/ContextSwapped.cpp index 1d18cc5916..2682e62941 100644 --- a/src/kernel/context/ContextSwapped.cpp +++ b/src/kernel/context/ContextSwapped.cpp @@ -37,18 +37,14 @@ namespace context { /* rank of the execution thread */ thread_local uintptr_t SwappedContext::worker_id_; /* thread-specific storage for the thread id */ -SwappedContextFactory::SwappedContextFactory(std::string name) - : ContextFactory(name), parallel_(SIMIX_context_is_parallel()) +SwappedContextFactory::SwappedContextFactory() : ContextFactory(), parallel_(SIMIX_context_is_parallel()) { parmap_ = nullptr; // will be created lazily with the right parameters if needed (ie, in parallel) - workers_context_.clear(); workers_context_.resize(parallel_ ? SIMIX_context_get_nthreads() : 1, nullptr); } SwappedContextFactory::~SwappedContextFactory() { delete parmap_; - parmap_ = nullptr; - workers_context_.clear(); } SwappedContext::SwappedContext(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process, @@ -56,7 +52,7 @@ SwappedContext::SwappedContext(std::function code, void_pfn_smxprocess_t : Context(std::move(code), cleanup_func, process), factory_(factory) { // Save maestro (=context created first) in preparation for run_all - if (factory_->workers_context_[0] == nullptr) + if (not factory->parallel_ && factory_->workers_context_[0] == nullptr) factory_->workers_context_[0] = this; if (has_code()) { @@ -102,6 +98,11 @@ SwappedContext::SwappedContext(std::function code, void_pfn_smxprocess_t this->stack_ = xbt_malloc0(smx_context_stack_size); } +#if PTH_STACKGROWTH == -1 + ASAN_ONLY(this->asan_stack_ = static_cast(this->stack_) + smx_context_usable_stack_size); +#else + ASAN_ONLY(this->asan_stack_ = this->stack_); +#endif #if HAVE_VALGRIND_H unsigned int valgrind_stack_id = VALGRIND_STACK_REGISTER(this->stack_, (char*)this->stack_ + smx_context_stack_size);