mirror of
https://github.com/NixOS/nix
synced 2025-06-30 03:23:16 +02:00
* After parsing, compute level/displacement pairs for each variable
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.
This commit is contained in:
parent
816dd3f061
commit
9985230c00
7 changed files with 258 additions and 143 deletions
|
@ -18,13 +18,6 @@ struct Value;
|
|||
typedef std::map<Symbol, Value> Bindings;
|
||||
|
||||
|
||||
struct Env
|
||||
{
|
||||
Env * up;
|
||||
Bindings bindings;
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
tInt = 1,
|
||||
tBool,
|
||||
|
@ -109,6 +102,13 @@ struct Value
|
|||
};
|
||||
|
||||
|
||||
struct Env
|
||||
{
|
||||
Env * up;
|
||||
Value values[0];
|
||||
};
|
||||
|
||||
|
||||
static inline void mkInt(Value & v, int n)
|
||||
{
|
||||
v.type = tInt;
|
||||
|
@ -258,7 +258,7 @@ public:
|
|||
|
||||
/* Allocation primitives. */
|
||||
Value * allocValues(unsigned int count);
|
||||
Env & allocEnv();
|
||||
Env & allocEnv(unsigned int size);
|
||||
|
||||
void mkList(Value & v, unsigned int length);
|
||||
void mkAttrs(Value & v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue