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:
parent
487cd01d9f
commit
06c69f88ff
40 changed files with 386 additions and 248 deletions
|
|
@ -110,7 +110,7 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
ratexp_to_dfa(translate_dict& dict);
|
||||
tgba_succ_iterator* succ(const formula* f);
|
||||
std::pair<tgba_explicit_formula*, const state*> succ(const formula* f);
|
||||
const formula* get_label(const formula* f, const state* s) const;
|
||||
~ratexp_to_dfa();
|
||||
|
||||
|
|
@ -1133,7 +1133,7 @@ namespace spot
|
|||
}
|
||||
|
||||
// FIXME: use the new tgba::succ() interface
|
||||
tgba_succ_iterator*
|
||||
std::pair<tgba_explicit_formula*, const state*>
|
||||
ratexp_to_dfa::succ(const formula* f)
|
||||
{
|
||||
f2a_t::const_iterator it = f2a_.find(f);
|
||||
|
|
@ -1145,13 +1145,11 @@ namespace spot
|
|||
|
||||
// If a is nul, f has an empty language.
|
||||
if (!a)
|
||||
return 0;
|
||||
return {nullptr, nullptr};
|
||||
|
||||
assert(a->has_state(f));
|
||||
// This won't create a new state.
|
||||
const state* s = a->add_state(f);
|
||||
|
||||
return a->succ_iter(s);
|
||||
return {a, a->add_state(f)};
|
||||
}
|
||||
|
||||
const formula*
|
||||
|
|
@ -1364,12 +1362,11 @@ namespace spot
|
|||
{
|
||||
// rat_seen_ = true;
|
||||
const formula* f = node->child();
|
||||
tgba_succ_iterator* i = dict_.transdfa.succ(f);
|
||||
auto p = dict_.transdfa.succ(f);
|
||||
res_ = bddfalse;
|
||||
|
||||
if (!i)
|
||||
if (!p.first)
|
||||
break;
|
||||
for (i->first(); !i->done(); i->next())
|
||||
for (auto i: p.first->succ(p.second))
|
||||
{
|
||||
bdd label = i->current_condition();
|
||||
state* s = i->current_state();
|
||||
|
|
@ -1391,7 +1388,6 @@ namespace spot
|
|||
res_ |= label & bdd_ithvar(x);
|
||||
}
|
||||
}
|
||||
delete i;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue