about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-05-02T21·58+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-05-02T21·58+0000
commitd300b4383dabb007db08c7165fb327c12dbe8e71 (patch)
tree30b02d509ebe41d065e8c148d80506952c8e492d /src/libexpr/eval.cc
parent68174bdc7d68746c5471e87bb74909c552e98644 (diff)
* Optimise null-ary term builders. Also declare all term builder
  functions as pure, which might improve performance a bit.

Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 1ee9da3b9bc8..6d2b20e53946 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -6,8 +6,6 @@
 EvalState::EvalState()
     : normalForms(32768, 50)
 {
-    blackHole = makeBlackHole();
-    
     nrEvaluated = nrCached = 0;
 
     initNixExprHelpers();
@@ -490,14 +488,14 @@ Expr evalExpr(EvalState & state, Expr e)
        previously evaluated expressions. */
     Expr nf = state.normalForms.get(e);
     if (nf) {
-        if (nf == state.blackHole)
+        if (nf == makeBlackHole())
             throw Error("infinite recursion encountered");
         state.nrCached++;
         return nf;
     }
 
     /* Otherwise, evaluate and memoize. */
-    state.normalForms.set(e, state.blackHole);
+    state.normalForms.set(e, makeBlackHole());
     try {
         nf = evalExpr2(state, e);
     } catch (Error & err) {
@@ -536,5 +534,4 @@ void printEvalStats(EvalState & state)
         % state.nrEvaluated % state.nrCached
         % ((float) state.nrCached / (float) state.nrEvaluated * 100)
         % AT_calcAllocatedSize());
-    sleep(100);
 }