diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-04 07:32:31 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-04 07:32:31 +0100 |
commit | dd180911d8ecf737e6b2ceb89d6797965fcc3b78 (patch) | |
tree | 633078cc7b7f743421e04dc51ec8a4bbda76ada6 /src/libexpr/eval-inline.hh | |
parent | 076844e3868f108ce0d1523e2db069f7e71c9990 (diff) |
Merge pull request #9582 from pennae/misc-opts
a packet of small optimizations
(cherry picked from commit ee439734e924eb337a869ff2e48aff8b989198bc)
Change-Id: I125d870710750a32a0dece48f39a3e9132b0d023
Diffstat (limited to 'src/libexpr/eval-inline.hh')
-rw-r--r-- | src/libexpr/eval-inline.hh | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/libexpr/eval-inline.hh b/src/libexpr/eval-inline.hh index c37b1d62b..52aa75b5f 100644 --- a/src/libexpr/eval-inline.hh +++ b/src/libexpr/eval-inline.hh @@ -84,13 +84,6 @@ Env & EvalState::allocEnv(size_t size) [[gnu::always_inline]] void EvalState::forceValue(Value & v, const PosIdx pos) { - forceValue(v, [&]() { return pos; }); -} - - -template<typename Callable> -void EvalState::forceValue(Value & v, Callable getPos) -{ if (v.isThunk()) { Env * env = v.thunk.env; Expr * expr = v.thunk.expr; @@ -100,15 +93,12 @@ void EvalState::forceValue(Value & v, Callable getPos) expr->eval(*this, *env, v); } catch (...) { v.mkThunk(env, expr); + tryFixupBlackHolePos(v, pos); throw; } } - else if (v.isApp()) { - PosIdx pos = getPos(); + else if (v.isApp()) callFunction(*v.app.left, *v.app.right, v, pos); - } - else if (v.isBlackhole()) - error("infinite recursion encountered").atPos(getPos()).template debugThrow<EvalError>(); } |