forked from lix-project/lix
* Remove allocValues().
This commit is contained in:
parent
4dee289550
commit
3f66cfb96b
|
@ -282,13 +282,6 @@ Value * EvalState::allocValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Value * EvalState::allocValues(unsigned int count)
|
|
||||||
{
|
|
||||||
nrValues += count;
|
|
||||||
return (Value *) GC_MALLOC(count * sizeof(Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Env & EvalState::allocEnv(unsigned int size)
|
Env & EvalState::allocEnv(unsigned int size)
|
||||||
{
|
{
|
||||||
nrEnvs++;
|
nrEnvs++;
|
||||||
|
@ -542,11 +535,8 @@ void ExprLet::eval(EvalState & state, Env & env, Value & v)
|
||||||
void ExprList::eval(EvalState & state, Env & env, Value & v)
|
void ExprList::eval(EvalState & state, Env & env, Value & v)
|
||||||
{
|
{
|
||||||
state.mkList(v, elems.size());
|
state.mkList(v, elems.size());
|
||||||
Value * vs = state.allocValues(v.list.length);
|
for (unsigned int n = 0; n < v.list.length; ++n)
|
||||||
for (unsigned int n = 0; n < v.list.length; ++n) {
|
mkThunk(*(v.list.elems[n] = state.allocValue()), env, elems[n]);
|
||||||
v.list.elems[n] = &vs[n];
|
|
||||||
mkThunk(vs[n], env, elems[n]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -630,12 +620,10 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v)
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Value * v2 = allocValues(2);
|
|
||||||
v2[0] = fun;
|
|
||||||
v2[1] = arg;
|
|
||||||
v.type = tPrimOpApp;
|
v.type = tPrimOpApp;
|
||||||
v.primOpApp.left = &v2[0];
|
v.primOpApp.left = allocValue();
|
||||||
v.primOpApp.right = &v2[1];
|
*v.primOpApp.left = fun;
|
||||||
|
v.primOpApp.right = &arg;
|
||||||
v.primOpApp.argsLeft = argsLeft - 1;
|
v.primOpApp.argsLeft = argsLeft - 1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -290,7 +290,6 @@ public:
|
||||||
|
|
||||||
/* Allocation primitives. */
|
/* Allocation primitives. */
|
||||||
Value * allocValue();
|
Value * allocValue();
|
||||||
Value * allocValues(unsigned int count);
|
|
||||||
Env & allocEnv(unsigned int size);
|
Env & allocEnv(unsigned int size);
|
||||||
|
|
||||||
Value * allocAttr(Value & vAttrs, const Symbol & name);
|
Value * allocAttr(Value & vAttrs, const Symbol & name);
|
||||||
|
|
|
@ -167,13 +167,9 @@ static void prim_genericClosure(EvalState & state, Value * * args, Value & v)
|
||||||
|
|
||||||
/* Create the result list. */
|
/* Create the result list. */
|
||||||
state.mkList(v, res.size());
|
state.mkList(v, res.size());
|
||||||
Value * vs = state.allocValues(res.size());
|
|
||||||
|
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
foreach (list<Value>::iterator, i, res) {
|
foreach (list<Value>::iterator, i, res)
|
||||||
v.list.elems[n] = &vs[n];
|
*(v.list.elems[n++] = state.allocValue()) = *i;
|
||||||
vs[n++] = *i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -691,17 +687,14 @@ static void prim_attrNames(EvalState & state, Value * * args, Value & v)
|
||||||
state.forceAttrs(*args[0]);
|
state.forceAttrs(*args[0]);
|
||||||
|
|
||||||
state.mkList(v, args[0]->attrs->size());
|
state.mkList(v, args[0]->attrs->size());
|
||||||
Value * vs = state.allocValues(v.list.length);
|
|
||||||
|
|
||||||
StringSet names;
|
StringSet names;
|
||||||
foreach (Bindings::iterator, i, *args[0]->attrs)
|
foreach (Bindings::iterator, i, *args[0]->attrs)
|
||||||
names.insert(i->first);
|
names.insert(i->first);
|
||||||
|
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
foreach (StringSet::iterator, i, names) {
|
foreach (StringSet::iterator, i, names)
|
||||||
v.list.elems[n] = &vs[n];
|
mkString(*(v.list.elems[n++] = state.allocValue()), *i);
|
||||||
mkString(vs[n++], *i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -870,12 +863,10 @@ static void prim_map(EvalState & state, Value * * args, Value & v)
|
||||||
state.forceList(*args[1]);
|
state.forceList(*args[1]);
|
||||||
|
|
||||||
state.mkList(v, args[1]->list.length);
|
state.mkList(v, args[1]->list.length);
|
||||||
Value * vs = state.allocValues(v.list.length);
|
|
||||||
|
|
||||||
for (unsigned int n = 0; n < v.list.length; ++n) {
|
for (unsigned int n = 0; n < v.list.length; ++n)
|
||||||
v.list.elems[n] = &vs[n];
|
mkApp(*(v.list.elems[n] = state.allocValue()),
|
||||||
mkApp(vs[n], *args[0], *args[1]->list.elems[n]);
|
*args[0], *args[1]->list.elems[n]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
||||||
the meta attributes. */
|
the meta attributes. */
|
||||||
Path drvPath = keepDerivations ? i->queryDrvPath(state) : "";
|
Path drvPath = keepDerivations ? i->queryDrvPath(state) : "";
|
||||||
|
|
||||||
Value & v(*state.allocValues(1));
|
Value & v(*state.allocValue());
|
||||||
manifest.list.elems[n++] = &v;
|
manifest.list.elems[n++] = &v;
|
||||||
state.mkAttrs(v);
|
state.mkAttrs(v);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
||||||
state.mkList(v2, j->second.stringValues.size());
|
state.mkList(v2, j->second.stringValues.size());
|
||||||
unsigned int m = 0;
|
unsigned int m = 0;
|
||||||
foreach (Strings::const_iterator, k, j->second.stringValues) {
|
foreach (Strings::const_iterator, k, j->second.stringValues) {
|
||||||
v2.list.elems[m] = state.allocValues(1);
|
v2.list.elems[m] = state.allocValue();
|
||||||
mkString(*v2.list.elems[m++], *k);
|
mkString(*v2.list.elems[m++], *k);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue