about summary refs log tree commit diff
path: root/src/libexpr/primops.cc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-09-03 Get rid of the parse tree cacheEelco Dolstra1-3/+2
Since we already cache files in normal form (fileEvalCache), caching parse trees is redundant. Note that getting rid of this cache doesn't actually save much memory at the moment, because parse trees are currently not freed / GC'ed.
2013-09-02 Fix whitespaceEelco Dolstra1-15/+15
2013-08-19 Store Nix integers as longsEelco Dolstra1-1/+1
So on 64-bit systems, integers are now 64-bit. Fixes #158.
2013-08-02 Let the ordering operators also work on stringsEelco Dolstra1-3/+6
E.g. ‘"foo" < "bar"’ now works.
2013-03-08 Revert "Prevent config.h from being clobbered"Eelco Dolstra1-0/+16
This reverts commit 28bba8c44f484eae38e8a15dcec73cfa999156f6.
2013-03-07 Prevent config.h from being clobberedEelco Dolstra1-16/+0
2013-02-08 Rename "hash" to "hashString" and handle SHA-1Eelco Dolstra1-19/+9
2013-02-08 experimental/hashMarc Weber1-0/+26
adding primop function calculating hash of a string Signed-off-by: Marc Weber <marco-oweber@gmx.de>
2012-12-04 Tiny optimisation in the filter primopEelco Dolstra1-2/+9
2012-11-27 Optionally ignore null-valued derivation attributesEelco Dolstra1-10/+22
This allows adding attributes like attr = if stdenv.system == "bla" then something else null; without changing the resulting derivation on non-<bla> platforms. We once considered adding a special "ignore" value for this purpose, but using null seems more elegant.
2012-11-27 Add builtin constants ‘langVersion’ and ‘nixVersion’Eelco Dolstra1-0/+10
The integer constant ‘langVersion’ denotes the current language version. It gets increased every time a language feature is added/changed/removed. It's currently 1. The string constant ‘nixVersion’ contains the current Nix version, e.g. "1.2pre2980_9de6bc5".
2012-11-15 Revert "prim_toPath: Actually make the string a path"Eelco Dolstra1-3/+1
This reverts commit 2980d1fba97069805c3649c5d99d0356bce6c303. It causes a regression in NixOS evaluation: string `/nix/store/ya3s5gmj3b28170fpbjhgsk8wzymkpa1-pommed-1.39/etc/pommed.conf' cannot refer to other paths
2012-10-23 prim_toPath: Actually make the string a pathShea Levy1-1/+3
2012-10-03 Add a ‘--repair’ flag to nix-instantiateEelco Dolstra1-3/+3
This allows repairing corrupted derivations and other source files.
2012-09-19 Templatise tokenizeString()Eelco Dolstra1-1/+1
2012-08-27 Merge branch 'master' into no-manifestsEelco Dolstra1-8/+73
2012-08-13 Add a primop ‘elemAt’ to get an element from a listEelco Dolstra1-5/+19
2012-08-13 Add a primop ‘concatLists’Eelco Dolstra1-0/+10
This can serve as a generic efficient list builder. For instance, the function ‘catAttrs’ in Nixpkgs can be rewritten from attr: l: fold (s: l: if hasAttr attr s then [(getAttr attr s)] ++ l else l) [] l to attr: l: builtins.concatLists (map (s: if hasAttr attr s then [(getAttr attr s)] else []) l) Statistics before: time elapsed: 1.08683 size of a value: 24 environments allocated: 1384376 (35809568 bytes) list elements: 6946783 (55574264 bytes) list concatenations: 37434 values allocated: 1760440 (42250560 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18273 number of thunks: 1297673 number of thunks avoided: 1380759 number of attr lookups: 430802 number of primop calls: 628912 number of function calls: 1333544 Statistics after (including new catAttrs): time elapsed: 0.959854 size of a value: 24 environments allocated: 1010198 (26829296 bytes) list elements: 1984878 (15879024 bytes) list concatenations: 30488 values allocated: 1589760 (38154240 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18274 number of thunks: 1040925 number of thunks avoided: 1038428 number of attr lookups: 438419 number of primop calls: 474844 number of function calls: 959366
2012-08-13 Provide an efficient implementation of ‘elem’Eelco Dolstra1-2/+17
The one in Nixpkgs is O(n^2), this one is O(n). Big reduction in the number of list allocations. Statistics before (on a NixOS system config): time elapsed: 1.17982 size of a value: 24 environments allocated: 1543334 (39624560 bytes) list elements: 9612638 (76901104 bytes) list concatenations: 37434 values allocated: 1854933 (44518392 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18272 number of thunks: 1392467 number of thunks avoided: 1507311 number of attr lookups: 430801 number of primop calls: 691600 number of function calls: 1492502 Statistics after: time elapsed: 1.08683 size of a value: 24 environments allocated: 1384376 (35809568 bytes) list elements: 6946783 (55574264 bytes) list concatenations: 37434 values allocated: 1760440 (42250560 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18273 number of thunks: 1297673 number of thunks avoided: 1380759 number of attr lookups: 430802 number of primop calls: 628912 number of function calls: 1333544
2012-08-13 Add a "filter" primopEelco Dolstra1-0/+25
Evaluation of a NixOS configuration spends quite a lot of time in the "filter" function in Nixpkgs. As implemented in Nixpkgs, this is a O(n^2) operation, so it's a good candidate for providing a more efficient (i.e. primop) implementation. Using it gives a ~10% speed increase and a significant reduction in the number of evaluations. Statistics before (on a NixOS system config): time elapsed: 1.3258 size of a value: 24 environments allocated: 1980939 (50127080 bytes) list elements: 14679308 (117434464 bytes) list concatenations: 50828 values allocated: 2098938 (50374512 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18271 number of thunks: 1645752 number of thunks avoided: 1921196 number of attr lookups: 430798 number of primop calls: 838807 number of function calls: 1930107 Statistics after: time elapsed: 1.17982 size of a value: 24 environments allocated: 1543334 (39624560 bytes) list elements: 9612638 (76901104 bytes) list concatenations: 37434 values allocated: 1854933 (44518392 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18272 number of thunks: 1392467 number of thunks avoided: 1507311 number of attr lookups: 430801 number of primop calls: 691600 number of function calls: 1492502
2012-08-12 Add some basic profiling support to the evaluatorEelco Dolstra1-1/+2
Setting the environment variable NIX_COUNT_CALLS to 1 enables some basic profiling in the evaluator. It will count calls to functions and primops as well as evaluations of attributes. For example, to see where evaluation of a NixOS configuration spends its time: $ NIX_SHOW_STATS=1 NIX_COUNT_CALLS=1 ./src/nix-instantiate/nix-instantiate '<nixos>' -A system --readonly-mode ... calls to 39 primops: 239532 head 233962 tail 191252 hasAttr ... calls to 1595 functions: 224157 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:19' 221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:14' 221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:10' ... evaluations of 7088 attributes: 167377 undefined position 132459 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:119:41' 47322 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:13:21' ...
2012-07-30 Refactor settings processingEelco Dolstra1-3/+3
Put all Nix configuration flags in a Settings object.
2012-07-26 Merge branch 'master' into no-manifestsEelco Dolstra1-1/+25
2012-07-25 prim_import: When importing .drvs, allocate the intermediate attrset on the ↵Shea Levy1-1/+1
heap just in case it escapes the stack frame.
2012-07-25 import: If the path is a valid .drv file, parse it and generate a derivation ↵Shea Levy1-1/+25
attrset. The generated attrset has drvPath and outPath with the right string context, type 'derivation', outputName with the right name, all with a list of outputs, and an attribute for each output. I see three uses for this (though certainly there may be more): * Using derivations generated by something besides nix-instantiate (e.g. guix) * Allowing packages provided by channels to be used in nix expressions. If a channel installed a valid deriver for each package it provides into the store, then those could be imported and used as dependencies or installed in environment.systemPackages, for example. * Enable hydra to be consistent in how it treats inputs that are outputs of another build. Right now, if an input is passed as an argument to the job, it is passed as a derivation, but if it is accessed via NIX_PATH (i.e. through the <> syntax), then it is a path that can be imported. This is problematic because the build being depended upon may have been built with non-obvious arguments passed to its jobset file. With this feature, hydra can just set the name of that input to the path to its drv file in NIX_PATH
2012-07-18 Merge branch 'master' into no-manifestsEelco Dolstra1-1/+5
2012-07-12 builtins.storePath: resolve symlinksEelco Dolstra1-1/+5
Needed for Charon/Hydra interaction.
2012-07-09 prim_import(): prefetch substitute info in parallel using queryMissing()Eelco Dolstra1-0/+6
2012-06-27 nix-store -r: do substitutions in parallelEelco Dolstra1-1/+1
I.e. when multiple non-derivation arguments are passed to ‘nix-store -r’ to be substituted, do them in parallel.
2012-02-04 * Inline some functions and get rid of the indirection throughEelco Dolstra1-0/+1
EvalState::eval(). This gives a 12% speedup on ‘nix-instantiate /etc/nixos/nixos/ -A system --readonly-mode’ (from 1.01s to 0.89s).
2012-01-26 * Fix importing a derivation. This gave a segfault.Eelco Dolstra1-8/+23
2012-01-19 * Add some debug output to print the derivation name once it's known.Eelco Dolstra1-1/+4
This makes it easier to pinpoint the source of a crash.
2012-01-03 * Drop the inefficient "Path" suffix in output attribute names.Eelco Dolstra1-3/+1
2012-01-03 * Move the implementation of the ‘derivation’ primop into a separateEelco Dolstra1-23/+1
file.
2011-12-21 * The ‘foo.drvPath’ feature was already broken in read-only mode.Eelco Dolstra1-1/+2
Since it's rarely used and fixing it is too much work right now, just document it.
2011-12-21 * Simplify the context handling logic.Eelco Dolstra1-24/+13
2011-12-16 * Sync with the trunk.Eelco Dolstra1-14/+3
2011-12-02 * Move parseHash16or32 into libutil, and use in nix-hash.Eelco Dolstra1-11/+1
2011-11-06 There's no need to mess with drvPath at allShea Levy1-6/+4
2011-11-06 Fix faulty reversion of my changes to unsafeDiscardOutputDependencyShea Levy1-1/+1
2011-11-06 Respect all outputs passed to the derivation, not just the last oneShea Levy1-1/+3
2011-11-06 Embed output name into the context of the *OutPath attributes and extract it ↵Shea Levy1-2/+9
for input derivations Multiple outputs test passes!
2011-11-06 Include all outputs of derivations in the closure of explicitly-passed ↵Shea Levy1-2/+8
derivation paths This required adding a queryOutputDerivationNames function in the store API
2011-11-06 The 'insert output between = signs' approach was not helpfulShea Levy1-9/+2
2011-09-16 Remove the current output metadata from the string for ↵Shea Levy1-1/+8
unsaveDiscardOutputDependency
2011-09-16 Add information about which output is active to drvPath's contextShea Levy1-4/+6
This will break things that depend on being able to just strip away an equals sign, so those have to be updated next
2011-09-16 Add a currentOutput attribute to derivations keep track of which output is ↵Shea Levy1-1/+4
active
2011-09-14 First attempt at the output-as-derivation semanticsShea Levy1-9/+27
For each output, this adds a corresponding attribute to the derivation that is the same as the derivation except for outPath, which is set to the path specific to that output. Additionally, an "all" attribute is added that is a list of all of the output derivations. This has to be done outside of derivationStrict as each output is itself a derivation that contains itself (and all other outputs) as an attribute. The derivation itself is equivalent to the first output in the outputs list (or "out" if that list isn't set).
2011-08-31 * Eliminate all uses of the global variable ‘store’ from libstore.Eelco Dolstra1-4/+4
This should also fix: nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr<T>::operator->() const [with T = nix::StoreAPI]: Assertion `px != 0' failed. which was caused by hashDerivationModulo() calling the ‘store’ object (during store upgrades) before openStore() assigned it.
2011-08-06 * Refactoring: move parseExprFromFile() and parseExprFromString() intoEelco Dolstra1-2/+1
the EvalState class.