From 9b44480612dd30a7292ec94a88e4018b8f18e3f0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 4 Feb 2004 16:03:29 +0000 Subject: * Use a map to lookup primops. * Various performance improvements in the evaluator. * Do not link against unused (and missing!) libraries (-lsglr, etc.). --- src/libexpr/eval.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libexpr/eval.hh') diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 0bc052676deb..34ac467f1d80 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -11,9 +11,17 @@ typedef map DrvPaths; typedef map DrvHashes; +struct EvalState; +typedef Expr (* PrimOp0) (EvalState &); +typedef Expr (* PrimOp1) (EvalState &, Expr arg); + + struct EvalState { ATermMap normalForms; + ATermMap primOps0; /* nullary primops */ + ATermMap primOps1; /* unary primops */ + ATermMap primOpsAll; DrvPaths drvPaths; DrvHashes drvHashes; /* normalised derivation hashes */ Expr blackHole; @@ -22,6 +30,9 @@ struct EvalState unsigned int nrCached; EvalState(); + + void addPrimOp0(const string & name, PrimOp0 primOp); + void addPrimOp1(const string & name, PrimOp1 primOp); }; -- cgit 1.4.1