about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-10-23T22·58+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-10-23T22·58+0000
commita247d20604a97ff6e84b87f66e3338714e7964f0 (patch)
treef51275a10556bbbc5ee6608d2095c264cec5b50d
parent02934b12000d5a837ef4cac78025cb531330c2b3 (diff)
* Fix compiling without Boehm.
* Fix the stats.

-rw-r--r--src/libexpr/eval.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 8c33fd2248..d73f99a156 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);