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,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012 Laboratoire de Recherche et Développement // Copyright (C) 2011, 2012, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE) // de l'Epita (LRDE)
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -214,9 +214,8 @@ namespace spot
~callback_context() ~callback_context()
{ {
callback_context::transitions_t::const_iterator it; for (auto t: transitions)
for (it = transitions.begin(); it != transitions.end(); ++it) t->destroy();
(*it)->destroy();
} }
}; };
@ -260,6 +259,13 @@ namespace spot
{ {
} }
void recycle(const callback_context* cc, bdd cond)
{
delete cc_;
cc_ = cc;
kripke_succ_iterator::recycle(cond);
}
~dve2_succ_iterator() ~dve2_succ_iterator()
{ {
delete cc_; delete cc_;
@ -661,6 +667,11 @@ namespace spot
~dve2_kripke() ~dve2_kripke()
{ {
if (iter_cache_)
{
delete iter_cache_;
iter_cache_ = nullptr;
}
delete[] format_filter_; delete[] format_filter_;
delete[] vname_; delete[] vname_;
if (compress_) if (compress_)
@ -857,6 +868,14 @@ namespace spot
cc->transitions.push_back(local_state->clone()); cc->transitions.push_back(local_state->clone());
} }
if (iter_cache_)
{
dve2_succ_iterator* it =
down_cast<dve2_succ_iterator*>(iter_cache_);
it->recycle(cc, scond);
iter_cache_ = nullptr;
return it;
}
return new dve2_succ_iterator(cc, scond); return new dve2_succ_iterator(cc, scond);
} }

View file

@ -1,4 +1,6 @@
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Developpement de l'Epita // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2014 Laboratoire de Recherche et
// Developpement de l'Epita
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -20,11 +22,6 @@
namespace spot namespace spot
{ {
kripke_succ_iterator::kripke_succ_iterator(const bdd& cond)
: cond_(cond)
{
}
kripke_succ_iterator::~kripke_succ_iterator() kripke_succ_iterator::~kripke_succ_iterator()
{ {
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2013 Laboratoire de Recherche et // Copyright (C) 2009, 2010, 2013, 2014 Laboratoire de Recherche et
// Developpement de l'Epita // Developpement de l'Epita
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -48,7 +48,16 @@ namespace spot
/// ///
/// The \a cond argument will be the one returned /// The \a cond argument will be the one returned
/// by kripke_succ_iterator::current_condition(). /// by kripke_succ_iterator::current_condition().
kripke_succ_iterator(const bdd& cond); kripke_succ_iterator(const bdd& cond)
: cond_(cond)
{
}
void recycle(const bdd& cond)
{
cond_ = cond;
}
virtual ~kripke_succ_iterator(); virtual ~kripke_succ_iterator();
virtual bdd current_condition() const; virtual bdd current_condition() const;

View file

@ -27,6 +27,8 @@
namespace spot namespace spot
{ {
class tgba;
/// \ingroup tgba_essentials /// \ingroup tgba_essentials
/// \brief Iterate over the successors of a state. /// \brief Iterate over the successors of a state.
/// ///
@ -100,8 +102,6 @@ namespace spot
//@} //@}
}; };
class tgba;
namespace internal namespace internal
{ {
struct SPOT_API succ_iterator struct SPOT_API succ_iterator
@ -137,34 +137,6 @@ namespace spot
it_ = nullptr; it_ = nullptr;
} }
}; };
class SPOT_API succ_iterable
{
protected:
const tgba* aut_;
tgba_succ_iterator* it_;
public:
succ_iterable(const tgba* aut, tgba_succ_iterator* it)
: aut_(aut), it_(it)
{
}
~succ_iterable()
{
delete it_;
}
succ_iterator begin()
{
it_->first();
return it_->done() ? nullptr : it_;
}
succ_iterator end()
{
return nullptr;
}
};
} }
} }

View file

@ -1,7 +1,8 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -24,15 +25,6 @@
namespace spot namespace spot
{ {
tgba_succ_iterator_concrete::tgba_succ_iterator_concrete
(const tgba_bdd_core_data& d, bdd successors)
: data_(d),
succ_set_(successors),
succ_set_left_(successors),
current_(bddfalse)
{
}
tgba_succ_iterator_concrete::~tgba_succ_iterator_concrete() tgba_succ_iterator_concrete::~tgba_succ_iterator_concrete()
{ {
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Developpement de // Copyright (C) 2013, 2014 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE). // l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -45,7 +45,19 @@ namespace spot
/// \param d The core data of the automata. /// \param d The core data of the automata.
/// These contains sets of variables useful to split a BDD, and /// These contains sets of variables useful to split a BDD, and
/// compute acceptance conditions. /// compute acceptance conditions.
tgba_succ_iterator_concrete(const tgba_bdd_core_data& d, bdd successors); tgba_succ_iterator_concrete(const tgba_bdd_core_data& d, bdd successors)
: data_(d)
{
recycle(successors);
}
void recycle(bdd successors)
{
succ_set_ = successors;
succ_set_left_ = successors;
current_ = bddfalse;
}
virtual ~tgba_succ_iterator_concrete(); virtual ~tgba_succ_iterator_concrete();
// iteration // iteration

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2012, 2013 Laboratoire de Recherche et // Copyright (C) 2009, 2011, 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.

View file

@ -1,7 +1,8 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Developpement de
// l'EPITA (LRDE). // l'EPITA (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -24,7 +25,8 @@
namespace spot namespace spot
{ {
tgba::tgba() tgba::tgba()
: last_support_conditions_input_(0), : iter_cache_(nullptr),
last_support_conditions_input_(0),
last_support_variables_input_(0), last_support_variables_input_(0),
num_acc_(-1) num_acc_(-1)
{ {
@ -36,6 +38,7 @@ namespace spot
last_support_conditions_input_->destroy(); last_support_conditions_input_->destroy();
if (last_support_variables_input_) if (last_support_variables_input_)
last_support_variables_input_->destroy(); last_support_variables_input_->destroy();
delete iter_cache_;
} }
bdd bdd

View file

@ -71,8 +71,48 @@ namespace spot
{ {
protected: protected:
tgba(); tgba();
// Any iterator returned via release_iter.
mutable tgba_succ_iterator* iter_cache_;
public: public:
#ifndef SWIG
class succ_iterable
{
protected:
const tgba* aut_;
tgba_succ_iterator* it_;
public:
succ_iterable(const tgba* aut, tgba_succ_iterator* it)
: aut_(aut), it_(it)
{
}
succ_iterable(succ_iterable&& other)
: aut_(other.aut_), it_(other.it_)
{
other.it_ = nullptr;
}
~succ_iterable()
{
if (it_)
aut_->release_iter(it_);
}
internal::succ_iterator begin()
{
it_->first();
return it_->done() ? nullptr : it_;
}
internal::succ_iterator end()
{
return nullptr;
}
};
#endif
virtual ~tgba(); virtual ~tgba();
/// \brief Get the initial state of the automaton. /// \brief Get the initial state of the automaton.
@ -111,15 +151,29 @@ namespace spot
const state* global_state = nullptr, const state* global_state = nullptr,
const tgba* global_automaton = nullptr) const = 0; const tgba* global_automaton = nullptr) const = 0;
#ifndef SWIG
/// \brief Build an iterable over the successors of \a s. /// \brief Build an iterable over the successors of \a s.
/// ///
/// This is meant to be used as /// This is meant to be used as
/// <code>for (auto i: aut->out(s)) { /* i->current_state() */ }</code>. /// <code>for (auto i: aut->out(s)) { /* i->current_state() */ }</code>.
internal::succ_iterable succ_iterable
succ(const state* s) const succ(const state* s) const
{ {
return {this, succ_iter(s)}; return {this, succ_iter(s)};
} }
#endif
/// \brief Release an iterator after usage.
///
/// This iterator can then be reused by succ_iter() to avoid
/// memory allocation.
void release_iter(tgba_succ_iterator* i) const
{
if (iter_cache_)
delete i;
else
iter_cache_ = i;
}
/// \brief Get a formula that must hold whatever successor is taken. /// \brief Get a formula that must hold whatever successor is taken.
/// ///

View file

@ -1,7 +1,8 @@
// Copyright (C) 2011 Laboratoire de Recherche et Développement de // -*- coding: utf-8 -*-
// l'Epita (LRDE). // Copyright (C) 2011, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -107,6 +108,15 @@ namespace spot
bdd global_conds = global_automaton->support_conditions(global_state); bdd global_conds = global_automaton->support_conditions(global_state);
succ_set = bdd_appexcomp(succ_set, global_conds, bddop_and, varused); succ_set = bdd_appexcomp(succ_set, global_conds, bddop_and, varused);
} }
// Do not allocate an iterator if we can reuse one.
if (iter_cache_)
{
tgba_succ_iterator_concrete* res =
down_cast<tgba_succ_iterator_concrete*>(iter_cache_);
iter_cache_ = nullptr;
res->recycle(succ_set);
return res;
}
return new tgba_succ_iterator_concrete(data_, succ_set); return new tgba_succ_iterator_concrete(data_, succ_set);
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche // Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de
// et Développement de l'Epita. // Recherche et Développement de l'Epita.
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris // Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie. // Université Pierre et Marie Curie.
@ -202,6 +202,12 @@ namespace spot
{ {
} }
void recycle(const State* start, bdd all_acc)
{
start_ = start;
all_acceptance_conditions_ = all_acc;
}
virtual void first() virtual void first()
{ {
it_ = start_->successors.begin(); it_ = start_->successors.begin();
@ -508,6 +514,14 @@ namespace spot
(void) global_state; (void) global_state;
(void) global_automaton; (void) global_automaton;
if (this->iter_cache_)
{
tgba_explicit_succ_iterator<State>* it =
down_cast<tgba_explicit_succ_iterator<State>*>(this->iter_cache_);
it->recycle(s, this->all_acceptance_conditions());
this->iter_cache_ = nullptr;
return it;
}
return return
new tgba_explicit_succ_iterator<State>(s, new tgba_explicit_succ_iterator<State>(s,
this this

View file

@ -141,7 +141,16 @@ namespace spot
const state*, const state*,
const tgba*) const const tgba*) const
{ {
succ_iter_filtered* res = new succ_iter_filtered; succ_iter_filtered* res;
if (iter_cache_)
{
res = down_cast<succ_iter_filtered*>(iter_cache_);
iter_cache_ = nullptr;
}
else
{
res = new succ_iter_filtered;
}
for (auto it: original_->succ(local_state)) for (auto it: original_->succ(local_state))
{ {
const state* s = it->current_state(); const state* s = it->current_state();

View file

@ -1,8 +1,9 @@
// Copyright (C) 2009, 2011, 2012 Laboratoire de Recherche et // -*- coding: utf-8 -*-
// Développement de l'Epita (LRDE). // Copyright (C) 2009, 2011, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de // Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie. // Université Pierre et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -88,6 +89,15 @@ namespace spot
{ {
} }
void recycle(const tgba* l, tgba_succ_iterator* left,
const tgba* r, tgba_succ_iterator* right)
{
l->release_iter(left_);
left_ = left;
r->release_iter(right_);
right_ = right;
}
virtual ~tgba_succ_iterator_product_common() virtual ~tgba_succ_iterator_product_common()
{ {
delete left_; delete left_;
@ -390,6 +400,15 @@ namespace spot
tgba_succ_iterator* ri = right_->succ_iter(s->right(), tgba_succ_iterator* ri = right_->succ_iter(s->right(),
global_state, global_automaton); global_state, global_automaton);
if (iter_cache_)
{
tgba_succ_iterator_product_common* it =
down_cast<tgba_succ_iterator_product_common*>(iter_cache_);
it->recycle(left_, li, right_, ri);
iter_cache_ = nullptr;
return it;
}
fixed_size_pool* p = const_cast<fixed_size_pool*>(&pool_); fixed_size_pool* p = const_cast<fixed_size_pool*>(&pool_);
if (left_kripke_) if (left_kripke_)
return new tgba_succ_iterator_product_kripke(li, ri, p); return new tgba_succ_iterator_product_kripke(li, ri, p);

View file

@ -1,4 +1,5 @@
// Copyright (C) 2013 Laboratoire de Recherche et // -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -41,6 +42,11 @@ namespace spot
const state* global_state, const state* global_state,
const tgba* global_automaton) const const tgba* global_automaton) const
{ {
if (iter_cache_)
{
original_->release_iter(iter_cache_);
iter_cache_ = nullptr;
}
return original_->succ_iter(local_state, global_state, global_automaton); return original_->succ_iter(local_state, global_state, global_automaton);
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012, 2013 Laboratoire de recherche et // Copyright (C) 2009, 2012, 2013, 2014 Laboratoire de recherche et
// développement de l'Epita. // développement de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -50,6 +50,11 @@ namespace spot
const state* global_state, const state* global_state,
const tgba* global_automaton) const const tgba* global_automaton) const
{ {
if (iter_cache_)
{
aut_->release_iter(iter_cache_);
iter_cache_ = nullptr;
}
return aut_->succ_iter(local_state, global_state, global_automaton); return aut_->succ_iter(local_state, global_state, global_automaton);
} }

View file

@ -170,14 +170,29 @@ namespace spot
typedef tgba_tba_proxy::cycle_list::const_iterator iterator; typedef tgba_tba_proxy::cycle_list::const_iterator iterator;
public: public:
tgba_tba_proxy_succ_iterator(const state* rs, tgba_tba_proxy_succ_iterator(const state* rs,
tgba_succ_iterator* it, tgba::succ_iterable&& iterable,
iterator expected, iterator expected,
const list& cycle, const list& cycle,
bdd the_acceptance_cond, bdd the_acceptance_cond,
const tgba_tba_proxy* aut) const tgba_tba_proxy* aut)
: the_acceptance_cond_(the_acceptance_cond) : the_acceptance_cond_(the_acceptance_cond)
{ {
for (it->first(); !it->done(); it->next()) recycle(rs, std::move(iterable), expected, cycle, aut);
}
void recycle(const state* rs,
tgba::succ_iterable&& iterable,
iterator expected,
const list& cycle,
const tgba_tba_proxy* aut)
{
if (!transmap_.empty())
{
translist_.clear();
transmap_.clear();
}
for (auto it: iterable)
{ {
bool accepting; bool accepting;
bdd acc = it->current_acceptance_conditions(); bdd acc = it->current_acceptance_conditions();
@ -324,20 +339,11 @@ namespace spot
dest->destroy(); dest->destroy();
} }
} }
delete it;
} }
virtual virtual
~tgba_tba_proxy_succ_iterator() ~tgba_tba_proxy_succ_iterator()
{ {
for (transmap_t::const_iterator i = transmap_.begin();
i != transmap_.end();)
{
const state* d = i->first.first;
// Advance i before deleting d.
++i;
d->destroy();
}
} }
// iteration // iteration
@ -492,17 +498,23 @@ namespace spot
tgba_succ_iterator* tgba_succ_iterator*
tgba_tba_proxy::succ_iter(const state* local_state, tgba_tba_proxy::succ_iter(const state* local_state,
const state* global_state, const state*, const tgba*) const
const tgba* global_automaton) const
{ {
const state_tba_proxy* s = const state_tba_proxy* s =
down_cast<const state_tba_proxy*>(local_state); down_cast<const state_tba_proxy*>(local_state);
assert(s); assert(s);
const state* rs = s->real_state(); const state* rs = s->real_state();
tgba_succ_iterator* it = a_->succ_iter(rs, global_state, global_automaton);
return new tgba_tba_proxy_succ_iterator(rs, it, if (iter_cache_)
{
tgba_tba_proxy_succ_iterator* res =
down_cast<tgba_tba_proxy_succ_iterator*>(iter_cache_);
res->recycle(rs, a_->succ(rs),
s->acceptance_iterator(), acc_cycle_, this);
iter_cache_ = nullptr;
return res;
}
return new tgba_tba_proxy_succ_iterator(rs, a_->succ(rs),
s->acceptance_iterator(), s->acceptance_iterator(),
acc_cycle_, the_acceptance_cond_, acc_cycle_, the_acceptance_cond_,
this); this);

View file

@ -1,5 +1,6 @@
// Copyright (C) 2009, 2011 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// de l'Epita (LRDE). // Copyright (C) 2009, 2011, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -94,6 +95,16 @@ namespace spot
{ {
} }
void
tgba_succ_iterator_union::recycle(const tgba* l, tgba_succ_iterator* left,
const tgba* r, tgba_succ_iterator* right)
{
l->release_iter(left_);
left_ = left;
r->release_iter(right_);
right_ = right;
}
tgba_succ_iterator_union::~tgba_succ_iterator_union() tgba_succ_iterator_union::~tgba_succ_iterator_union()
{ {
delete left_; delete left_;
@ -278,45 +289,46 @@ namespace spot
(void) global_automaton; (void) global_automaton;
const state_union* s = down_cast<const state_union*>(local_state); const state_union* s = down_cast<const state_union*>(local_state);
assert(s); assert(s);
tgba_succ_iterator_union* res = 0;
// Is it the initial state ? // Is it the initial state ?
tgba_succ_iterator* li;
tgba_succ_iterator* ri;
if (!s->left() && !s->right()) if (!s->left() && !s->right())
{ {
// Yes, create an iterator with both initial states. // Yes, create an iterator with both initial states.
state* left_init = left_->get_init_state(); state* left_init = left_->get_init_state();
state* right_init = right_->get_init_state(); state* right_init = right_->get_init_state();
tgba_succ_iterator* li = left_->succ_iter(left_init); li = left_->succ_iter(left_init);
tgba_succ_iterator* ri = right_->succ_iter(right_init); ri = right_->succ_iter(right_init);
res = new tgba_succ_iterator_union(li, ri, left_acc_missing_,
right_acc_missing_,
left_var_missing_,
right_var_missing_);
left_init->destroy(); left_init->destroy();
right_init->destroy(); right_init->destroy();
} }
else
{
// No, create an iterator based on the corresponding state // No, create an iterator based on the corresponding state
// in the left or in the right automaton. // in the left or in the right automaton.
if (s->left()) else if (s->left())
{ {
tgba_succ_iterator* li = left_->succ_iter(s->left()); li = left_->succ_iter(s->left());
res = new tgba_succ_iterator_union(li, 0, left_acc_missing_, ri = nullptr;
right_acc_missing_,
left_var_missing_,
right_var_missing_);
} }
else else
{ {
tgba_succ_iterator* ri = right_->succ_iter(s->right()); li = nullptr;
res = new tgba_succ_iterator_union(0, ri, left_acc_missing_, ri = right_->succ_iter(s->right());
}
if (iter_cache_)
{
tgba_succ_iterator_union* res =
down_cast<tgba_succ_iterator_union*>(iter_cache_);
res->recycle(left_, li, right_, ri);
iter_cache_ = nullptr;
return res;
}
return new tgba_succ_iterator_union(li, ri,
left_acc_missing_,
right_acc_missing_, right_acc_missing_,
left_var_missing_, left_var_missing_,
right_var_missing_); right_var_missing_);
} }
}
return res;
}
bdd bdd
tgba_union::compute_support_conditions(const state* in) const tgba_union::compute_support_conditions(const state* in) const

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2013 Laboratoire de Recherche et // Copyright (C) 2009, 2011, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -84,6 +84,9 @@ namespace spot
bdd left_missing, bdd left_missing,
bdd right_missing, bdd left_var, bdd right_var); bdd right_missing, bdd left_var, bdd right_var);
void recycle(const tgba* l, tgba_succ_iterator* left,
const tgba* r, tgba_succ_iterator* right);
virtual ~tgba_succ_iterator_union(); virtual ~tgba_succ_iterator_union();
// iteration // iteration

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et // Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita. // Développement de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -95,6 +95,12 @@ namespace spot
{ {
} }
void recycle(const tgba* a, tgba_succ_iterator* it)
{
a->release_iter(it_);
it_ = it;
}
virtual virtual
~tgba_wdba_comp_proxy_succ_iterator() ~tgba_wdba_comp_proxy_succ_iterator()
{ {
@ -197,9 +203,17 @@ namespace spot
assert(s); assert(s);
const state* o = s->real_state(); const state* o = s->real_state();
tgba_succ_iterator* it = 0; tgba_succ_iterator* it = nullptr;
if (o) if (o)
it = a_->succ_iter(s->real_state(), global_state, global_automaton); it = a_->succ_iter(s->real_state(), global_state, global_automaton);
if (iter_cache_)
{
tgba_wdba_comp_proxy_succ_iterator* res =
down_cast<tgba_wdba_comp_proxy_succ_iterator*>(iter_cache_);
res->recycle(a_, it);
iter_cache_ = nullptr;
return res;
}
return new tgba_wdba_comp_proxy_succ_iterator(it, return new tgba_wdba_comp_proxy_succ_iterator(it,
the_acceptance_cond_); the_acceptance_cond_);
} }

View file

@ -1,4 +1,4 @@
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004, 2014 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
@ -88,7 +88,7 @@ namespace spot
{ {
// Found it! // Found it!
finalize(father, s, start, l); finalize(father, s, start, l);
delete i; a_->release_iter(i);
return dest; return dest;
} }
@ -100,7 +100,7 @@ namespace spot
father[dest] = s; father[dest] = s;
} }
} }
delete i; a_->release_iter(i);
} }
return 0; return 0;
} }

View file

@ -339,7 +339,8 @@ namespace spot
else else
break; break;
} }
delete ri; if (ri)
right->release_iter(ri);
} }
} }
delete left; delete left;

View file

@ -136,7 +136,7 @@ namespace spot
// No more successors. // No more successors.
bool f = cur.f; bool f = cur.f;
tagged_state v = cur.ts; tagged_state v = cur.ts;
delete cur.succ; aut_->release_iter(cur.succ);
dfs_.pop_back(); dfs_.pop_back();
if (f) if (f)
@ -158,7 +158,7 @@ namespace spot
// returned false. // returned false.
while (!dfs_.empty()) while (!dfs_.empty())
{ {
delete dfs_.back().succ; aut_->release_iter(dfs_.back().succ);
dfs_.pop_back(); dfs_.pop_back();
} }

View file

@ -438,8 +438,7 @@ namespace spot
dout << "(3) augmenting paths based on Cand[" << q1 dout << "(3) augmenting paths based on Cand[" << q1
<< "] and Ref[" << q1p << "]\n"; << "] and Ref[" << q1p << "]\n";
tgba_succ_iterator* it = ref->succ_iter(d.int_to_state[q1p]); for (auto it: ref->succ(d.int_to_state[q1p]))
for (it->first(); !it->done(); it->next())
{ {
const state* dps = it->current_state(); const state* dps = it->current_state();
int dp = d.state_to_int[dps]; int dp = d.state_to_int[dps];
@ -469,7 +468,6 @@ namespace spot
} }
} }
} }
delete it;
} }
bdd all_acc = ref->all_acceptance_conditions(); bdd all_acc = ref->all_acceptance_conditions();
@ -502,9 +500,7 @@ namespace spot
else else
pid1 = d.pathid_ref[p1]; pid1 = d.pathid_ref[p1];
tgba_succ_iterator* it = for (auto it: ref->succ(d.int_to_state[q2p]))
ref->succ_iter(d.int_to_state[q2p]);
for (it->first(); !it->done(); it->next())
{ {
const state* dps = it->current_state(); const state* dps = it->current_state();
// Skip destinations not in the SCC. // Skip destinations not in the SCC.
@ -567,7 +563,6 @@ namespace spot
} }
} }
} }
delete it;
} }
} }
} }
@ -598,9 +593,7 @@ namespace spot
else else
pid1 = d.pathid_cand[p1]; pid1 = d.pathid_cand[p1];
tgba_succ_iterator* it = for (auto it: ref->succ(d.int_to_state[q2p]))
ref->succ_iter(d.int_to_state[q2p]);
for (it->first(); !it->done(); it->next())
{ {
const state* dps = it->current_state(); const state* dps = it->current_state();
// Skip destinations not in the SCC. // Skip destinations not in the SCC.
@ -665,7 +658,6 @@ namespace spot
} }
} }
} }
delete it;
} }
} }
} }

View file

@ -582,8 +582,7 @@ namespace spot
path p1(q1, q1p); path p1(q1, q1p);
int p1id = d.pathid[p1]; int p1id = d.pathid[p1];
tgba_succ_iterator* it = ref->succ_iter(d.int_to_state[q1p]); for (auto it: ref->succ(d.int_to_state[q1p]))
for (it->first(); !it->done(); it->next())
{ {
const state* dps = it->current_state(); const state* dps = it->current_state();
int dp = d.state_to_int[dps]; int dp = d.state_to_int[dps];
@ -612,7 +611,6 @@ namespace spot
} }
} }
} }
delete it;
} }
bdd all_acc = ref->all_acceptance_conditions(); bdd all_acc = ref->all_acceptance_conditions();
@ -645,10 +643,7 @@ namespace spot
int pid = d.pathid[p]; int pid = d.pathid[p];
tgba_succ_iterator* it = for (auto it: ref->succ(d.int_to_state[q2p]))
ref->succ_iter(d.int_to_state[q2p]);
for (it->first(); !it->done(); it->next())
{ {
const state* dps = it->current_state(); const state* dps = it->current_state();
// Skip destinations not in the SCC. // Skip destinations not in the SCC.
@ -836,7 +831,6 @@ namespace spot
} }
} }
} }
delete it;
} }
} }
} }

View file

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

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008, 2010, 2011, 2013 Laboratoire de recherche et // Copyright (C) 2008, 2010, 2011, 2013, 2014 Laboratoire de recherche
// développement de l'Epita (LRDE). // et développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
// Pierre et Marie Curie. // Pierre et Marie Curie.
@ -80,7 +80,7 @@ namespace spot
~gv04() ~gv04()
{ {
for (stack_type::iterator i = stack.begin(); i != stack.end(); ++i) for (stack_type::iterator i = stack.begin(); i != stack.end(); ++i)
delete i->lasttr; a_->release_iter(i->lasttr);
hash_type::const_iterator s = h.begin(); hash_type::const_iterator s = h.begin();
while (s != h.end()) while (s != h.end())
{ {
@ -203,7 +203,7 @@ namespace spot
assert(static_cast<unsigned int>(top + 1) == stack.size()); assert(static_cast<unsigned int>(top + 1) == stack.size());
for (int i = top; i >= dftop; --i) for (int i = top; i >= dftop; --i)
{ {
delete stack[i].lasttr; a_->release_iter(stack[i].lasttr);
stack.pop_back(); stack.pop_back();
dec_depth(); dec_depth();
} }

View file

@ -1,5 +1,6 @@
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Developpement // -*- coding: utf-8 -*-
// de l'Epita (LRDE). // Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -96,12 +97,10 @@ namespace spot
if (!aut) if (!aut)
return false; return false;
const std::list<const spot::state*> states = map.states_of(scc); for (auto ss: map.states_of(scc))
std::list<const spot::state*>::const_iterator it;
for (it = states.begin(); it != states.end(); ++it)
{ {
const state_explicit_formula* s = const state_explicit_formula* s =
down_cast<const state_explicit_formula*>(*it); down_cast<const state_explicit_formula*>(ss);
assert(s); assert(s);
if (aut->get_label(s)->is_syntactic_persistence()) if (aut->get_label(s)->is_syntactic_persistence())
return true; return true;
@ -117,12 +116,10 @@ namespace spot
if (!aut) if (!aut)
return false; return false;
const std::list<const spot::state*> states = map.states_of(scc); for (auto ss: map.states_of(scc))
std::list<const spot::state*>::const_iterator it;
for (it = states.begin(); it != states.end(); ++it)
{ {
const state_explicit_formula* s = const state_explicit_formula* s =
down_cast<const state_explicit_formula*>(*it); down_cast<const state_explicit_formula*>(ss);
assert(s); assert(s);
if (aut->get_label(s)->is_syntactic_guarantee()) if (aut->get_label(s)->is_syntactic_guarantee())
return true; return true;
@ -134,18 +131,15 @@ namespace spot
is_complete_scc(scc_map& map, unsigned scc) is_complete_scc(scc_map& map, unsigned scc)
{ {
const spot::tgba *a = map.get_aut(); const spot::tgba *a = map.get_aut();
const std::list<const spot::state*> states = map.states_of(scc); for (auto s: map.states_of(scc))
std::list<const spot::state*>::const_iterator it;
for (it = states.begin(); it != states.end(); ++it)
{ {
const state *s = *it;
tgba_succ_iterator* it = a->succ_iter(s); tgba_succ_iterator* it = a->succ_iter(s);
it->first(); it->first();
// If a state has no successors, the SCC is not complete. // If a state has no successors, the SCC is not complete.
if (it->done()) if (it->done())
{ {
delete it; a->release_iter(it);
return false; return false;
} }
@ -163,7 +157,7 @@ namespace spot
it->next(); it->next();
} }
while (!it->done()); while (!it->done());
delete it; a->release_iter(it);
if (sumall != bddtrue) if (sumall != bddtrue)
return false; return false;

View file

@ -1,9 +1,9 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et // Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// et Marie Curie. // Université Pierre et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -104,7 +104,7 @@ namespace spot
it->first(); it->first();
bool accepting = bool accepting =
!it->done() && it->current_acceptance_conditions() == all_acc_conds_; !it->done() && it->current_acceptance_conditions() == all_acc_conds_;
delete it; aut_->release_iter(it);
return accepting; return accepting;
} }

View file

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

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de recherche et développement de // Copyright (C) 2011, 2013, 2014 Laboratoire de recherche et
// l'Epita (LRDE). // développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
@ -68,13 +68,13 @@ namespace spot
while (!st_blue.empty()) while (!st_blue.empty())
{ {
h.pop_notify(st_blue.front().s); h.pop_notify(st_blue.front().s);
delete st_blue.front().it; a_->release_iter(st_blue.front().it);
st_blue.pop_front(); st_blue.pop_front();
} }
while (!st_red.empty()) while (!st_red.empty())
{ {
h.pop_notify(st_red.front().s); h.pop_notify(st_red.front().s);
delete st_red.front().it; a_->release_iter(st_red.front().it);
st_red.pop_front(); st_red.pop_front();
} }
} }
@ -159,7 +159,7 @@ namespace spot
void pop(stack_type& st) void pop(stack_type& st)
{ {
dec_depth(); dec_depth();
delete st.front().it; a_->release_iter(st.front().it);
st.pop_front(); st.pop_front();
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de recherche et développement de // Copyright (C) 2011, 2013, 2014 Laboratoire de recherche et
// l'Epita (LRDE). // développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005, 2006 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004, 2005, 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
@ -230,11 +230,11 @@ namespace spot
typedef std::unordered_set<const state*, typedef std::unordered_set<const state*,
state_ptr_hash, state_ptr_equal> state_set; state_ptr_hash, state_ptr_equal> state_set;
void clean(stack_type& st1, state_set& seen, state_set& dead) void clean(const tgba* a, stack_type& st1, state_set& seen, state_set& dead)
{ {
while (!st1.empty()) while (!st1.empty())
{ {
delete st1.front().it; a->release_iter(st1.front().it);
st1.pop_front(); st1.pop_front();
} }
for (state_set::iterator i = seen.begin(); i != seen.end();) for (state_set::iterator i = seen.begin(); i != seen.end();)
@ -309,7 +309,7 @@ namespace spot
covered_acc |= acc; covered_acc |= acc;
if (covered_acc == a_->all_acceptance_conditions()) if (covered_acc == a_->all_acceptance_conditions())
{ {
clean(st1, seen, dead); clean(a_, st1, seen, dead);
s_prime->destroy(); s_prime->destroy();
return true; return true;
} }
@ -334,7 +334,7 @@ namespace spot
ndfsr_trace << " all the successors have been visited" ndfsr_trace << " all the successors have been visited"
<< std::endl; << std::endl;
stack_item f_dest(f); stack_item f_dest(f);
delete st1.front().it; a_->release_iter(st1.front().it);
st1.pop_front(); st1.pop_front();
if (!st1.empty() && (f_dest.acc & covered_acc) != f_dest.acc) if (!st1.empty() && (f_dest.acc & covered_acc) != f_dest.acc)
{ {
@ -351,7 +351,7 @@ namespace spot
covered_acc |= f_dest.acc; covered_acc |= f_dest.acc;
if (covered_acc == a_->all_acceptance_conditions()) if (covered_acc == a_->all_acceptance_conditions())
{ {
clean(st1, seen, dead); clean(a_, st1, seen, dead);
return true; return true;
} }
} }
@ -364,7 +364,7 @@ namespace spot
} }
} }
clean(st1, seen, dead); clean(a_, st1, seen, dead);
return false; return false;
} }

View file

@ -1,7 +1,8 @@
// Copyright (C) 2009, 2011, 2012 Laboratoire de Recherche et // -*- coding: utf-8 -*-
// Développement de l'Epita (LRDE). // Copyright (C) 2009, 2011, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -88,7 +89,7 @@ namespace spot
it->first(); it->first();
bool accepting = bool accepting =
!it->done() && it->current_acceptance_conditions() == all_acc_conds_; !it->done() && it->current_acceptance_conditions() == all_acc_conds_;
delete it; aut_->release_iter(it);
return accepting; return accepting;
} }
@ -123,7 +124,7 @@ namespace spot
label = "accept_all"; label = "accept_all";
current->destroy(); current->destroy();
} }
delete it; aut_->release_iter(it);
} }
else else
label = "T0_S" + ns; label = "T0_S" + ns;
@ -149,7 +150,7 @@ namespace spot
} }
else else
{ {
state* current =it->current_state(); state* current = it->current_state();
if (state_is_accepting(s) if (state_is_accepting(s)
&& it->current_condition() == bddtrue && it->current_condition() == bddtrue
&& s->compare(init_) != 0 && s->compare(init_) != 0
@ -167,7 +168,7 @@ namespace spot
} }
current->destroy(); current->destroy();
} }
delete it; aut_->release_iter(it);
} }
void void

View file

@ -1,7 +1,8 @@
// Copyright (C) 2009, 2011, 2013 Laboratoire de Recherche et // -*- coding: utf-8 -*-
// Développement de l'Epita (LRDE). // Copyright (C) 2009, 2011, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -81,7 +82,7 @@ namespace spot
current->destroy(); current->destroy();
} }
} }
delete si; aut_->release_iter(si);
} }
end(); end();
} }
@ -174,7 +175,7 @@ namespace spot
void void
tgba_reachable_iterator_depth_first::pop() tgba_reachable_iterator_depth_first::pop()
{ {
delete todo.back().it; aut_->release_iter(todo.back().it);
todo.pop_back(); todo.pop_back();
if (!todo.empty()) if (!todo.empty())
todo.back().it->next(); todo.back().it->next();

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Développement // Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
@ -189,7 +189,7 @@ namespace spot
s2->destroy(); s2->destroy();
} }
} }
delete j; a->release_iter(j);
s->destroy(); s->destroy();
return false; return false;
} }
@ -211,7 +211,7 @@ namespace spot
bdd_print_accset(os, a->get_dict(), acc); bdd_print_accset(os, a->get_dict(), acc);
os << std::endl; os << std::endl;
} }
delete j; a->release_iter(j);
// Sum acceptance conditions. // Sum acceptance conditions.
// //

View file

@ -60,7 +60,7 @@ namespace spot
it->next(); it->next();
result = (!dest->compare(s)) && it->done() && (cond == bddtrue); result = (!dest->compare(s)) && it->done() && (cond == bddtrue);
dest->destroy(); dest->destroy();
delete it; aut->release_iter(it);
} }
// Free the scc_map if we created it. // Free the scc_map if we created it.

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2011, 2012, 2013 Laboratoire de Recherche // Copyright (C) 2008, 2009, 2011, 2012, 2013, 2014 Laboratoire de
// et Développement de l'Epita. // Recherche et Développement de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -199,7 +199,7 @@ namespace spot
root_.front().succ.insert(std::make_pair(num, cond)); root_.front().succ.insert(std::make_pair(num, cond));
} }
delete succ; aut_->release_iter(succ);
// Do not destroy CURR: it is a key in H. // Do not destroy CURR: it is a key in H.
continue; continue;
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de // Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
@ -68,13 +68,13 @@ namespace spot
while (!st_blue.empty()) while (!st_blue.empty())
{ {
h.pop_notify(st_blue.front().s); h.pop_notify(st_blue.front().s);
delete st_blue.front().it; a_->release_iter(st_blue.front().it);
st_blue.pop_front(); st_blue.pop_front();
} }
while (!st_red.empty()) while (!st_red.empty())
{ {
h.pop_notify(st_red.front().s); h.pop_notify(st_red.front().s);
delete st_red.front().it; a_->release_iter(st_red.front().it);
st_red.pop_front(); st_red.pop_front();
} }
} }
@ -159,7 +159,7 @@ namespace spot
void pop(stack_type& st) void pop(stack_type& st)
{ {
dec_depth(); dec_depth();
delete st.front().it; a_->release_iter(st.front().it);
st.pop_front(); st.pop_front();
} }

View file

@ -335,14 +335,12 @@ namespace spot
// the acceptance of the destination state on its incoming // the acceptance of the destination state on its incoming
// arcs (which now become outgoing args after // arcs (which now become outgoing args after
// transposition). // transposition).
tgba_succ_iterator* it = out_->succ_iter(out_s); for (auto it: out_->succ(out_s))
it->first();
if (!it->done())
{ {
bdd acc = ac_.complement(it->current_acceptance_conditions()); bdd acc = ac_.complement(it->current_acceptance_conditions());
t->acceptance_conditions = acc; t->acceptance_conditions = acc;
break;
} }
delete it;
} }
} }

View file

@ -68,13 +68,13 @@ namespace spot
while (!st_blue.empty()) while (!st_blue.empty())
{ {
h.pop_notify(st_blue.front().s); h.pop_notify(st_blue.front().s);
delete st_blue.front().it; a_->release_iter(st_blue.front().it);
st_blue.pop_front(); st_blue.pop_front();
} }
while (!st_red.empty()) while (!st_red.empty())
{ {
h.pop_notify(st_red.front().s); h.pop_notify(st_red.front().s);
delete st_red.front().it; a_->release_iter(st_red.front().it);
st_red.pop_front(); st_red.pop_front();
} }
} }
@ -133,7 +133,7 @@ namespace spot
void pop(stack_type& st) void pop(stack_type& st)
{ {
dec_depth(); dec_depth();
delete st.front().it; a_->release_iter(st.front().it);
st.pop_front(); st.pop_front();
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de // Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
@ -93,13 +93,13 @@ namespace spot
while (!st_blue.empty()) while (!st_blue.empty())
{ {
h.pop_notify(st_blue.front().s); h.pop_notify(st_blue.front().s);
delete st_blue.front().it; a_->release_iter(st_blue.front().it);
st_blue.pop_front(); st_blue.pop_front();
} }
while (!st_red.empty()) while (!st_red.empty())
{ {
h.pop_notify(st_red.front().s); h.pop_notify(st_red.front().s);
delete st_red.front().it; a_->release_iter(st_red.front().it);
st_red.pop_front(); st_red.pop_front();
} }
} }
@ -158,7 +158,7 @@ namespace spot
void pop(stack_type& st) void pop(stack_type& st)
{ {
dec_depth(); dec_depth();
delete st.front().it; a_->release_iter(st.front().it);
st.pop_front(); st.pop_front();
} }