1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

Merge branch 'master' into debug-merge-master

This commit is contained in:
Ben Burdette 2022-04-28 12:32:57 -06:00
commit 6e19947993
102 changed files with 2212 additions and 1418 deletions

View file

@ -2,42 +2,8 @@
#include "eval.hh"
#define LocalNoInline(f) static f __attribute__((noinline)); f
#define LocalNoInlineNoReturn(f) static f __attribute__((noinline, noreturn)); f
namespace nix {
LocalNoInlineNoReturn(void throwEvalError(const Pos & pos, const char * s, EvalState &evalState))
{
auto error = EvalError({
.msg = hintfmt(s),
.errPos = pos
});
if (debuggerHook && !evalState.debugTraces.empty()) {
DebugTrace &last = evalState.debugTraces.front();
debuggerHook(&error, last.env, last.expr);
}
throw error;
}
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const Value & v, EvalState &evalState))
{
auto error = TypeError({
.msg = hintfmt(s, showType(v)),
.errPos = pos
});
if (debuggerHook && !evalState.debugTraces.empty()) {
DebugTrace &last = evalState.debugTraces.front();
debuggerHook(&error, last.env, last.expr);
}
throw error;
}
/* Note: Various places expect the allocated memory to be zeroed. */
[[gnu::always_inline]]
inline void * allocBytes(size_t n)
@ -113,7 +79,7 @@ Env & EvalState::allocEnv(size_t size)
[[gnu::always_inline]]
void EvalState::forceValue(Value & v, const Pos & pos)
void EvalState::forceValue(Value & v, const PosIdx pos)
{
forceValue(v, [&]() { return pos; });
}
@ -142,7 +108,7 @@ void EvalState::forceValue(Value & v, Callable getPos)
[[gnu::always_inline]]
inline void EvalState::forceAttrs(Value & v, const Pos & pos)
inline void EvalState::forceAttrs(Value & v, const PosIdx pos)
{
forceAttrs(v, [&]() { return pos; });
}
@ -159,7 +125,7 @@ inline void EvalState::forceAttrs(Value & v, Callable getPos)
[[gnu::always_inline]]
inline void EvalState::forceList(Value & v, const Pos & pos)
inline void EvalState::forceList(Value & v, const PosIdx pos)
{
forceValue(v, pos);
if (!v.isList())