Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / kernel / context / ContextRaw.cpp
index 47fe3f0..3b1cc8d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-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. */
@@ -12,9 +12,9 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
 
 // Raw context routines
 
-typedef void (*rawctx_entry_point_t)(simgrid::kernel::context::SwappedContext*);
+using rawctx_entry_point_t = void (*)(simgrid::kernel::context::SwappedContext*);
 
-typedef void* raw_stack_t;
+using raw_stack_t = void*;
 extern "C" raw_stack_t raw_makecontext(void* malloced_stack, int stack_size, rawctx_entry_point_t entry_point,
                                        simgrid::kernel::context::SwappedContext* arg);
 extern "C" void raw_swapcontext(raw_stack_t* old, raw_stack_t new_context);
@@ -197,12 +197,13 @@ RawContext* RawContextFactory::create_context(std::function<void()>&& code, acto
 RawContext::RawContext(std::function<void()>&& code, actor::ActorImpl* actor, SwappedContextFactory* factory)
     : SwappedContext(std::move(code), actor, factory)
 {
-   if (has_code()) {
-     this->stack_top_ = raw_makecontext(get_stack(), smx_context_stack_size, smx_ctx_wrapper, this);
-   } else {
-     if (MC_is_active())
-       MC_ignore_heap(&stack_top_, sizeof(stack_top_));
-   }
+  XBT_VERB("Creating a context of stack %uMb", actor->get_stacksize() / 1024 / 1024);
+  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_));
+  }
 }
 
 void RawContext::swap_into_for_real(SwappedContext* to_)