3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-19 15:19:01 +00:00
Commit graph

46 commits

Author SHA1 Message Date
Nikolaj Bjorner 71bad7159b #7418 - circumvent use of timer threads to make WASM integration of z3 easier
The scoped_timer uses a std::therad. Spawning this thread fails in cases of WASM.
Instead of adapting builds and using async features at the level of WASM and the client, we expose a specialized version of z3 that doesn't use threads at all, neither for solvers nor for timers.
The tradeoff is that the periodic poll that checks for timeout directly queries the global clock each time.
We characterize it as based on polling.
2024-11-21 11:20:05 -08:00
Felix Kohlgrüber a7b41c49fe
fix for spurious wakeups in scoped_timer (#6102) 2022-06-22 10:50:19 +01:00
Nuno Lopes 25e915fe95 fix #5990: deadlock in the scoped_timer
Thanks to Felix Kohlgrueber for reporting the bug and for the analysis
2022-06-21 16:29:09 +01:00
Nuno Lopes 689e2d41de remove a bunch of unneeded memory allocations 2022-02-25 16:08:23 +00:00
zhouzhenghui 9d82c1d8a9
fix deadlock in scoped_timer destructor (#5371) 2021-12-21 18:47:13 +00:00
Nikolaj Bjorner ec034679ce #5215
memory leaks
2021-05-19 12:42:38 -07:00
Nuno Lopes db04ccb137 scoped_timer: skip extra unneded heap allocation 2021-03-01 14:36:22 +00:00
John Regehr b7e1b1e118
get rid of threads in the scoped_timer thread pool prior to forking, on non-Windows (#4833)
* on POSIX systems, fork() is dangerous in the presence of a thread
pool, because the child process inherits only the thread from the
parent that actually called fork().

this patch winds down the scoped_timer thread pool in preparation for
forking; workers will get freshly created again following the fork
call.
2020-11-29 21:26:53 +00:00
Nuno Lopes 40159a3a96 fix single-thread build 2020-11-19 21:46:32 +00:00
John Regehr 0fa88efc2b
scoped_timer: wait for timer thread before main thread continues (#4803) 2020-11-19 21:42:55 +00:00
Nuno Lopes 1730bc7c7f fix #4763: shell not finishing before hard timeout
The timer thread for the hard timeout was leaking and thus the thread only exited on timeout
2020-10-30 10:01:09 +00:00
Nikolaj Bjorner f354671465 add parameter for scenario from #4743 2020-10-30 01:14:34 -07:00
Nikolaj Bjorner 0de3149634 fix #4763
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-10-29 11:15:53 -07:00
Nikolaj Bjorner 8d76470a8a fixes to mostly solver arith/euf and backtracking scopes 2020-10-26 11:06:41 -07:00
Nuno Lopes 4e9035d4b9 cleanup thread pool of scoped_timer on memory finalize
but keep it alive on Z3_memory_reset()
2020-10-24 12:46:50 +01:00
Nikolaj Bjorner a4aa87b6c9 revert to STL allocated memory to be orthogonal to memory manager behavior
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-10-22 12:12:32 -07:00
Nikolaj Bjorner 9bd7df7e19 add stub for finalize
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-10-22 11:07:05 -07:00
John Regehr a95c35dadb
thread pool for scoped_timer (#4748)
creating a fresh thread for every scoped_timer has significant overhead
in some use cases. this patch creates a persistent pool of worker threads
to do this job, resulting in 20-30% speedup of some alive2 jobs on a
large multicore
2020-10-22 18:25:01 +01:00
Nikolaj Bjorner 5844964d95 rename temporary macro
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-18 17:17:51 -07:00
Nuno Lopes f3cd7d646d further simplifications to scoped_timer 2019-02-21 10:42:42 +00:00
Nuno Lopes 73f6806371 rewrite scoped_timer in C++11 way
the code is much smaller and reused across platforms
I see a small speedup on linux as well
2019-02-04 17:42:27 +00:00
Bruce Mitchener b83d6d77c9 Use nullptr rather than 0/NULL. 2018-11-28 14:57:01 +07:00
Bruce Mitchener a76397d3b8 Refer to macOS rather than Mac OS / OSX. 2018-10-02 17:38:09 +07:00
Nikolaj Bjorner d74978c277 fix #1762, #1764, #1768
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-07-26 20:29:26 +01:00
Nikolaj Bjorner b5f067bec5 fix #1592 #1587
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-04-25 11:18:24 +02:00
Pierre Pronchery 5f7bd993de Add support for NetBSD
Originally from David Holland <dholland@NetBSD.org>.
2018-03-13 21:59:35 +01:00
Bruce Mitchener 76eb7b9ede Use nullptr. 2018-02-12 14:05:55 +07:00
Nikolaj Bjorner bc8ae21ebe missing parameters for OSX/Linus
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-08-18 15:14:47 -07:00
Nikolaj Bjorner 7a977f0106 ensure that timeouts are distinguished from other cancel events #848
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-08-18 14:54:54 -07:00
Nikolaj Bjorner b19f94ae5b make include paths uniformly use path relative to src. #534
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-07-31 13:24:11 -07:00
Dan Liew b5aa6d5eb5 Fix issue with bd1f07f864 pointed out by
@nunolopes .

If `pthread_cond_signal()` is called while `m_mutex` is held then the
timing thread might be woken up twice due to waking up from
`pthread_cond_timeout()` (due to being signaled) but then being forced
to sleep again because the thread calling `~imp()` is still holding
`m_mutex` (which the timing thread needs to acquire).
2016-12-19 22:36:42 +00:00
Dan Liew bd1f07f864 Fix implementation of scoped_timer under Linux where it was
incorrectly assumed that `pthread_cond_timedwait()` would exit
due to a condition variable being signaled or a timeout occuring.

According to the documentation `pthread_cond_timedwait()` might
spuriously wake so we introduce a new variable `m_signal_sent` (that is
guarded by an existing mutex) that is used as the variable to check that
the thread wake was not spurious.

This is intended to partially fix #839 .
2016-12-11 23:12:36 +00:00
Nikolaj Bjorner e9db934f1a improving perf of mutex finding, revert semantics of 0 timeout to no-timeout. Issue #791
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-11-17 04:26:17 +02:00
Nuno Lopes 4b0f2cae0d fix compiler warning in scoped_timer.cpp on linux
2 secs in nanosec representation still fit in 31 bits, so no need for ULL

Signed-off-by: Nuno Lopes <nlopes@microsoft.com>
2015-12-08 17:03:18 +00:00
Nuno Lopes d9bafc3fba rewrite scoped_timer for linux
The previous version was racy and could lead to crashes.
The timer could be deleted before the callback was called, making it execute on already freed memory

This new version is similar to Mac's. It spawns its own thread and uses pthread_cond_wait.
Care is taken for small timeouts to avoid races in the thread creation and timer destruction.

Signed-off-by: Nuno Lopes <nlopes@microsoft.com>
2015-11-22 11:40:52 +00:00
Nikolaj Bjorner fc592fc856 fix for #291. The root issue is that the set of antecedents is recycled as a fixed object between routines. Antecedents that were already allocated for a Gomory cut got reset by the internalizer. This causes unsound bounds axioms to be created
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2015-11-05 15:08:42 -08:00
Christoph M. Wintersteiger f3441c6a9b tabs and indentation 2015-09-17 13:25:22 +01:00
Nikolaj Bjorner c6683fd6fa to fix that timeout of 0 has different interpretations across platforms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2014-10-05 12:27:57 -07:00
Christoph M. Wintersteiger 581bbb58fb typo
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
2014-05-02 18:04:32 +01:00
Christoph M. Wintersteiger 8150bd5617 OSX timeout handling bugfix 2014-05-02 17:58:17 +01:00
Leonardo de Moura 9674f511b3 Fix scoped_timer for Linux. Nested timers were misbehaving, and it was not possible to create timers in more than one thread
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-12-17 20:46:04 -08:00
Leonardo de Moura 8d45de02c5 Fixed timer bug on freebsd
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-12-07 06:07:57 -08:00
Leonardo de Moura 5e4d1151eb fixing clang compilation problems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-12-05 15:20:16 -08:00
Leonardo de Moura b169963909 fixed FreeBSD support
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-11-18 00:09:45 -08:00
Leonardo de Moura 1a3eb3a2ed Added support for FreeBSD 2012-11-18 00:05:32 -08:00
Leonardo de Moura 2c464d413d Reorganizing source code. Created util dir
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-10-20 10:19:38 -07:00
Renamed from lib/scoped_timer.cpp (Browse further)