Introduce tgba::release_iter().

Instead of "delete iter;" we now do "aut->release_iter(iter);" to
give the iterator back to the automaton.  The TGBA classes now
reuse a previously returned tgba_succ_iterator to answer a succ_iter()
call, therefore avoiding (1) memory allocation, as well as (2) vtable
and other constant member initialization.

* src/tgba/tgba.hh, src/tgba/tgba.cc (release_iter, iter_cache_):
Implement a release_iter() that stores the released iterator
in iter_cache_.
* src/tgba/succiter.hh (internal::succ_iterable): Move...
* src/tgba/tgba.hh (tgba::succ_iterable): ... here. And use
release_iter().

* iface/dve2/dve2.cc, src/kripke/kripke.cc, src/kripke/kripke.hh,
src/tgba/succiterconcrete.cc, src/tgba/succiterconcrete.hh,
src/tgba/taatgba.hh, src/tgba/tgbabddconcrete.cc,
src/tgba/tgbaexplicit.hh, src/tgba/tgbamask.cc, src/tgba/tgbaproduct.cc,
src/tgba/tgbaproxy.cc, src/tgba/tgbascc.cc, src/tgba/tgbatba.cc,
src/tgba/tgbaunion.cc, src/tgba/tgbaunion.hh, src/tgba/wdbacomp.cc,
src/tgbaalgos/bfssteps.cc, src/tgbaalgos/compsusp.cc,
src/tgbaalgos/cycles.cc, src/tgbaalgos/dtbasat.cc,
src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/gtec/gtec.cc,
src/tgbaalgos/gv04.cc, src/tgbaalgos/isweakscc.cc,
src/tgbaalgos/lbtt.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/magic.cc, src/tgbaalgos/ndfs_result.hxx,
src/tgbaalgos/neverclaim.cc, src/tgbaalgos/reachiter.cc,
src/tgbaalgos/replayrun.cc, src/tgbaalgos/safety.cc,
src/tgbaalgos/scc.cc, src/tgbaalgos/se05.cc,
src/tgbaalgos/simulation.cc, src/tgbaalgos/tau03.cc,
src/tgbaalgos/tau03opt.cc: Use release_iter() instead of deleting
iterators, and used recycle iter_cache_ in implementations of
tgba::succ_iter().
This commit is contained in:
Alexandre Duret-Lutz 2014-01-26 15:26:09 +01:00
parent 487cd01d9f
commit 06c69f88ff
40 changed files with 386 additions and 248 deletions

View file

@ -1,8 +1,9 @@
// Copyright (C) 2008, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2011, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -135,7 +136,7 @@ namespace spot
to_remove.push(ecs_->aut->succ_iter(spi.first));
}
}
delete i;
ecs_->aut->release_iter(i);
if (to_remove.empty())
break;
i = to_remove.top();
@ -212,8 +213,7 @@ namespace spot
remove_component(curr);
ecs_->root.pop();
}
delete succ;
ecs_->aut->release_iter(succ);
// Do not destroy CURR: it is a key in H.
continue;
}
@ -288,7 +288,7 @@ namespace spot
// Release all iterators in TODO.
while (!todo.empty())
{
delete todo.top().second;
ecs_->aut->release_iter(todo.top().second);
todo.pop();
dec_depth();
}
@ -325,14 +325,13 @@ namespace spot
couvreur99_check_shy* shy)
: s(s), n(n)
{
tgba_succ_iterator* iter = shy->ecs_->aut->succ_iter(s);
for (iter->first(); !iter->done(); iter->next(), shy->inc_transitions())
for (auto iter: shy->ecs_->aut->succ(s))
{
q.push_back(successor(iter->current_acceptance_conditions(),
iter->current_state()));
shy->inc_depth();
shy->inc_transitions();
}
delete iter;
}
couvreur99_check_shy::couvreur99_check_shy(const tgba* a,