about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
AgeCommit message (Collapse)AuthorFilesLines
2016-02-12 Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra1-2/+55
Implement floats
2016-02-04 StoreAPI -> StoreEelco Dolstra1-1/+1
Calling a class an API is a bit redundant...
2016-02-04 Eliminate the "store" global variableEelco Dolstra1-1/+2
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2016-01-05 Use __toString when coercing sets to strings.Shea Levy1-1/+9
For example, "${{ foo = "bar"; __toString = x: x.foo; }}" evaluates to "bar". With this, we can delay calling functions like mkDerivation, buildPythonPackage, etc. until we actually need a derivation, enabling overrides and other modifications to happen by simple attribute set update.
2016-01-05 Fix up float parsing.Christian Theune1-0/+1
2016-01-05 First hit at providing support for floats in the language.Christian Theune1-2/+54
2015-11-25 autoCallFunction: Auto-call functorsShea Levy1-0/+11
2015-10-29 int2String() -> std::to_string()Eelco Dolstra1-1/+1
2015-10-08 isFunctor: SimplifyEelco Dolstra1-0/+6
2015-10-08 forceFunction: allow functors as wellMathnerd3141-1/+1
2015-07-31 Fix stack consumptionEelco Dolstra1-5/+0
2015-07-31 Output line number on infinite recursionIwan Aucamp1-8/+8
2015-07-23 CleanupEelco Dolstra1-5/+0
2015-07-23 Optimize empty setsEelco Dolstra1-0/+4
This reduces the number of Bindings allocations by about 10%.
2015-07-23 Merge branch 'attr-set-hh' of https://github.com/nbp/nixEelco Dolstra1-30/+0
Conflicts: src/libexpr/eval.cc
2015-07-23 Optimize small listsEelco Dolstra1-33/+46
The value pointers of lists with 1 or 2 elements are now stored in the list value itself. In particular, this makes the "concatMap (x: if cond then [(f x)] else [])" idiom cheaper.
2015-07-17 OCD: foreach -> C++11 ranged forEelco Dolstra1-45/+45
2015-07-17 Make printValue() interruptibleEelco Dolstra1-0/+2
Fixes #572.
2015-07-14 Move attribute set data structures into their own header file.Nicolas B. Pierron1-30/+0
This modification moves Attr and Bindings structures into their own header file which is dedicated to the attribute set representation. The goal of to isolate pieces of code which are related to the attribute set representation. Thus future modifications of the attribute set representation will only have to modify these files, and not every other file across the evaluator.
2015-06-17 Support URLs in $NIX_PATHEelco Dolstra1-1/+13
This didn't work (despite claims in the manual), because the colon in "http://" was parsed as a element separator. So handle "://" specially.
2015-05-22 Fix import-from-derivation in restricted eval modeEelco Dolstra1-0/+7
This relaxes restricted mode to allow access to anything in the store. In the future, it would be better to allow access to only paths that have been constructed in the current evaluation (so a hard-coded /nix/store/blabla in a Nix expression would still be rejected). However, note that reading /nix/store itself is still rejected, so you can't use this so get access to things you don't know about.
2015-04-16 Fix using restricted mode with chrootsEelco Dolstra1-0/+5
2015-03-25 addToStore(): Take explicit name argumentEelco Dolstra1-1/+1
2015-03-19 Disable scanning for interior pointersEelco Dolstra1-0/+2
This may remove the "Repeated allocation of very large block" warnings.
2015-03-19 Fix Boehm API violationEelco Dolstra1-38/+42
We were calling GC_INIT() after doing an allocation (in the baseEnv construction), which is not allowed.
2015-03-19 Check return values from malloc/strdupEelco Dolstra1-11/+34
2015-03-18 Print some Boehm GC statsEelco Dolstra1-0/+7
2015-03-18 valueSize(): Take into account list/bindings/env sizeEelco Dolstra1-6/+15
2015-03-06 forceValueDeep: Add to error prefixEelco Dolstra1-2/+7
2015-03-06 Improve error messageEelco Dolstra1-11/+20
2015-02-23 Add restricted evaluation modeEelco Dolstra1-3/+20
If ‘--option restrict-eval true’ is given, the evaluator will throw an exception if an attempt is made to access any file outside of the Nix search path. This is primarily intended for Hydra, where we don't want people doing ‘builtins.readFile ~/.ssh/id_dsa’ or stuff like that.
2015-02-19 ExprConcatStrings: canonicalize concatenated pathsShea Levy1-1/+2
2014-12-12 Remove canary stuffEelco Dolstra1-21/+0
2014-12-02 Make all ExternalValueBase functions constShea Levy1-3/+3
2014-12-02 Allow external code using libnixexpr to add typesShea Levy1-0/+33
Code that links to libnixexpr (e.g. plugins loaded with importNative, or nix-exec) may want to provide custom value types and operations on values of those types. For example, nix-exec is currently using sets where a custom IO value type would be more appropriate. This commit provides a generic hook for such types in the form of tExternal and the ExternalBase virtual class, which contains all functions necessary for libnixexpr's type-polymorphic functions (e.g. `showType`) to be implemented.
2014-11-25 forceString(): Accept pos argumentEelco Dolstra1-2/+2
2014-11-15 Add functors (callable attribute sets).Shea Levy1-0/+12
With this, attribute sets with a `__functor` attribute can be applied just like normal functions. This can be used to attach arbitrary metadata to a function without callers needing to treat it specially.
2014-10-31 Fix more warningsEelco Dolstra1-11/+1
2014-10-09 mkList: Scrub betterEelco Dolstra1-0/+1
Clearing v.app.right was not enough, because the length field of a list only takes 32 bits, so the most significant 32 bits of v.app.left (a.k.a. v.thunk.env) would remain. This could cause Boehm GC to interpret it as a valid pointer. This change reduces maximum RSS for evaluating the ‘tested’ job in nixos/release-small.nix from 1.33 GiB to 0.80 GiB, and runtime by about 8%.
2014-10-05 Get rid of some unnecessary ExprConcatStrings nodes in dynamic attrsEelco Dolstra1-6/+3
This gives a ~18% speedup in NixOS evaluation (after converting most calls to hasAttr/getAttr to dynamic attrs).
2014-10-05 Show total allocationsEelco Dolstra1-8/+10
2014-10-01 printValue(): Don't print <CYCLE> for repeated valuesEelco Dolstra1-7/+9
2014-09-22 Make forceValueDeep work on values with cyclesEelco Dolstra1-9/+20
2014-09-22 Rename strictForceValue -> forceValueDeepEelco Dolstra1-3/+3
2014-09-22 Handle cycles when printing a valueEelco Dolstra1-5/+23
So this no longer crashes with a stack overflow: nix-instantiate -E --eval 'let as = { x = as; }; in as' Instead it prints: { x = { x = <CYCLE>; }; }
2014-09-22 Add a function ‘valueSize’Eelco Dolstra1-0/+80
It returns the size of value, including all other values and environments reachable from it. It is intended for debugging memory consumption issues.
2014-09-19 Inline Bindings::find()Eelco Dolstra1-9/+0
2014-09-19 Store Attrs inside BindingsEelco Dolstra1-14/+25
This prevents a double allocation per attribute set.
2014-09-17 Add some instrumentation for debugging GC leaksEelco Dolstra1-0/+22
2014-09-02 Fix boost::too_many_args errorEelco Dolstra1-1/+1
Fixes #333.