Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix context/context_ mismatches.
[simgrid.git] / src / kernel / context / ContextUnix.cpp
index 4c509ba..51813a4 100644 (file)
@@ -87,9 +87,9 @@ UContext::UContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_fun
     this->uc_.uc_stack.ss_sp   = sg_makecontext_stack_addr(this->stack_);
     this->uc_.uc_stack.ss_size = sg_makecontext_stack_size(smx_context_usable_stack_size);
 #if PTH_STACKGROWTH == -1
-    ASAN_EVAL(this->asan_stack_ = static_cast<char*>(this->stack_) + smx_context_usable_stack_size);
+    ASAN_ONLY(this->asan_stack_ = static_cast<char*>(this->stack_) + smx_context_usable_stack_size);
 #else
-    ASAN_EVAL(this->asan_stack_ = this->stack_);
+    ASAN_ONLY(this->asan_stack_ = this->stack_);
 #endif
     UContext::make_ctx(&this->uc_, UContext::smx_ctx_sysv_wrapper, this);
   } else {
@@ -125,7 +125,7 @@ void UContext::smx_ctx_sysv_wrapper(int i1, int i2)
   } catch (simgrid::kernel::context::Context::StopRequest const&) {
     XBT_DEBUG("Caught a StopRequest");
   }
-  ASAN_EVAL(context->asan_stop_ = true);
+  ASAN_ONLY(context->asan_stop_ = true);
   context->suspend();
 }
 
@@ -143,8 +143,8 @@ void UContext::make_ctx(ucontext_t* ucp, void (*func)(int, int), UContext* arg)
 
 inline void UContext::swap(UContext* from, UContext* to)
 {
-  void* fake_stack = nullptr;
-  ASAN_EVAL(to->asan_ctx_ = from);
+  ASAN_ONLY(void* fake_stack = nullptr);
+  ASAN_ONLY(to->asan_ctx_ = from);
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   swapcontext(&from->uc_, &to->uc_);
   ASAN_FINISH_SWITCH(fake_stack, &from->asan_ctx_->asan_stack_, &from->asan_ctx_->asan_stack_size_);
@@ -170,7 +170,7 @@ void SerialUContext::suspend()
   if (i < simix_global->process_to_run.size()) {
     /* execute the next process */
     XBT_DEBUG("Run next process");
-    next_context = static_cast<SerialUContext*>(simix_global->process_to_run[i]->context);
+    next_context = static_cast<SerialUContext*>(simix_global->process_to_run[i]->context_);
   } else {
     /* all processes were run, return to maestro */
     XBT_DEBUG("No more process to run");
@@ -192,7 +192,7 @@ void SerialUContext::run_all()
     return;
   smx_actor_t first_process = simix_global->process_to_run.front();
   process_index_            = 1;
-  static_cast<SerialUContext*>(first_process->context)->resume();
+  static_cast<SerialUContext*>(first_process->context_)->resume();
 }
 
 // ParallelUContext
@@ -233,7 +233,7 @@ void ParallelUContext::run_all()
     parmap_ = new simgrid::xbt::Parmap<smx_actor_t>(SIMIX_context_get_nthreads(), SIMIX_context_get_parallel_mode());
   parmap_->apply(
       [](smx_actor_t process) {
-        ParallelUContext* context = static_cast<ParallelUContext*>(process->context);
+        ParallelUContext* context = static_cast<ParallelUContext*>(process->context_);
         context->resume();
       },
       simix_global->process_to_run);
@@ -255,7 +255,7 @@ void ParallelUContext::suspend()
   if (next_work) {
     // There is a next soul to embody (ie, a next process to resume)
     XBT_DEBUG("Run next process");
-    next_context = static_cast<ParallelUContext*>(next_work.get()->context);
+    next_context = static_cast<ParallelUContext*>(next_work.get()->context_);
   } else {
     // All processes were run, go to the barrier
     XBT_DEBUG("No more processes to run");