diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-10-23 22:58:24 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-10-23 22:58:24 +0000 |
commit | a247d20604a97ff6e84b87f66e3338714e7964f0 (patch) | |
tree | f51275a10556bbbc5ee6608d2095c264cec5b50d /src | |
parent | 02934b12000d5a837ef4cac78025cb531330c2b3 (diff) |
* Fix compiling without Boehm.
* Fix the stats.
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/eval.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 8c33fd224..d73f99a15 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -13,11 +13,15 @@ #include <gc/gc.h> #include <gc/gc_cpp.h> +#define NEW (UseGC) + #else #define GC_STRDUP strdup #define GC_MALLOC malloc +#define NEW new + #endif @@ -159,7 +163,7 @@ void EvalState::addPrimOp(const string & name, string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name; Symbol sym = symbols.create(name); v->type = tPrimOp; - v->primOp = new (UseGC) PrimOp(primOp, arity, sym); + v->primOp = NEW PrimOp(primOp, arity, sym); staticBaseEnv.vars[sym] = baseEnvDispl; baseEnv.values[baseEnvDispl++] = v; (*baseEnv.values[0]->attrs)[symbols.create(name2)].value = v; @@ -320,11 +324,7 @@ void EvalState::mkAttrs(Value & v) { clearValue(v); v.type = tAttrs; -#if HAVE_BOEHMGC - v.attrs = new (UseGC) Bindings; -#else - v.attrs = new Bindings; -#endif + v.attrs = NEW Bindings; nrAttrsets++; } @@ -1133,12 +1133,10 @@ void EvalState::printStats() printMsg(v, format(" stack space per eval() level: %1% bytes") % ((&x - deepestStack) / (float) maxRecursionDepth)); printMsg(v, format(" environments allocated: %1% (%2% bytes)") - % nrEnvs % (nrEnvs * sizeof(Env))); - printMsg(v, format(" values allocated in environments: %1% (%2% bytes)") - % nrValuesInEnvs % (nrValuesInEnvs * sizeof(Value))); + % nrEnvs % (nrEnvs * sizeof(Env) + nrValuesInEnvs * sizeof(Value *))); printMsg(v, format(" list elements: %1% (%2% bytes)") % nrListElems % (nrListElems * sizeof(Value *))); - printMsg(v, format(" misc. values allocated: %1% (%2% bytes)") + printMsg(v, format(" values allocated: %1% (%2% bytes)") % nrValues % (nrValues * sizeof(Value))); printMsg(v, format(" attribute sets allocated: %1%") % nrAttrsets); printMsg(v, format(" right-biased unions: %1%") % nrOpUpdates); |