Commit graph

526 commits

Author SHA1 Message Date
Leonardo de Moura
6700cf1f73 fix(util/thread): add missing declaration when compiling with Boost
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 08:05:19 -07:00
Leonardo de Moura
af0b02f521 fix(util/thread_script_state): add a better workaround for clang++ bug
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:54:10 -07:00
Leonardo de Moura
89a7898054 fix(*): static variable initialization problems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:44:12 -07:00
Leonardo de Moura
3562c76161 fix(util/sexpr/options): add workaround for clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:14:39 -07:00
Leonardo de Moura
db36d465dc chore(util/sexpr): cleanup
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:01:43 -07:00
Leonardo de Moura
8d4312d9d8 fix(util/thread): warning messages 2014-06-06 17:50:46 -07:00
Leonardo de Moura
06d2ff021b feat(util/thread_script_state): add system_import procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 16:23:24 -07:00
Leonardo de Moura
e9ef59ab3e feat(util): add global (thread local) script_state objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 15:46:16 -07:00
Leonardo de Moura
5b898aa3ed refactor(util/trie): modify interface to avoid the creation of many temporary optional values and inc/dec reference counters
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 12:40:51 -07:00
Leonardo de Moura
fc4b6a92cc fix(util/lru_cache): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 14:59:00 -07:00
Leonardo de Moura
b81d536946 fix(util/stackinfo): make sure check_stack can be invoked before 'main' (i.e., during initialization)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 14:57:32 -07:00
Leonardo de Moura
df3280e86e feat(util): add lru cache
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 13:26:02 -07:00
Leonardo de Moura
a9a38675cb feat(util/lua): add helper functions for checking expected number of arguments in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 10:16:27 -07:00
Leonardo de Moura
5a5d66edc8 feat(util/trie): add value() method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 01:19:23 -07:00
Leonardo de Moura
931ebf9637 chore(util/rb_tree): cleanup code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 00:40:52 -07:00
Leonardo de Moura
e155708dda feat(util): add (functional) name_map
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 14:46:13 -07:00
Leonardo de Moura
dcacf6fbca refactor(util): rename name_map to name_hash_map
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 14:34:22 -07:00
Leonardo de Moura
3145cee51f refactor(library/aliases): move replace_prefix to util/name
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 15:11:22 -07:00
Leonardo de Moura
88440cbb3e feat(util/name): add optional<name> helper functions for implementing Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:33:42 -07:00
Leonardo de Moura
5566186c34 feat(util/list_fn): add get_ith function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-19 09:00:09 -07:00
Leonardo de Moura
405b24861c feat(util/name): add methods append_after and append_before
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-18 13:49:24 -07:00
Leonardo de Moura
4325b126d4 feat(util/list): add map2 for list<T1> -> list<T2>, where T1 and T2 may be different, we still keep map because compiler can automatically infer all template arguments, this is not the case for map2
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-17 19:18:18 -07:00
Leonardo de Moura
69e72c278d feat(kernel): add proof irrelevance for classes
We can use this feature to implement proof irrelevance for Identity types.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-16 15:30:32 -07:00
Leonardo de Moura
28329a55b0 feat(util/name): use '.' instead of '::' as hierarchical name separator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-16 12:35:43 -07:00
Leonardo de Moura
a8124b41d0 feat(util/name): expose is_list_name function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-14 09:44:58 -07:00
Leonardo de Moura
01eda46b69 feat(util/trie): add for_each and display methods
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-13 18:23:27 -07:00
Leonardo de Moura
bfa6193bfe feat(util/trie): add merge method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-13 17:59:20 -07:00
Leonardo de Moura
479685cb97 feat(util): add basic trie datastructure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-13 17:40:33 -07:00
Leonardo de Moura
3196cd19dc chore(util/thread): add atomic_uint type
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-12 16:14:31 -07:00
Leonardo de Moura
ad2b1d0d91 chore(util/lua_list): improve error message in table_to_list aux function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-12 12:58:10 -07:00
Leonardo de Moura
0eaf1bb2cf fix(util/lua_named_param): compilation warning
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-12 12:21:48 -07:00
Leonardo de Moura
bc1a91496a feat(util/lua_list): allow Lua list objects to be moved between states
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-08 18:49:27 -07:00
Leonardo de Moura
5a7f181efc feat(util/name_set): improve name_set Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-08 17:17:00 -07:00
Leonardo de Moura
3aa1afdf51 refactor(util): file name convention
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-08 14:15:28 -07:00
Leonardo de Moura
1e4c5f1761 feat(util/lua_named_param): add new functions for handling named parameters in Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-08 14:12:15 -07:00
Leonardo de Moura
bf57f951ea refactor(util): move Lua named parameter support to a different file
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-08 13:20:37 -07:00
Leonardo de Moura
1a8d75c4f0 feat(util): name_set Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-07 18:32:53 -07:00
Leonardo de Moura
7fe61bc69c feat(util): name_generator Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-07 17:28:11 -07:00
Leonardo de Moura
208384b5b6 fix(util/rb_tree): missing const
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-07 14:07:15 -07:00
Leonardo de Moura
f568ed97b8 feat(util/lua): add functions for simulating python-like named arguments using Lua tables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-05 14:41:33 -07:00
Leonardo de Moura
b928f313d3 feat(util): add macro for exposing the type std::pair<T1, T2> in Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-02 16:30:17 -07:00
Leonardo de Moura
91069c5f7f feat(util/list_lua): add length method to list Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-02 13:37:15 -07:00
Leonardo de Moura
107f139764 fix(util/list_lua): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-02 13:33:49 -07:00
Leonardo de Moura
a5229e5283 chore(util/lua): name convention
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-01 18:40:18 -07:00
Leonardo de Moura
739f98b642 fix(util/script_state): deadlock
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-01 14:10:57 -07:00
Leonardo de Moura
027614cebb fix(kernel/metavar): wierd memory leak that only happens when compiling with clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-01 12:55:55 -07:00
Leonardo de Moura
9452d164ec feat(util/script_state): use recursive_mutex instead of mutex
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-01 12:27:12 -07:00
Leonardo de Moura
dbf327bad9 feat(util): expose list<name> in Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-30 16:32:10 -07:00
Leonardo de Moura
03a32dcc77 feat(util): add macro for exposing the type list<T> in Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-30 16:31:44 -07:00
Leonardo de Moura
aba5b65319 feat(util/lua): add macro pushnil
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-30 10:29:08 -07:00
Leonardo de Moura
93a61748e9 fix(kernel/level): bug in optional<level>() constructor
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-29 17:00:57 -07:00
Leonardo de Moura
097f562016 refactor(*): add pushinteger and pushnumeral inline functions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-29 14:47:08 -07:00
Leonardo de Moura
412a3797f4 refactor(*): add pushboolean inline function, and replace lua_pushboolean with it
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-29 14:37:16 -07:00
Leonardo de Moura
5fdd2fe3a9 refactor(util/script_state): replace splay_map with rb_map in the Lua environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-28 17:53:34 -07:00
Leonardo de Moura
7eb9496643 feat(util): add missing lbool.* files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-24 12:27:19 -07:00
Leonardo de Moura
ad43d9177b refactor(util/name_set): implement name_sets using red black trees instead of hashtables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-22 11:09:13 -07:00
Leonardo de Moura
9a3959eed1 feat(util): add method get_rc (mainly for debugging purposes)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-17 10:36:54 -07:00
Leonardo de Moura
eb487e44c1 refactor(kernel): use names instead of unsigned integers to encode level parameters
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:57 -07:00
Leonardo de Moura
42e253c962 fix(*): style and clang warnings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:56 -07:00
Leonardo de Moura
f855dbb7b0 feat(util): add maps based on red-black trees
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:56 -07:00
Leonardo de Moura
54d5088c98 feat(util/rb_tree): add check_invariant for red black trees
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:56 -07:00
Leonardo de Moura
1ab12eb105 refactor(util/splay_map): remove unnecessary operation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:56 -07:00
Leonardo de Moura
528ea367ad feat(util): add red-black trees
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:56 -07:00
Leonardo de Moura
50300126a5 refactor(util/name_generator): make sure there is no risk of overflow, name generators will be extensively used in version 0.2
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:56 -07:00
Leonardo de Moura
e1f4f1f0d1 feat(util/thread): add atomic_uchar
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-03-18 10:27:56 -07:00
Leonardo de Moura
aec9c84d0d fix(util/lua): deadlock
Errors in the Lua library produce longjmps.
The longjmp will not unwind the C++ stack.
In the new test, the lock was not being released, and the system was deadlocking in the next call that tried to lock the environment

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 15:16:29 -08:00
Leonardo de Moura
f101554e93 fix(util/script_exception): make sure a script_nested_exception may have a nested script_nested_exception, use LEAN_THREAD_LOCAL macro instead of thread_local
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 08:07:52 -08:00
Leonardo de Moura
4d25cb7f47 feat(library/tactic): add simplify_tactic based on the simplifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 18:53:18 -08:00
Leonardo de Moura
ccb9faf065 refactor(*): error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-13 16:54:21 -08:00
Leonardo de Moura
915644f3b3 fix(util/debug): avoid infinite loop when Ctrl-D is pressed after an assertion violation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-12 17:20:35 -08:00
Leonardo de Moura
a339a53f50 feat(util/options): 'verbose' as a system option, add -q (quiet) option
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 15:31:58 -08:00
Leonardo de Moura
3e18cdfeec feat(util/format): do not use colors by default
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 11:56:58 -08:00
Leonardo de Moura
84e211b81b fix(frontends/lean): missing ':' in error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 11:19:58 -08:00
Leonardo de Moura
f7c7dd4ed4 feat(frontends/lean): include filename in error messages, use GNU error message style
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 11:01:27 -08:00
Leonardo de Moura
dd6c13abb0 fix(util/buffer): warning produced by clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-08 11:27:11 -08:00
Leonardo de Moura
e12d6e44cd fix(util/name): bug in Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-07 17:52:51 -08:00
Leonardo de Moura
4fdc0406be feat(util/name): additional methods to name Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-07 17:35:34 -08:00
Leonardo de Moura
248d55d454 chore(util/script_state): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-07 16:59:50 -08:00
Leonardo de Moura
95515ca5df chore(*): fix warnings produced by clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-07 15:39:49 -08:00
Leonardo de Moura
f67eab000b fix(util/serializer): nontermination on corrupted files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-07 14:21:54 -08:00
Leonardo de Moura
d633622d90 feat(frontends/lean/parser): namespaces
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 12:28:18 -08:00
Leonardo de Moura
1f6e959139 feat(deserializer): protect against corrupted binary files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 18:05:38 -08:00
Leonardo de Moura
c473a484bb feat(util/object_serializer): protect against corrupted files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 17:58:20 -08:00
Leonardo de Moura
931e196e83 fix(build): problem with reading LEAN_PATH on cygwin
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 15:12:31 -08:00
Leonardo de Moura
de77851a00 refactor(util/object_serializer): add methods write_core and read_core that allows to pack information in the byte used to indicate whether an object is already in the cache or not
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 19:59:53 -08:00
Leonardo de Moura
aee1c6d3f3 feat(kernel): export/import (.olean) binary files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 17:31:35 -08:00
Leonardo de Moura
1fd81dd3a1 feat(frontends/lean/parser): disable verbose messages when importing files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 12:24:13 -08:00
Leonardo de Moura
44a31dd8fb feat(frontends/lean/parser): improve Import command
- The extension does not have to be provided.
- It can also import Lua files.
- Hierachical names can be used instead of strings.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 12:05:01 -08:00
Leonardo de Moura
b94503ab20 chore(util/sexpr): remove unnecessary decls
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 23:24:31 -08:00
Leonardo de Moura
3715b10ce7 feat(util/sexpr/options): serialization for options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 20:40:00 -08:00
Leonardo de Moura
dbebb4a4a1 feat(util/sexpr): serialization for sexpr
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 20:19:56 -08:00
Leonardo de Moura
9c6dc5d230 feat(util/serializer): add hackish write_double/read_double
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 19:46:45 -08:00
Leonardo de Moura
abc370a011 feat(util/numerics): serialization for mpz and mpq
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 18:32:01 -08:00
Leonardo de Moura
49df0c435d feat(util/serializer): make sure the read/write is portable
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 18:07:19 -08:00
Leonardo de Moura
d05695c331 feat(util/name): serialization for hierarchical names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 17:47:20 -08:00
Leonardo de Moura
cbe0b8532a feat(util/serializer): add write_char and read_char
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 17:22:15 -08:00
Leonardo de Moura
b72937c02c feat(util/serializer): simple serialization infrastructure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 16:50:06 -08:00
Leonardo de Moura
8b6421e4de feat(util/extensible_object): add template for creating 'extensible' objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 15:40:21 -08:00
Leonardo de Moura
71a0f83143 feat(util/sexpr/format): turn off colors on Windows
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 09:54:29 -08:00
Leonardo de Moura
a9712b91a8 feat(util/lean_path): include ../library in the default LEAN_PATH
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-25 16:18:27 -08:00
Leonardo de Moura
afd10d62ca feat(util/list): improve to_list function, it takes an optional tail
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 20:56:34 -08:00
Soonho Kong
de018220e1 feat(*): use std::make_shared to create shared_ptr 2013-12-24 14:32:50 -05:00
Leonardo de Moura
bcb41cd938 fix(util/lean_path): warnings produced by Valgrind
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 10:02:48 -08:00
Leonardo de Moura
b5d23619cb feat(util/script_state): add 'import' command to Lua, it import files from the LEAN_PATH
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 21:27:12 -08:00
Leonardo de Moura
e5f53595b6 fix(util/lean_path): bug at init_lean_path (it was missing last path), and add normalization function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 19:38:32 -08:00
Leonardo de Moura
50de85ee29 fix(util/lean_path): get_exe_location for Windows
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 19:13:41 -08:00
Leonardo de Moura
cc9e16c3fc feat(util/lean_path): add function for searching for a file in the LEAN_PATH
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 18:47:49 -08:00
Leonardo de Moura
777582380f feat(util/lean_path): add support for LEAN_PATH
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 17:56:53 -08:00
Leonardo de Moura
df1b21a03d feat(util/exe_location): add function for finding the location of the executable
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 17:12:31 -08:00
Leonardo de Moura
daef2b7b24 feat(util/sexpr/options): add is_eqp predicate for options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 10:53:53 -08:00
Leonardo de Moura
47c7bb1bde refactor(*): uses aliases for unordered_map and unordered_set
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 12:30:45 -08:00
Leonardo de Moura
1e4fa76a47 feat(util/name_map): add template alias
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 11:34:40 -08:00
Leonardo de Moura
af42078205 fix(kernel): incorrect use of scoped_map
This commit also adds a new test that exposes the problem.
The scoped_map should not be used for caching values in the normalizer and type_checker. When we extend the context, the meaning of all variables is modified (we are essentially performing a lift). So, the values stored in the cache are not correct in the new context.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 15:11:39 -08:00
Leonardo de Moura
2253d8079b chore(util/pdeque): remove unused template
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 23:31:44 -08:00
Leonardo de Moura
5aa9264091 feat(util/list): add remove_last template
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 23:08:10 -08:00
Leonardo de Moura
1b1032eb99 feat(util/list): improved filter that reuses list cells
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 20:15:37 -08:00
Leonardo de Moura
2e5e5e187f chore(util/rc): remove unnecessary argument from LEAN_COPY_REF and LEAN_MOVE_REF macros
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-13 15:01:24 -08:00
Leonardo de Moura
3416df85f8 fix(util/thread): warning 'thread.cpp.o has no symbols'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-13 14:00:40 -08:00
Leonardo de Moura
450d6a4b1e refactor(util/splay_tree): replace find with splay_find
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-12 17:27:30 -08:00
Leonardo de Moura
7d184c3c4b fix(util/shared_mutex) missing pragma
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-12 16:48:34 -08:00
Leonardo de Moura
cdec9762ce chore(util/pvector): remove unused template
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 20:32:10 -08:00
Leonardo de Moura
7ab321f568 chore(util): remove dead file
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 22:32:11 -08:00
Leonardo de Moura
0cd8e3e76b feat(split-stack): add support for split-stacks (no more stackoverflows)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 22:30:54 -08:00
Leonardo de Moura
fd2a04e9ac fix(util/stackinfo): bug on Fedora
Signed-off-by: Leonardo de Moura <leonardo@nod1-2008.corp.crtest.com>
2013-12-09 18:44:14 -08:00
Leonardo de Moura
e7ae749221 feat(boost): implement multi-threading support using Boost
To use Boost instead of the standard library, we must use the cmake option
    -D BOOST=ON

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 17:24:32 -08:00
Leonardo de Moura
533ed51f51 feat(util/shared_mutex): skip shared_mutex implementation if LEAN_MULTI_THREAD is not defined
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 15:42:08 -08:00
Leonardo de Moura
8f2fe273ea refactor(*): isolate std::thread dependency
This commit allows us to build Lean without the pthread dependency.
It is also useful if we want to implement multi-threading on top of Boost.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 15:20:26 -08:00
Leonardo de Moura
0d10cba4a0 refactor(util/sexpr/format): minimize the use of recursion, combine be and layout into a single procedure (without creating a temporary potentially big sexpr)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 21:06:24 -08:00
Leonardo de Moura
25b812f1c9 feat(kernel/expr): no overhead optional<expr> template specialization
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 10:17:29 -08:00
Leonardo de Moura
3e1fd06903 refactor(kernel/expr): remove 'null' expression, and operator bool for expression
After this commit, a value of type 'expr' cannot be a reference to nullptr.
This commit also fixes several bugs due to the use of 'null' expressions.

TODO: do the same for kernel objects, sexprs, etc.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 23:21:10 -08:00
Leonardo de Moura
e2999d3ff6 feat(*): add component name to check_stack and check_system
I also reduced the stack size to 8 Mb in the tests at tests/lean and tests/lean/slow. The idea is to simulate stackoverflow conditions.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 15:11:55 -08:00
Leonardo de Moura
d949dfd46d fix(util/stackinfo): compilation warning on cygwin/mingw
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 11:32:39 -08:00
Leonardo de Moura
fa35fd6989 chore(*): make sure LEAN_THREAD_UNSAFE build flag is handled correctly
When LEAN_THREAD_UNSAFE=ON, we:

- Do not run tests at tests/lua/threads
- Disable thread object at Lua API
- par tactical becomes an alias for interleave
- Disable some unit tests that use threads

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 10:27:22 -08:00
Leonardo de Moura
1a02abf7b2 feat(util/script_state): add a lua hook function that checks for the interrupt flag
This is a very convenient feature for interrupting non-terminating user scripts.
Before this commit, the user had to manually invoke check_interrupt() in potentially expensive loops. Now, this is not needed anymore.

Remark: we still have to check whether this trick works with LuaJIT or not.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 09:57:36 -08:00
Leonardo de Moura
ef6a27fe84 feat(util/script_state): add join method to Lua threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 09:15:09 -08:00
Leonardo de Moura
def186a9cd fix(util/stackinfo): try to fix incorrect main thread stack size on OSX
This fix tries to fix two failures on our unit tests.
     tests/kernel/normalizer
     tests/kernel/type_checker

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 08:56:46 -08:00
Leonardo de Moura
fd9781d58d fix(util/stackinfo): compilation warning on mingw and cygwin
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 08:26:50 -08:00
Leonardo de Moura
f80106a895 chore(*): use 'explicit operator bool' everywhere.
operator bool() may produce unwanted conversions.
For example, we had the following bug in the code base.

...
   object const & obj = find_object(const_name(n));
   if (obj && obj.is_builtin() && obj.get_name() == n)
...

obj.get_name() has type lean::name
n              has type lean::expr

Both have 'operator bool()', then the compiler uses the operator to
convert them to Boolean, and then compare the result.
Of course, this is not our intention.

After this commit, the compiler correctly signs the error.
The correct code is

...
   object const & obj = find_object(const_name(n));
   if (obj && obj.is_builtin() && obj.get_name() == const_name(n))
...

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 23:02:45 -08:00
Leonardo de Moura
39b99683a8 fix(util/stackinfo): handle error codes in the Linux version
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 07:56:53 -08:00
Soonho Kong
31b26f53ad fix(util/stackinfo): fix typo 2013-12-02 00:03:57 -05:00
Soonho Kong
7776f4b24b fix(util/stackinfo): fix preprocessor directive 2013-12-01 23:44:58 -05:00
Soonho Kong
4de3b772fd feat(util/stackinfo): implement get_stack_size (Mac OSX version) 2013-12-01 22:24:12 -05:00
Leonardo de Moura
75f8d56eb1 fix(util/stackinfo): memory leak at get_stack_size
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 19:17:28 -08:00
Leonardo de Moura
74dfdd02de feat(util): add primitives for checking the amount of available stack space
Recursive functions that may go very deep should invoke the function check_stack. It throws an exception if the amount of stack space is limited.

The function check_system() is syntax sugar for
    check_interrupted();
    check_stack();

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 17:19:27 -08:00
Leonardo de Moura
737e634556 fix(util/list): bug in map template
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 08:51:24 -08:00
Leonardo de Moura
7ff791eb9f feat(util/name_set): add mk_unique (with respect to a name_set)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 11:28:38 -08:00
Leonardo de Moura
6da13cc245 feat(util/list): map_append template
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 11:28:38 -08:00
Leonardo de Moura
fe79bbf2b7 feat(util/list): filter template
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 11:28:38 -08:00
Leonardo de Moura
83aaf64318 fix(library/tactic): memory leaks
Proof/Cex builders and tactics implemented in Lua had a "strong reference" to script_state. If they are stored in the Lua state, then we get a cyclic reference.
That is, script_state points to these objects, and they point back to script_state.

To avoid this memory leak, this commit defines a weak reference for script_state objects. The Proof/Cex builders and tactics now store a weak reference to the Lua state.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 00:44:39 -08:00
Leonardo de Moura
2372567a6e fix(util/luaref): warnings produced by valgrind
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 00:34:38 -08:00