Remove canary stuff

This commit is contained in:
Eelco Dolstra 2014-12-12 10:59:50 +01:00
parent a144eb1415
commit 8aedaf111e
4 changed files with 0 additions and 58 deletions

View file

@ -247,7 +247,6 @@ EvalState::EvalState(const Strings & _searchPath)
EvalState::~EvalState()
{
fileEvalCache.clear();
printCanaries();
}
@ -1514,26 +1513,6 @@ void EvalState::printStats()
}
void EvalState::printCanaries()
{
#if HAVE_BOEHMGC
if (!settings.get("debug-gc", false)) return;
GC_gcollect();
if (gcCanaries.empty()) {
printMsg(lvlError, "all canaries have been garbage-collected");
return;
}
printMsg(lvlError, "the following canaries have not been garbage-collected:");
for (auto i : gcCanaries)
printMsg(lvlError, format(" %1%") % i->string.s);
#endif
}
size_t valueSize(Value & v)
{
std::set<const void *> seen;

View file

@ -287,8 +287,6 @@ public:
/* Print statistics. */
void printStats();
void printCanaries();
private:
unsigned long nrEnvs;
@ -320,12 +318,6 @@ private:
friend struct ExprOpConcatLists;
friend struct ExprSelect;
friend void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v);
#if HAVE_BOEHMGC
std::set<Value *> gcCanaries;
friend void canaryFinalizer(GC_PTR obj, GC_PTR client_data);
friend void prim_gcCanary(EvalState & state, const Pos & pos, Value * * args, Value & v);
#endif
};

View file

@ -417,32 +417,6 @@ static void prim_trace(EvalState & state, const Pos & pos, Value * * args, Value
}
#if HAVE_BOEHMGC
void canaryFinalizer(GC_PTR obj, GC_PTR client_data)
{
Value * v = (Value *) obj;
EvalState & state(* (EvalState *) client_data);
printMsg(lvlError, format("canary %1% garbage-collected") % v->string.s);
auto i = state.gcCanaries.find(v);
assert(i != state.gcCanaries.end());
state.gcCanaries.erase(i);
}
#endif
void prim_gcCanary(EvalState & state, const Pos & pos, Value * * args, Value & v)
{
string s = state.forceStringNoCtx(*args[0], pos);
state.mkList(v, 1);
Value * canary = v.list.elems[0] = state.allocValue();
#if HAVE_BOEHMGC
state.gcCanaries.insert(canary);
GC_register_finalizer(canary, canaryFinalizer, &state, 0, 0);
#endif
mkString(*canary, s);
}
void prim_valueSize(EvalState & state, const Pos & pos, Value * * args, Value & v)
{
/* We're not forcing the argument on purpose. */
@ -1560,7 +1534,6 @@ void EvalState::createBaseEnv()
// Debugging
addPrimOp("__trace", 2, prim_trace);
addPrimOp("__gcCanary", 1, prim_gcCanary);
addPrimOp("__valueSize", 1, prim_valueSize);
// Paths

View file

@ -86,8 +86,6 @@ void processExpr(EvalState & state, const Strings & attrPaths,
}
}
}
state.printCanaries();
}