Eelco Dolstra
a0259a21a4
Don't hide repeated values while generating manifest.nix
...
Fixes #6243 .
2022-03-22 13:18:56 +01:00
Eelco Dolstra
732296ddc0
printValue(): <REPEAT> -> «repeated»
...
This ensures that it doesn't get parsed as a valid Nix expression.
2022-03-22 13:00:27 +01:00
John Ericson
4d6a3806d2
Decode string context straight to using StorePath
s
...
I gather decoding happens on demand, so I hope don't think this should
have any perf implications one way or the other.
2022-03-18 15:36:11 +00:00
Guillaume Maudoux
c2b620f3ad
Try to fix issues with macos clang, v3
2022-03-18 15:35:24 +01:00
Guillaume Maudoux
726f5836d8
Try to fix issues with macos clang, v2
2022-03-18 15:22:25 +01:00
Guillaume Maudoux
37e84316c2
Try to fix issues with macos clang
2022-03-18 14:48:49 +01:00
Guillaume Maudoux
9c42c00570
Fix some error kind mismatches
2022-03-18 10:22:47 +01:00
Guillaume Maudoux
ad3fadb95a
fixup! Merge remote-tracking branch 'origin/master' into coerce-string
2022-03-18 10:11:36 +01:00
Guillaume Maudoux
ca5c3e86ab
Merge remote-tracking branch 'origin/master' into coerce-string
2022-03-18 01:25:55 +01:00
Guillaume Maudoux
1942fed6d9
Revert extra colon at end os strings
2022-03-18 01:10:04 +01:00
Guillaume Maudoux
e6d07e0d89
Refactor to use more traces and less string manipulations
2022-03-18 00:58:09 +01:00
Ben Burdette
3dfab6e534
have only one debuggerHook declaration
2022-03-14 11:58:11 -06:00
John Ericson
91adfb8894
Create some type aliases for string Contexts
2022-03-11 22:30:10 +00:00
Eelco Dolstra
aee56e0f89
Merge remote-tracking branch 'origin/eval-suggestions'
2022-03-11 12:02:26 +01:00
Eelco Dolstra
31a392dfe2
Merge pull request #5865 from pennae/memory-friendliness
...
be more memory friendly
2022-03-11 11:52:39 +01:00
pennae
c96460f352
force-inline a few much-used functions
...
these functions are called a whole lot, and they're all comparatively small.
always inlining them gives ~0.7% performance boost on eval.
before:
Benchmark 1: nix flakes search --no-eval-cache --offline ../nixpkgs hello
Time (mean ± σ): 6.935 s ± 0.052 s [User: 5.852 s, System: 0.853 s]
Range (min … max): 6.808 s … 7.026 s 20 runs
Benchmark 2: nix flakes eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix
Time (mean ± σ): 329.8 ms ± 2.7 ms [User: 299.0 ms, System: 30.8 ms]
Range (min … max): 326.6 ms … 336.5 ms 20 runs
Benchmark 3: nix flakes eval --raw --impure --file expr.nix
Time (mean ± σ): 2.655 s ± 0.038 s [User: 2.364 s, System: 0.220 s]
Range (min … max): 2.574 s … 2.737 s 20 runs
after:
Benchmark 1: nix flakes search --no-eval-cache --offline ../nixpkgs hello
Time (mean ± σ): 6.912 s ± 0.036 s [User: 5.823 s, System: 0.856 s]
Range (min … max): 6.849 s … 6.980 s 20 runs
Benchmark 2: nix flakes eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix
Time (mean ± σ): 325.1 ms ± 2.5 ms [User: 293.2 ms, System: 31.8 ms]
Range (min … max): 322.2 ms … 332.8 ms 20 runs
Benchmark 3: nix flakes eval --raw --impure --file expr.nix
Time (mean ± σ): 2.636 s ± 0.024 s [User: 2.352 s, System: 0.226 s]
Range (min … max): 2.574 s … 2.681 s 20 runs
2022-03-08 23:30:18 +01:00
pennae
60ed4e908a
cache singleton Envs just like Values
...
vast majority of envs is this size.
before:
Benchmark 1: nix flakes search --no-eval-cache --offline ../nixpkgs hello
Time (mean ± σ): 6.946 s ± 0.041 s [User: 5.875 s, System: 0.835 s]
Range (min … max): 6.834 s … 7.005 s 20 runs
Benchmark 2: nix flakes eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix
Time (mean ± σ): 330.3 ms ± 2.5 ms [User: 299.2 ms, System: 30.9 ms]
Range (min … max): 327.5 ms … 337.7 ms 20 runs
Benchmark 3: nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'
Time (mean ± σ): 2.671 s ± 0.035 s [User: 2.370 s, System: 0.232 s]
Range (min … max): 2.597 s … 2.749 s 20 runs
after:
Benchmark 1: nix flakes search --no-eval-cache --offline ../nixpkgs hello
Time (mean ± σ): 6.935 s ± 0.052 s [User: 5.852 s, System: 0.853 s]
Range (min … max): 6.808 s … 7.026 s 20 runs
Benchmark 2: nix flakes eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix
Time (mean ± σ): 329.8 ms ± 2.7 ms [User: 299.0 ms, System: 30.8 ms]
Range (min … max): 326.6 ms … 336.5 ms 20 runs
Benchmark 3: nix flakes eval --raw --impure --file expr.nix
Time (mean ± σ): 2.655 s ± 0.038 s [User: 2.364 s, System: 0.220 s]
Range (min … max): 2.574 s … 2.737 s 20 runs
2022-03-08 23:30:18 +01:00
pennae
4b2b0d3a55
remove GC_PTR_STORE_AND_DIRTY
...
turns out it's only necessary for MANUAL_VDB, which nix doesn't use. omitting
them gives a slight performance improvement on eval.
before:
Benchmark 1: nix flakes search --no-eval-cache --offline ../nixpkgs hello
Time (mean ± σ): 6.988 s ± 0.061 s [User: 5.935 s, System: 0.845 s]
Range (min … max): 6.865 s … 7.075 s 20 runs
Benchmark 2: nix flakes eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix
Time (mean ± σ): 332.6 ms ± 3.9 ms [User: 299.6 ms, System: 32.9 ms]
Range (min … max): 328.1 ms … 339.1 ms 20 runs
Benchmark 3: nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'
Time (mean ± σ): 2.681 s ± 0.049 s [User: 2.382 s, System: 0.228 s]
Range (min … max): 2.607 s … 2.776 s 20 runs
after:
Benchmark 1: nix flakes search --no-eval-cache --offline ../nixpkgs hello
Time (mean ± σ): 6.946 s ± 0.041 s [User: 5.875 s, System: 0.835 s]
Range (min … max): 6.834 s … 7.005 s 20 runs
Benchmark 2: nix flakes eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix
Time (mean ± σ): 330.3 ms ± 2.5 ms [User: 299.2 ms, System: 30.9 ms]
Range (min … max): 327.5 ms … 337.7 ms 20 runs
Benchmark 3: nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'
Time (mean ± σ): 2.671 s ± 0.035 s [User: 2.370 s, System: 0.232 s]
Range (min … max): 2.597 s … 2.749 s 20 runs
2022-03-08 23:30:18 +01:00
regnat
f6078e474d
Also display some suggestions for invalid formal arguments
...
```console
$ nix eval --expr '({ foo ? 1 }: foo) { fob = 2; }'
error: anonymous function at (string):1:2 called with unexpected argument 'fob'
at «string»:1:1:
1| ({ foo ? 1 }: foo) { fob = 2; }
| ^
Did you mean foo?
```
Not that because Nix will first check for _missing_ arguments before
checking for extra arguments, `({ foo }: foo) { fob = 1; }` will
complain about the missing `foo` argument (rather than extra `fob`) and
so won’t display a suggestion.
2022-03-08 16:40:22 +01:00
regnat
33b7514035
Try and make the darwin build happy
2022-03-08 16:07:17 +01:00
regnat
0c6e46e349
Add some suggestions to the evaluator
...
Make the evaluator show some suggestions when trying to access an
invalid field from an attrset.
```console
$ nix eval --expr '{ foo = 1; }.foa'
error: attribute 'foa' missing
at «string»:1:1:
1| { foo = 1; }.foa
| ^
Did you mean foo?
```
2022-03-08 06:21:45 +01:00
Robert Hensing
da260f579d
dupStringWithLen -> makeImmutableString
...
Refactor the `size == 0` logic into a new helper function that
replaces dupStringWithLen.
The name had to change, because unlike a `dup`-function, it does
not always allocate a new string.
2022-03-07 16:09:12 +01:00
Robert Hensing
bbf55383e7
Value::mkPath: Avoid potential crash from null string_view
2022-03-07 16:09:12 +01:00
Robert Hensing
1b978596b5
Value::mkString: Avoid crash from null string_view
2022-03-07 16:09:12 +01:00
Guillaume Maudoux
13c4dc6532
more fixes
2022-03-07 11:33:03 +01:00
Guillaume Maudoux
4078015927
DRY addPrimOp
2022-03-05 21:18:30 +01:00
Guillaume Maudoux
cbbbf36881
Use 'errorCtx' name everywhere
2022-03-04 22:55:14 +01:00
Guillaume Maudoux
57684d6247
fixup! s/forceValue/forceFunction/ where applicable
2022-03-04 22:51:56 +01:00
Guillaume Maudoux
3a5855353e
Add detailed error mesage for coerceTo{String,Path}
2022-03-04 21:47:58 +01:00
Guillaume Maudoux
be1f069746
Add error context for most basic coercions
2022-03-04 05:04:47 +01:00
Guillaume Maudoux
00e242feed
Add some context to coercion error strings
2022-03-03 21:46:20 +01:00
Eelco Dolstra
e9c04c3351
Be more aggressive in hiding repeated values
...
We now memoize on Bindings / list element vectors rather than Values,
so that e.g. two Values that point to the same Bindings will be
printed only once.
2022-03-03 13:33:34 +01:00
Eelco Dolstra
ecff9d969a
printValue(): Don't show repeated values
...
Fixes #6157 .
2022-03-03 13:18:23 +01:00
Eelco Dolstra
b55d79728c
Add EvalState::coerceToStorePath() helper
...
This is useful whenever we want to evaluate something to a store path
(e.g. in get-drvs.cc).
Extracted from the lazy-trees branch (where we can require that a
store path must come from a store source tree accessor).
2022-03-02 23:58:58 +01:00
Eelco Dolstra
d974d2ad59
fetch{url,Tarball}: Remove 'narHash' attribute
...
This was introduced in #6174 . However fetch{url,Tarball} are legacy
and we shouldn't have an undocumented attribute that does the same
thing as one that already exists ('sha256').
2022-03-01 11:30:26 +01:00
Robert Hensing
ee019d0afc
Add EvalState::allowAndSetStorePathString helper
...
This switches addPath from `printStorePath` to `toRealPath`.
2022-02-28 21:37:49 +01:00
Eelco Dolstra
df552ff53e
Remove std::string alias (for real this time)
...
Also use std::string_view in a few more places.
2022-02-25 16:13:02 +01:00
Ben Burdette
3d94d3ba91
Expr refs instead of pointers
2022-02-15 15:46:45 -07:00
Ben Burdette
c9bc3735f6
quit repl from step mode
2022-02-15 09:49:25 -07:00
Ben Burdette
4cffb130e3
for primops, enter the debugger at the last DebugTrace in the stack
2022-02-11 14:14:25 -07:00
Ben Burdette
3ff5ac3586
update the eval-inline throw fns
2022-02-10 16:01:49 -07:00
Ben Burdette
bc67cb5ad1
remove fakeEnv stuff and instead use last context from the stack
2022-02-10 15:05:38 -07:00
Ben Burdette
195db83148
a few merge fixes
2022-02-04 17:35:56 -07:00
Ben Burdette
dbe3fd3735
Merge branch 'master' into debug-step
2022-02-04 15:09:40 -07:00
Eelco Dolstra
bd383d1b6f
Make most calls to determinePos() lazy
2022-02-04 00:33:21 +01:00
Eelco Dolstra
4c755c3b3f
Merge branch 'issue-3505' of https://github.com/kamadorueda/nix
2022-02-04 00:33:13 +01:00
Ben Burdette
412d58f0bb
break() primop; step and go debug commands
2022-02-03 13:15:21 -07:00
Eelco Dolstra
17e3f353df
Merge branch 'parser-improvements' of https://github.com/pennae/nix
2022-02-02 12:45:44 +01:00
pennae
d439dceb3b
optionally return string_view from coerceToString
...
we'll retain the old coerceToString interface that returns a string, but callers
that don't need the returned value to outlive the Value it came from can save
copies by using the new interface instead. for values that weren't stringy we'll
pass a new buffer argument that'll be used for storage and shouldn't be
inspected.
2022-01-27 22:15:30 +01:00
pennae
41d70a2fc8
return string_views from forceString*
...
once a string has been forced we already have dynamic storage allocated for it,
so we can easily reuse that storage instead of copying.
2022-01-27 17:15:43 +01:00