MaxInlineMethodsReached.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <utility>
8 
9 namespace Parallel::detail {
10 
11 // Allow 64 inline entry method calls before we fall back to Charm++. This is
12 // done to avoid blowing the stack.
13 inline bool max_inline_entry_methods_reached() noexcept {
14  thread_local size_t approx_stack_depth = 0;
15 #ifndef SPECTRE_PROFILING
16  approx_stack_depth++;
17  if (approx_stack_depth < 64) {
18  return false;
19  }
20  approx_stack_depth = 0;
21 #endif
22  return true;
23 }
24 } // namespace Parallel::detail
utility
cstddef