Compare commits

...

3 Commits

Author SHA1 Message Date
Eelco Dolstra
bf3a1dc292 Merge branch 'master' (reformat) 2025-07-23 21:21:10 +02:00
Eelco Dolstra
0c84544bd7 Merge branch 'master' (pre-reformat) 2025-07-23 21:21:02 +02:00
Eelco Dolstra
67769e6fc1 Make EvalState::callDepth thread-local
This is needed to make it thread-safe.
2025-07-15 20:16:39 +02:00
2 changed files with 6 additions and 3 deletions

View File

@@ -1502,6 +1502,8 @@ void ExprLambda::eval(EvalState & state, Env & env, Value & v)
v.mkLambda(&env, this);
}
thread_local size_t EvalState::callDepth = 0;
void EvalState::callFunction(Value & fun, std::span<Value *> args, Value & vRes, const PosIdx pos)
{
auto _level = addCallDepth(pos);

View File

@@ -749,10 +749,11 @@ private:
std::shared_ptr<StaticEnv> & staticEnv);
/**
* Current Nix call stack depth, used with `max-call-depth` setting to throw stack overflow hopefully before we run
* out of system stack.
* Current Nix call stack depth, used with `max-call-depth`
* setting to throw stack overflow hopefully before we run out of
* system stack.
*/
size_t callDepth = 0;
thread_local static size_t callDepth;
public: