Commit graph

105 commits

Author SHA1 Message Date
Alexandre Duret-Lutz
057e67e7f6 [buddy] do not use ACLOCAL_AMFLAGS anymore
Fixes #326.

* Makefile.am: Here.
2018-03-09 20:24:37 +01:00
Alexandre Duret-Lutz
7f42782701 [buddy] switch to C++14 compilation
* configure.ac: Here.  Rename --enable-c++14 into --enable-c++17.
2017-08-22 18:21:46 +02:00
Alexandre Duret-Lutz
361b44e571 [buddy] use powers of two for the sizes of all hash tables
* src/bddop.c, src/bddx.h, src/cache.c, src/cache.h, src/kernel.c,
src/kernel.h, src/prime.c, src/prime.h, src/reorder.c: Use power of
two for the sizes of all hash tables, in order to reduce the amount of
divisions performed.  Also allow bddhash to be smaller than bddnodes.
2017-07-24 13:42:21 +02:00
Alexandre Duret-Lutz
819cd7b8b6 [buddy] fix handling of bdd_apply_biimp
* src/bddop.c: Fix shortcut.
2017-06-20 15:19:00 +02:00
Alexandre Duret-Lutz
613c485c24 [buddy] rename ChangeLog
We generate ChangeLog from git log now.

* ChangeLog: Rename as...
* ChangeLog.1: ... this.
* Makefile.am: Distribute the latter.
2017-05-04 13:32:52 +02:00
Alexandre Duret-Lutz
800db9c251 [buddy] fix libbddx.pc generation
Report from Jeroen Meijer.

* src/Makefile.am (libbddx.pc): Depends on Makefile.  Use a
temporary.  Declare in CLEANFILES instead of DISTCLEANFILES.
2017-05-04 11:13:19 +02:00
Alexandre Duret-Lutz
cb920242a7 [buddy] fix previous patch
* src/fdd.c: C++ comments are not supported in C90.
2017-04-19 13:25:07 +02:00
Michael Weber
44ca086f5d [buddy] Addref in fdd_intaddvarblock
* src/fdd.c (fdd_intaddvarblock): Add missing addref.

Signed-off-by: Jaco van de Pol <J.C.vandepol@ewi.utwente.nl>
Signed-off-by: Michael Weber <michaelw@cs.utwente.nl>
2017-04-19 11:22:20 +02:00
Alexandre Duret-Lutz
42e5cd955e [buddy] Typos in comments
* src/kernel.c (bdd_addref): Fix typo documentation.
* src/bddop.c (bdd_appall, bdd_appallcomp): Likewise.
2017-03-30 21:45:22 +02:00
Alexandre Duret-Lutz
63776d9c93 [buddy] add -Wno-gnu if supported
* m4/gccwarns.m4: Add -Wno-gnu to workaround a diagnostic from
clang 3.9.1 on arch Linux.  clang was complaining whtat assert()
is using a GNU extension.
2017-03-14 12:03:10 +01:00
Alexandre Duret-Lutz
bd4e0f19b9 [buddy] remove useless #include<assert.h>
* src/bddio.c, src/bddop.c, src/imatrix.c, src/pairs.c: Here.
2017-03-13 22:26:47 +01:00
Alexandre Duret-Lutz
33f9e03e83 [buddy] update the warning flags to match Spot's
* m4/gccwarns.m4: Add more flags taken from Spot.
Also add -Wno-long-long to suppress one warning.
2017-02-01 18:50:54 +01:00
Alexandre Duret-Lutz
a2f174f721 [buddy] fix some -Wpedantic messages
* src/bddop.c: Empty macro arguments are undefined ISO C90 and
ISO C++98.  Use '+' when calling APPLY_SHORTCUTS.
* src/fdd.c, src/kernel.c: Avoid constructs invalid in C90.
* src/bddop.c, src/bddx.h, src/kernel.c, src/kernel.h,
examples/cmilner/cmilner.c: Remove C++ comments.
2017-02-01 18:50:37 +01:00
Alexandre Duret-Lutz
a9b056baa4 [buddy] install a pkg-config file
* src/libbddx.pc.in: New file.
* src/Makefile.am: Generate libbddx.pc, and install it.
Distribute libbddx.pc.in.
* src/.gitignore: Ignore *.pc.
2017-01-14 17:55:58 +01:00
Maximilien Colange
878649c823 [buddy] Add an option to enable C++14.
* configure.ac: add an option --enable-c++14.
2016-12-13 17:42:22 +01:00
Alexandre Duret-Lutz
38c4fc8812 [buddy] fix bdd_noderesize
* src/kernel.c: Fix error introduced by 5a862295.
Report from Tomáš Babiak.
2016-11-19 16:46:10 +01:00
Alexandre Duret-Lutz
0ac14e9ca2 [buddy] avoid costly calls to setjmp() when BDD_REORDER_NONE
* src/reorder.c, src/kernel.h: Expose bddreordermethod.
* src/bddop.c: Test bddreordermethod before ever calling setjmp().
2016-11-09 14:52:04 +01:00
Alexandre Duret-Lutz
84b16aa6bd [buddy] consolidate shortcuts for binary operation
* src/bddop.c (apply_rec, appquant_rec): Define missing shortcuts
for bddop_less, bddop_diff, bddop_revimpl and define them once.
2016-11-09 10:29:00 +01:00
Alexandre Duret-Lutz
5a862295d3 [buddy] improve initialization of bddnode
* src/kernel.c, src/kernel.h: Here.
2016-11-08 19:03:08 +01:00
Alexandre Duret-Lutz
63818a3e69 [buddy] Fix several PVS-Studio warnings
For #192.

* src/bddio.c, src/cppext.cxx, src/kernel.c: Fix printf formats, calls
to new, and simplify one check in bdd_delref_nc().
2016-10-28 17:12:21 +02:00
Alexandre Duret-Lutz
a32ccd649d [buddy] slight optimization of bdd_implies
* src/bddop.c: Avoid the first recursion when it is obvious that the
second will fail.
2016-10-20 20:59:28 +02:00
Alexandre Duret-Lutz
57a055b656 [buddy] typo in comment
* src/bddop.c (bdd_implies): Fix documentation.
2016-10-20 09:37:24 +02:00
Alexandre Duret-Lutz
4c1147e497 [buddy] speedup bdd_init and bdd_noderesize
* src/kernel.c: The initialization code of the BDD cache was
awfully slow due to multiple references to global variables.
2016-10-19 10:51:38 +02:00
Alexandre Duret-Lutz
8e69530023 [buddy] fix an undefined behavior
* src/prime.c (BitIsSet): Do not shift signed
int by 31 places; shift unsigned int instead.
2016-07-27 19:47:30 +02:00
Alexandre Duret-Lutz
86abd6c1c0 Use -Bsymbolic-functions and -Bsymbolic
This avoids dynamic lookups to resolve symbols inside the library, but
disallows symbol interposition.

* m4/symbolic.m4: New file.
* buddy/m4/symbolic.m4: New link.
* configure.ac, buddy/configure.ac: Add AX_SYMBOLIC.
* buddy/src/Makefile.am, iface/ltsmin/Makefile.am, src/Makefile.am,
wrap/python/Makefile.am: Link with $(SYMBOLIC_LDFLAGS).
2015-11-10 15:10:11 +01:00
Etienne Renault
5f4b7e1f3f Remove all cvsignore files.
* .cvsignore, bench/.cvsignore,
bench/emptchk/.cvsignore, bench/emptchk/models/.cvsignore,
bench/ltl2tgba/.cvsignore, buddy/.cvsignore,
buddy/doc/.cvsignore, buddy/examples/.cvsignore,
buddy/examples/adder/.cvsignore,
buddy/examples/bddcalc/.cvsignore,
buddy/examples/bddtest/.cvsignore,
buddy/examples/calculator/.cvsignore,
buddy/examples/cmilner/.cvsignore,
buddy/examples/fdd/.cvsignore,
buddy/examples/internal/.cvsignore,
buddy/examples/milner/.cvsignore,
buddy/examples/money/.cvsignore,
buddy/examples/queen/.cvsignore,
buddy/examples/solitare/.cvsignore,
buddy/src/.cvsignore, buddy/tools/.cvsignore,
doc/.cvsignore, iface/.cvsignore,
src/.cvsignore, src/ltlast/.cvsignore,
src/ltlenv/.cvsignore, src/ltlparse/.cvsignore,
src/ltlvisit/.cvsignore, src/misc/.cvsignore,
src/sanity/.cvsignore, src/tests/.cvsignore,
src/twa/.cvsignore, tools/.cvsignore,
wrap/.cvsignore, wrap/python/.cvsignore,
wrap/python/tests/.cvsignore: here.
2015-04-24 13:57:56 +02:00
Alexandre Duret-Lutz
1ffdd57383 [buddy] backport some fixes from upstream
* src/fdd.c, src/imatrix.c, src/kernel.c, src/reorder.c: Here.
2015-03-11 23:45:00 +01:00
Alexandre Duret-Lutz
787e3f9315 [buddy] fix undefined behavior
The bug was found while running Spot's src/tgbatest/randpsl.test
on Debian i386 with gcc-4.9.2.  The following call would crash:

./ltl2tgba -R3 -t '(!(F(({{{(p0) |
{[*0]}}:{{{(p1)}[*2]}[:*]}[*]:[*2]}[:*0..3]}[]-> (G(F(p1)))) &
(G((!(p1)) | ((!(p2)) W (G(!(p0)))))))))'

On amd64 the call does not crash, but valgrind nonetheless
report that uninitialized memory is being read by bdd_gbc()
during the second garbage collect.

* src/kernel.h (PUSHREF): Define as a function rather than a macro
to avoid undefined behavior.  See comments for details.
2015-03-10 15:44:08 +01:00
Alexandre Duret-Lutz
e55bcd95aa hoa: preliminary implementation of a parser
* src/hoaparse/Makefile.am, src/hoaparse/fmterror.cc,
src/hoaparse/hoaparse.yy, src/hoaparse/hoascan.ll,
src/hoaparse/parsedecl.hh, src/hoaparse/public.hh: New files.
* src/Makefile.am, configure.ac, README: Adjust.
* src/tgbatest/ltl2tgba.cc: Add a -XH option.
* src/tgbatest/hoaparse.test: New file.
* src/tgbatest/Makefile.am: Adjust.
* buddy/src/bddx.h: Add a bdd_from_int() function.
2014-11-19 19:29:29 +01:00
Alexandre Duret-Lutz
ad8d24222a buddy: rename libbdd to libbddx
* buddy/src/bdd.h, buddy/src/bvec.h, buddy/src/fdd.h: Rename as...
* buddy/src/bddx.h, buddy/src/bvecx.h, buddy/src/fddx.h: ... these.
* buddy/src/Makefile.am: Build libbddx.la instead of libbdd.la.
* buddy/examples/Makefile.def: Use it.
* Makefile.am, buddy/src/bddtest.cxx, buddy/src/bvec.c,
buddy/src/cppext.cxx, buddy/src/fdd.c, buddy/src/imatrix.h,
buddy/src/kernel.h, buddy/examples/adder/adder.cxx,
buddy/examples/bddcalc/parser_.h, buddy/examples/bddtest/bddtest.cxx,
buddy/examples/cmilner/cmilner.c, buddy/examples/fdd/fdd.cxx,
buddy/examples/milner/milner.cxx, buddy/examples/money/money.cxx,
buddy/examples/queen/queen.cxx, buddy/examples/solitare/solitare.cxx,
m4/buddy.m4, src/ltlvisit/apcollect.hh, src/ltlvisit/simplify.hh,
src/misc/bddlt.hh, src/misc/bddop.hh, src/misc/minato.hh,
src/priv/acccompl.hh, src/priv/accconv.hh, src/priv/accmap.hh,
src/priv/bddalloc.cc, src/tgba/bdddict.hh, src/tgba/bddprint.hh,
src/tgba/tgbamask.hh, src/tgba/tgbasafracomplement.cc,
src/tgbaalgos/emptiness.hh, src/tgbaalgos/gtec/sccstack.hh,
src/tgbaalgos/neverclaim.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/sccfilter.hh, src/tgbaalgos/sccinfo.hh,
src/tgbaalgos/weight.hh, wrap/python/buddy.i: Adjust.
* NEWS, README: Document it.
2014-10-30 20:58:10 +01:00
Alexandre Duret-Lutz
971788fdbe [buddy] pack cache entry on 16 bytes, not 20.
The double result is never used with a triple keys,
so we can pack the cache entry more tightly.

* src/cache.h: Reorganize the cache entry the structure.
* src/cache.c: Cleanup the code while we are at it.
* src/bddop.c: Adjust to accesses to cache entries.
2014-10-28 13:13:05 +01:00
Alexandre Duret-Lutz
1244b61710 [buddy] Fix a harmless uninitialized read.
This can only cause failure when running under valgrind (i.e., in the
test suite), but is not a problem in practice as the test is certain
to fail the entry->c check whenever entry->b is uninitialized.

* src/bddop.c (bdd_implies): Here.
2014-08-11 00:21:42 +02:00
Alexandre Duret-Lutz
7d70229f5b [buddy] Improve handling of bddtrue and bddfalse.
* src/bdd.h, src/cppext.cxx: Handle bddtrue and bddfalse using
special types.
2014-06-20 18:38:58 +02:00
Alexandre Duret-Lutz
bd6d88db96 [buddy] Enable C++11 and add a move constructor/assignment operator.
* configure.ac: Enable C++11 mode.
* src/bdd.h: Use noexport, and add a move constructor and
move assignment operator.  The move version of these method
do not have to increment the reference counter, saving time.
On a small test run, this change saved 24% of the calls to
bdd_addref_nc().
2014-02-12 14:08:46 +01:00
Alexandre Duret-Lutz
cee552689a [buddy] Probe for -fvisibility and -fvisibility-inlines-hidden.
* configure.ac: Check gcc and g++ for -fvisibility and
-fvisibility-inlines-hidden.  Add these options to
CFLAGS and CXXFLAGS.
* m4/ax_check_compile_flag.m4: New file.
* src/Makefile.am: Build BuDDy as a single library, reverting part of
the changes introduced in my previous patch to this file.  Since
the options are set in CFLAGS/CXXFLAGS, there is no possibility
for -fvisibility-inlines-hidden to be passed to the C compiler.
2013-07-29 01:14:36 +02:00
Alexandre Duret-Lutz
b5710663f4 [buddy] Restrict the number of exported symbols.
* src/bdd.h, src/bvec.h, src/fdd.h: Declare all exported
symbols using BUDDY_API, a new macro that sets visibility=default.
* src/Makefile.am: Compile with -fvisibility=hidden by default,
and compile the C++ part with -fvisibility-inlines-hidden as well.
2013-07-29 01:12:12 +02:00
Alexandre Duret-Lutz
15c9b72f13 [buddy]
* src/bdd.h: Make all inplace operators return a reference.
2012-12-24 13:14:23 +01:00
Alexandre Duret-Lutz
af639e58c7 more files to ignore 2012-11-28 16:45:04 +01:00
Alexandre Duret-Lutz
8cb68d76b5 * NEWS, buddy/src/bddop.c, m4/valgrind.m4: s/wether/whether/. 2012-08-22 13:53:59 +02:00
Alexandre Duret-Lutz
bc5a4ba416 [buddy] Fix the recent Automake workaround for VPATH builds.
* examples/bddcalc/Makefile.am (ACLOCAL_AMFLAGS): Add -I. for
parse.c.  Reported by Pierre Parutto.
2012-06-20 20:56:03 +02:00
Alexandre Duret-Lutz
a814b97543 [buddy] Add a function bdd_implies to decide implications between BDDs.
* src/bdd.h (bdd_implies): New function.
* src/bddop.c (bdd_implies): Implement it.
(CACHEID_IMPLIES, IMPLIES_HASH): New helper macros.
2012-06-19 21:52:03 +02:00
Alexandre Duret-Lutz
e7a46e10e2 [buddy] Reduce the size of bddNode to improve cache efficiency.
The unicity table was mixed with the bddNode table for now
apparent reason.  After the hash of some node is computed,
bddnodes[hash] did only contain some random node (not the one
looked for) whose .hash member would point to the actual node with
this hash.  So that's a two step lookup.  With this patch, we sill
have a two step lookup, but the .hash member have been moved to a
separate array.  A consequence is that bddNode is now 16-byte long
(instead of 20) so it will never span across two cache lines.

* src/kernel.h (bddNode): Remove the hash member, and move it...
(bddhash): ... as this new separate table.
* src/kernel.c, src/reorder.c: Adjust all code.
2012-06-19 21:52:03 +02:00
Alexandre Duret-Lutz
b98c47246c [buddy] Adjust parser construction to support Automake 1.11 and 1.12.
* examples/bddcalc/parser.yxx: Rename as ...
* examples/bddcalc/parser.y: ... this.
* examples/bddcalc/parser_.cxx: New file that includes parser.c.
* examples/bddcalc/Makefile.am: Adjust.
* examples/bddcalc/parser.hxx: Delete this unused file.
2012-06-19 17:03:34 +02:00
Alexandre Duret-Lutz
b6702fc23a [buddy] Speedup hash functions.
* src/kernel.h (PAIR, TRIPLE): Redefine these hash functions
using something that is simpler to compute.
2012-04-28 09:34:43 +02:00
Alexandre Duret-Lutz
92ef9d6e07 * examples/adder/adder.cxx (test_vector): Add parentheses to
remove a clang++-2.9 warning.
2011-08-28 10:37:42 +02:00
Alexandre Duret-Lutz
24be6076f6 * src/bddop.c (bdd_support): Speedup using a cache. 2011-08-28 10:37:42 +02:00
Alexandre Duret-Lutz
fb3edb47e0 [buddy] * src/bddop.c (apply_rec, appquant_rec): Improve caching by
reordering operands of commutative operators.
2011-06-14 09:51:32 +02:00
Alexandre Duret-Lutz
d3ccaa7cb9 [buddy] Remove some valgrind warnings about uninitialized memory when
BddCache_lookup return an entry from a Not operation.

* src/bddop.c (apply_rec, simplify_rec): When checking the cache
entry, always check entry->a and entry->c before checking
entry->b, because the "not_rec()" function does not initialize
the latter.
2011-06-09 11:56:02 +02:00
Alexandre Duret-Lutz
b535741a90 [buddy] * examples/cmilner/cmilner.c (A, transitions, initial_state)
(reachable_states, has_deadlocks): Declare as static functions,
to suppress a GCC warning.
2011-06-07 14:52:35 +02:00
Alexandre Duret-Lutz
1d1872ab90 [buddy] Inline the "is bdd constant" check performed in copies/constructors.
This avoids a library call to bdd_addref or bdd_delref.

* src/kernel.c (bdd_delref_nc, bdd_addref_nc): New function,
that work only on BDD that are not constant.
* src/cpext.cxx (bdd::operator=): Move...
* src/bdd.hh (bdd::operator=): ... here.
(bdd::bdd, bdd::~bdd, bdd::operator=): Inline the "is bdd constant"
check and call bdd_delref_nc/bdd_addref_nc only otherwise.
2011-04-30 13:37:53 +02:00