about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.hh
AgeCommit message (Collapse)AuthorFilesLines
2012-08-12 Add some basic profiling support to the evaluatorEelco Dolstra1-0/+9
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-18 Use "#pragma once" to prevent repeated header file inclusionEelco Dolstra1-5/+1
2012-01-07 * Don't create thunks for simple constants (integers, strings, paths)Eelco Dolstra1-3/+10
and allocate them only once. * Move Value and related functions into value.hh.
2012-01-04 * Don't use dynamic_cast, it's very slow. "nix-instantiateEelco Dolstra1-0/+2
/etc/nixos/nixos -A system" spent about 10% of its time in dynamic_cast.
2011-07-13 * Allow a default value in attribute selection by writingEelco Dolstra1-3/+3
x.y.z or default (as originally proposed in https://mail.cs.uu.nl/pipermail/nix-dev/2009-September/002989.html). For instance, an expression like stdenv.lib.attrByPath ["features" "ckSched"] false args can now be written as args.features.ckSched or false
2011-07-06 * Change the right-hand side of the ‘.’ operator from an attribute toEelco Dolstra1-2/+3
an attribute path. This is a refactoring to support default values.
2011-07-06 * In the ‘?’ operator, allow attribute paths. For instance, you canEelco Dolstra1-2/+8
write ‘attrs ? a.b’ to test whether ‘attrs’ has an attribute ‘a’ containing an attribute ‘b’. This is more convenient than ‘attrs ? a && attrs.a ? b’. Slight change in the semantics: it's no longer an error if the left-hand side of ‘?’ is not an attribute set. In that case it just returns false. So, ‘null ? foo’ no longer throws an error.
2010-10-24 * Keep attribute sets in sorted order to speed up attribute lookups.Eelco Dolstra1-7/+13
* Simplify the representation of attributes in the AST. * Change the behaviour of listToAttrs() in case of duplicate names.
2010-10-23 * Optimise string constants by putting them in the symbol table.Eelco Dolstra1-2/+2
2010-10-22 * Store Value nodes outside of attribute sets. I.e., Attr now storesEelco Dolstra1-0/+1
a pointer to a Value, rather than the Value directly. This improves the effectiveness of garbage collection a lot: if the Value is stored inside the set directly, then any live pointer to the Value causes all other attributes in the set to be live as well.
2010-10-04 * Make sure that config.h is included before the system headers,Eelco Dolstra1-2/+2
because it defines _FILE_OFFSET_BITS. Without this, on OpenSolaris the system headers define it to be 32, and then the 32-bit stat() ends up being called with a 64-bit "struct stat", or vice versa. This also ensures that we get 64-bit file sizes everywhere. * Remove the redundant call to stat() in parseExprFromFile(). The file cannot be a symlink because that's the exit condition of the loop before.
2010-06-01 * Turn build errors during evaluation into EvalErrors.Eelco Dolstra1-0/+1
2010-05-07 * Store position info for inherited attributes.Eelco Dolstra1-1/+2
2010-05-06 * Store attribute positions in the AST and report duplicate attributeEelco Dolstra1-2/+8
errors with position info. * For all positions, use the position of the first character of the first token, rather than the last character of the first token plus one.
2010-04-22 * Simplify the implementation of `with'. This gives a 7% speedup inEelco Dolstra1-1/+1
evaluating the NixOS system configuration.
2010-04-22 * Check for duplicate attribute names / function arguments. `makeEelco Dolstra1-1/+8
check' now succeeds :-) * An attribute set such as `{ foo = { enable = true; }; foo.port = 23; }' now parses. It was previously rejected, but I'm too lazy to implement the check. (The only reason to reject it is that the reverse, `{ foo.port = 23; foo = { enable = true; }; }', is rejected, which is kind of ugly.)
2010-04-14 * Implemented inherit.Eelco Dolstra1-1/+1
2010-04-14 * Refactoring: move variable uses to a separate class.Eelco Dolstra1-3/+10
2010-04-14 * Implemented withs.Eelco Dolstra1-0/+1
2010-04-14 * After parsing, compute level/displacement pairs for each variableEelco Dolstra1-9/+39
use site, allowing environments to be stores as vectors of values rather than maps. This should speed up evaluation and reduce the number of allocations.
2010-04-14 * Remove more obsolete code.Eelco Dolstra1-11/+0
2010-04-13 * Evaluate lets directly (i.e. without desugaring to `rec { attrs...;Eelco Dolstra1-0/+8
<let-body> = e; }.<let-body>). This prevents the unnecessary allocation of an attribute set.
2010-04-13 * Use a symbol table to represent identifiers and attribute namesEelco Dolstra1-13/+13
efficiently. The symbol table ensures that there is only one copy of each symbol, thus allowing symbols to be compared efficiently using a pointer equality test.
2010-04-12 * Indented strings.Eelco Dolstra1-9/+9
2010-04-12 * More missing constructs.Eelco Dolstra1-5/+33
2010-04-12 * Don't use ATerms for the abstract syntax trees anymore. NotEelco Dolstra1-20/+143
finished yet.
2010-04-08 * Remove a lot of dead code.Eelco Dolstra1-53/+1
2009-05-15 * Some syntactic sugar for attribute sets: allow {x.y.z = ...;} as aEelco Dolstra1-0/+1
shorthand for {x = {y = {z = ...;};};}. This is especially useful for NixOS configuration files, e.g. { services = { sshd = { enable = true; port = 2022; }; }; } can now be written as { services.sshd.enable = true; services.sshd.port = 2022; } However, it is currently not permitted to write { services.sshd = {enable = true;}; services.sshd.port = 2022; } as this is considered a duplicate definition of `services.sshd'.
2008-08-14 * Added an experimental feature suggested by Andres: ellipses ("...")Eelco Dolstra1-0/+1
in attribute set pattern matches. This allows defining a function that takes *at least* the listed attributes, while ignoring additional attributes. For instance, {stdenv, fetchurl, fuse, ...}: stdenv.mkDerivation { ... }; defines a function that requires an attribute set that contains the specified attributes but ignores others. The main advantage is that we can then write in all-packages.nix aefs = import ../bla/aefs pkgs; instead of aefs = import ../bla/aefs { inherit stdenv fetchurl fuse; }; This saves a lot of typing (not to mention not having to update all-packages.nix with purely mechanical changes). It saves as much typing as the "args: with args;" style, but has the advantage that the function arguments are properly declared (not implicit in what the body of the "with" uses).
2008-08-14 * Refactoring: combine functions that take an attribute set andEelco Dolstra1-3/+1
functions that take a single argument (plain lambdas) into one AST node (Function) that contains a Pattern node describing the arguments. Current patterns are single lazy arguments (VarPat) and matching against an attribute set (AttrsPat). This refactoring allows other kinds of patterns to be added easily, such as Haskell-style @-patterns, or list pattern matching.
2007-04-16 * New primop "throw <string>" to throw an error. This is like abort,Eelco Dolstra1-0/+1
only thrown errors are caught by the top-level derivation evaluation in nix-env -qa / -i.
2007-02-02 * nix-env now maintains meta info (from the `meta' derivationEelco Dolstra1-1/+1
attribute) about installed packages in user environments. Thus, an operation like `nix-env -q --description' shows useful information not only on available packages but also on installed packages. * nix-env now passes the entire manifest as an argument to the Nix expression of the user environment builder (not just a list of paths), so that in particular the user environment builder has access to the meta attributes. * New operation `--set-flag' in nix-env to change meta info of installed packages. This will be useful to pass per-package policies to the user environment builder (e.g., how to resolve collision or whether to disable a package (NIX-80)) or upgrade policies in nix-env (e.g., that a package should be "masked", that is, left untouched by upgrade actions). Example: $ nix-env --set-flag enabled false ghc-6.4
2007-01-13 * Canonicalise ASTs in `nix-instantiate --eval': remove positionEelco Dolstra1-0/+5
info, sort attribute sets.
2006-10-16 * Big cleanup of the semantics of paths, strings, contexts, stringEelco Dolstra1-0/+13
concatenation and string coercion. This was a big mess (see e.g. NIX-67). Contexts are now folded into strings, so that they don't cause evaluation errors when they're not expected. The semantics of paths has been clarified (see nixexpr-ast.def). toString() and coerceToString() have been merged. Semantic change: paths are now copied to the store when they're in a concatenation (and in most other situations - that's the formalisation of the meaning of a path). So "foo " + ./bla evaluates to "foo /nix/store/hash...-bla", not "foo /path/to/current-dir/bla". This prevents accidental impurities, and is more consistent with the treatment of derivation outputs, e.g., `"foo " + bla' where `bla' is a derivation. (Here `bla' would be replaced by the output path of `bla'.)
2006-09-20 * Shut up a warning.Eelco Dolstra1-0/+1
2006-09-04 * Remove unnecessary inclusions of aterm2.h.Eelco Dolstra1-2/+0
2006-09-04 * Use a proper namespace.Eelco Dolstra1-1/+7
* Optimise header file usage a bit. * Compile the parser as C++.
2006-08-23 * New primop: abort "error message".Eelco Dolstra1-0/+1
2006-08-04 * Fix a few warnings.Eelco Dolstra1-1/+1
2006-07-28 * `nix-instantiate --print-args': print out the valid values forEelco Dolstra1-0/+2
functions arguments that have a domain.
2006-07-24 * Refactoring to support domain checks.Eelco Dolstra1-0/+3
2006-07-19 * Better error messages (especially wrt types).Eelco Dolstra1-0/+7
2006-05-04 * Use the new ATermMap.Eelco Dolstra1-38/+1
2006-05-02 * Use a linked list of substitutions. This reduces the amount ofEelco Dolstra1-1/+26
copying.
2006-03-06 * GCC 4.1 compatibility.Eelco Dolstra1-1/+1
2005-05-08 * ATermMap needs an assignment operator, otherwise we are screwed.Eelco Dolstra1-0/+5
2005-04-10 * Primop `__currentSystem' to return the current platform identifier.Eelco Dolstra1-6/+0
2004-10-26 * Don't use ATmake / ATmatch anymore, nor the ATMatcher class.Eelco Dolstra1-5/+2
Instead we generate data bindings (build and match functions) for the constructors specified in `constructors.def'. In particular this removes the conversions between AFuns and strings, and Nix expression evaluation now seems 3 to 4 times faster.
2004-10-26 * String/path concatenation operator (`+').Eelco Dolstra1-0/+6
2004-08-04 * Allow primops with more that 1 arguments.Eelco Dolstra1-0/+6