Soonho Kong
7c0b56ad0d
feat(library/rewriter): implement repeat/app/lambda/pi/try rewriter
...
- refactor to use rewriter_cell
- implement display and operator<< for debugging
2013-10-01 00:30:31 -07:00
Soonho Kong
e6c76fbe76
refactor(library/rewriter/fo_match): add more lean_trace for debugging
2013-10-01 00:20:12 -07:00
Soonho Kong
a832173f5f
feat(kernel/expr): add expr::operator() which takes 8 args
2013-10-01 00:19:30 -07:00
Soonho Kong
1a3ea26032
feat(util/list_fn): add iter function
2013-10-01 00:18:55 -07:00
Leonardo de Moura
15979ab991
fix(lean): fix warnings produced by cppcheck
...
Fix (relevant) warnings produced by http://cppcheck.sourceforge.net .
Most warnings produced were incorrect. The tool does not seem to support some of the C++11 new features.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-30 21:38:55 -07:00
Leonardo de Moura
30089aa4f8
test(type_checker): add example showing how to use the kernel exception formatter
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-30 16:39:29 -07:00
Soonho Kong
54f4c4d9bc
test(library/rewriter/fo_match): clean up enable_trace
2013-09-29 18:36:01 -07:00
Leonardo de Moura
8d3ae665e7
fix(splay_map): fix typo
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-29 17:30:08 -07:00
Leonardo de Moura
21f9699661
test(splay_tree): add missing test
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-29 17:28:10 -07:00
Leonardo de Moura
790c2a72d5
test(safe_arith): add unit tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-29 17:20:32 -07:00
Leonardo de Moura
1179b6b52b
test(hash): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-29 17:20:32 -07:00
Leonardo de Moura
57b6148bbb
test(buffer): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-29 17:20:32 -07:00
Leonardo de Moura
02f621aa45
test(lazy_list): add more tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-29 14:38:35 -07:00
Leonardo de Moura
3c8dff9085
feat(lazy_list): implement ML-like lazy lists
...
We will use lazy lists to represent the set of solutions produced by the elaborator. The elaborator plugins will also use lazy lists.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-29 12:35:26 -07:00
Soonho Kong
841a1fb20c
fix(debug): print type in lean_assert, print bool correctly
...
- use typeinfo to print out a type of value when an assertion fails.
need to use "c++filt --types" to demangle names for non-basic types.
- use std::boolalpha and std::noboolalpha to control the printed values
for "true" and "false"
2013-09-28 23:38:21 -07:00
Soonho Kong
4602dfd209
test(util/numerics): more tests to improve coverage
2013-09-28 23:38:17 -07:00
Soonho Kong
fb3635a9ef
test(util/numerics/mpbp): add more tests for improving coverage
2013-09-28 01:01:52 -07:00
Soonho Kong
6519d4bb0f
chore(memcheck.supp): generalize TCmalloc_Bug2 pattern
...
to suppress a warning from MSR 32bit build
[skip-ci]
2013-09-27 19:16:02 -07:00
Soonho Kong
0065d69e0a
chore(build): put --coverage CXX_FLAGS for TESTCOV build
2013-09-27 10:24:31 -07:00
Leonardo de Moura
d2667d56c0
test(lean/parser): add more tests for improving coverage
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-27 09:59:50 -07:00
Leonardo de Moura
0ff69d28f3
test(lean/scanner): add more tests for improving coverage
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-27 09:59:50 -07:00
Leonardo de Moura
6fc177056e
refactor(tests/frontends/lean): use consistent name convention for file names
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-27 09:59:50 -07:00
Soonho Kong
6a0d211d54
test(fo_match): add more unittests
...
[skip ci]
2013-09-27 01:53:42 -07:00
Soonho Kong
285495313b
refactor(rewrite): use scoped_map as a type of substitution
2013-09-27 01:45:22 -07:00
Soonho Kong
1d4a1b68f5
refactor(fo_match): use scoped_map
2013-09-27 01:44:05 -07:00
Soonho Kong
6307beedc9
feat(scoped_map): add operator<< to scoped_map for debugging
2013-09-27 01:42:11 -07:00
Soonho Kong
a05b6b476e
fix(testcov): install lcov and include testcov only when it's on
2013-09-26 22:24:24 -07:00
Soonho Kong
6abb7bf2ff
chore(testcov): add missing CodeCoverage.cmake
2013-09-26 21:26:52 -07:00
Soonho Kong
3a5a565594
feat(splay_map): add operator<< to splay_map for debugging
2013-09-26 20:44:20 -07:00
Soonho Kong
5e5087b0a3
chore(testcov): add compile target "cov" to run code-coverage locally
...
- need to run cmake with "-DTESTCOV=ON" and "-DCMAKE_BUILD_TYPE=Debug"
- type "make/ninja cov"
- open "coverage/index.html" to check the code coverage
2013-09-26 20:28:52 -07:00
Leonardo de Moura
9d8ff0eadb
test(mpz): add unit tests for mpz
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 20:01:39 -07:00
Leonardo de Moura
5cce74d116
test(library): add tests for improving coverage
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 19:43:10 -07:00
Soonho Kong
60157aa92a
fix(splay_map): add 'const' to coersion operator of ref class
...
[skip ci]
2013-09-26 19:09:37 -07:00
Leonardo de Moura
54e63fd4de
feat(splay_tree): add fold and for_each templates for splay_tree and splay_map
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 18:18:20 -07:00
Leonardo de Moura
1aca1d2d77
refactor(list): improve append function
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 18:18:20 -07:00
Leonardo de Moura
24c173a519
feat(debug): add assert_ne (not equal) macro
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 18:18:20 -07:00
Leonardo de Moura
d7ed1560a9
feat(name_generator): add name_generator for unique names modulo a prefix
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 18:18:06 -07:00
Leonardo de Moura
e5d312dc18
fix(kernel): the hash code of expressions was not being used to compare them
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 08:41:20 -07:00
Leonardo de Moura
19f4554145
test(exception): add tests for improving coverage
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 08:35:13 -07:00
Leonardo de Moura
a24dbc3527
test(buffer): add tests for improving coverage
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 08:35:13 -07:00
Soonho Kong
bc31322a78
chore(memcheck): add another memcheck.supp entry for tcmalloc bug
...
suppress a valgrind warning we had on "normalizer" testcase (only with g++-4.8.1)
2013-09-26 00:49:43 -07:00
Soonho Kong
a2a5a77a44
fix(memory): increase memory counters by the actual size of reallocated memory
...
On OSX, we had a test failure on memory module. The problem was in
the realloc function (line 38):
void * realloc(void * ptr, size_t sz) {
size_t old_sz = malloc_size(ptr);
g_global_memory.dec(old_sz);
g_global_memory.inc(sz);
g_thread_memory.dec(old_sz);
g_thread_memory.inc(sz);
void * r = realloc_core(ptr, sz);
if (r || sz == 0)
return r;
else
...
The size of r could be bigger than sz. For instance,
|ptr| = 40 but |r| = 48
In the current code, here we only increase counters by 40.
But later when we free it, we decrease them by 48, and this
caused the problem, underflow of an unsigned counter in
g_global_memory.
2013-09-26 00:33:56 -07:00
Leonardo de Moura
4bae715350
fix(memory): disable problematic test when tcmalloc is used
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 22:39:49 -07:00
Leonardo de Moura
c00534209a
test(splay_map): add tests for improving code coverage
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 22:12:49 -07:00
Leonardo de Moura
98b4e09063
refactor(kernel): simplify expr_eq
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 22:09:08 -07:00
Leonardo de Moura
23e2f72f42
test(list): add tests for improving code coverage
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 22:04:24 -07:00
Leonardo de Moura
db4e5ab0ad
feat(expr_lt): improve expr_lt performance by using hash codes, and add more tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 21:59:58 -07:00
Leonardo de Moura
6477708d78
refactor(debug): improve lean_unreachable(), now we can avoid 'fake' return statements
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 21:27:20 -07:00
Leonardo de Moura
a7707dd669
test(bit_tricks): add tests for log2
2013-09-25 20:58:01 -07:00
Leonardo de Moura
44a16cab6a
test(exception): add new tests exception and parser_exception
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 20:57:53 -07:00
Leonardo de Moura
87e749cd12
test(trace): add unit test for trace module
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 20:30:05 -07:00
Leonardo de Moura
e16f45854b
refactor(deep_copy): simplify deep_copy implementation, and move unit test to separate file
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 20:25:24 -07:00
Leonardo de Moura
037ebfd1d4
refactor(util): make 'util/test.h' the first include
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 20:13:05 -07:00
Soonho Kong
ad62f9762b
fix(tests/util): use lean_assert_eq
2013-09-25 19:22:36 -07:00
Soonho Kong
475338080f
fix(tests/interval): use new lean_assert and lean_assert_eq
2013-09-25 18:40:45 -07:00
Leonardo de Moura
9f0dab1add
fix(kernel): add declarations for operator<<(std::ostream&, expr const&) and operator<<(std::ostream&, context const&) in the kernel
...
The actual implementation of these two operators is outside of the
kernel. They are implemented in the file 'library/printer.cpp'.
We declare them in the kernel to prevent the following problem.
Suppose there is a file 'foo.cpp' that does not include
'library/printer.h', but contains
expr a;
...
std::cout << a << "\n";
...
The compiler does not generate an error message. It silently uses the
operator bool() to coerce the expression into a Boolean. This produces
counter-intuitive behavior, and may confuse developers.
2013-09-25 17:45:54 -07:00
Leonardo de Moura
1452e9319e
feat(debug): improve lean_assert macro
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 17:29:00 -07:00
Soonho Kong
1d8b7dc193
Update 'orelse' and 'then' rewriter to take a list of rewriters
2013-09-25 16:46:39 -07:00
Soonho Kong
a50f5f92b8
Rename 'rewrite' to 'Rewriter', change type of rewriter::operator()
2013-09-25 15:38:16 -07:00
Soonho Kong
573ca92a08
Fix typo in CTestConfig.cmake
2013-09-24 21:46:51 -07:00
Soonho Kong
6d10e978dc
Add "--gen-suppressions=all" to valgrind option
2013-09-24 21:36:03 -07:00
Soonho Kong
0ef633a3c5
Fix to be compiled by clang++-3.4
...
Clang++-3.4 is starting to enforce the following item of C++11 standard,
thus it's making lean not compiling:
It's illegal in C++11: §8.3.6.4 [dcl.fct.default]
"If a friend declaration specifies a default argument expression, that
declaration shall be a definition and shall be the only declaration of
the function or function template in the translation unit."
2013-09-24 21:30:56 -07:00
Soonho Kong
8e9bd9ee67
Add Repeat/Success/Fail to rewrite (skeleton)
2013-09-24 20:04:08 -07:00
Soonho Kong
ac0eafa1b6
Fix style-warning
2013-09-24 19:34:58 -07:00
Soonho Kong
57e9e2c658
Re-implement rewrite module using rewrite_cell
2013-09-24 19:11:09 -07:00
Leonardo de Moura
ba0528c298
Implement total order on expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-24 12:16:32 -07:00
Leonardo de Moura
e23813f15d
Add support for creating unique internal names.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-24 11:01:30 -07:00
Leonardo de Moura
1779b29355
Implement map using splay_trees
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-24 01:44:46 -07:00
Soonho Kong
71fb150333
Fix type of rewrite() to take an env. Add skeletons for other rewriters
2013-09-24 01:20:45 -07:00
Soonho Kong
81c9de229b
Add then and orelse rewrite combinators and tests
2013-09-24 01:19:03 -07:00
Soonho Kong
9ba6068858
Update fo_match
2013-09-24 01:19:03 -07:00
Soonho Kong
f89ededddc
Add rewrite and first-order pattern matching skeletal
2013-09-24 01:19:03 -07:00
Leonardo de Moura
b78b2e0585
Add remaining splay tree methods
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-24 01:04:02 -07:00
Soonho Kong
01f5fa59b1
Update src/memcheck.supp to suppress warnings caused by tcmalloc
2013-09-24 03:58:13 -04:00
Leonardo de Moura
d31f3facac
Implement splay trees
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-23 22:31:18 -07:00
Soonho Kong
c1b12eae99
Update memcheck.supp to suppress a valgrind warning caused by a bug in tcmalloc-2.0
2013-09-23 19:57:16 -07:00
Leonardo de Moura
46d6c41835
Fix bug in the type checker (when type checking terms with meta-variables).
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-22 19:12:19 -07:00
Leonardo de Moura
1647e44510
Fix memory corruption bug
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-22 18:53:58 -07:00
Leonardo de Moura
16a6a54df1
Fix abuse of operator-> overload
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-22 16:41:51 -07:00
Leonardo de Moura
c847d27763
Improve higher order unification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-21 00:41:49 -07:00
Soonho Kong
80581a76bb
Update Find{MSize,MallocSize,MallocUsableSize}.cmake to handle the case where find_path fails
2013-09-21 00:10:25 -07:00
Soonho Kong
48318511f2
Undo the previous change which caused compile-errors
2013-09-21 00:04:23 -07:00
Soonho Kong
66ba1a20d7
Suppress cmake warning for OSX build
2013-09-20 23:49:09 -07:00
Leonardo de Moura
d29ec9ab6f
Add tests for memory.cpp
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-20 22:37:13 -07:00
Leonardo de Moura
7ac94ee976
Add max_sharing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-20 22:01:40 -07:00
Leonardo de Moura
d34cfe3f8a
Add simple formatter tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-20 21:46:32 -07:00
Soonho Kong
bef44899c8
Suppress style warning on util/memory.cpp
2013-09-20 18:07:12 -07:00
Soonho Kong
9226c46358
Add support OSX's malloc_size
2013-09-20 17:48:55 -07:00
Soonho Kong
8dc31dae4d
Fix Check{MSize,MallocUsableSize}.cc and FindMSize.cmake to consider cross-compilation
2013-09-20 16:10:00 -07:00
Leonardo de Moura
3971265bcb
Add support for _msize
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-20 14:14:57 -07:00
Leonardo de Moura
dae654e4c6
Track memory usage. Add new CMake option TRACK_MEMORY_USAGE (It is ON by default).
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-20 12:32:12 -07:00
Leonardo de Moura
9d1266c972
Fix bugs in Tcmalloc detection.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 23:52:50 -07:00
Leonardo de Moura
a7a5426ff5
Fix wrong message in tcmalloc detection code
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 23:36:57 -07:00
Leonardo de Moura
16dc056abc
Remove invalid use of register
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 22:59:39 -07:00
Soonho Kong
49e87ccbb1
Enable "-Wextra" compiler option and fix code to remove warnings
...
"-Wextra" option turns on the following warnings:
-Wclobbered
-Wempty-body
-Wignored-qualifiers
-Wmissing-field-initializers
-Wmissing-parameter-type (C only)
-Wold-style-declaration (C only)
-Woverride-init
-Wsign-compare
-Wtype-limits
-Wuninitialized
-Wunused-parameter (only with -Wunused or -Wall)
-Wunused-but-set-parameter (only with -Wunused or -Wall)
2013-09-19 22:52:52 -07:00
Leonardo de Moura
651c5d6751
Fix warnings and bugs related to unused variables.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 22:41:07 -07:00
Soonho Kong
2b72c5f681
Update cpplint.py, disable "All parameters should be named in a function"
2013-09-19 22:41:07 -07:00
Soonho Kong
ab6ca82e6f
Update to suppress unused-parameter warnings
2013-09-19 22:40:34 -07:00
Leonardo de Moura
80a1b96925
Remove duplicate solutions in the higher order matching module. Simplify solutions when higher-order matching is used, and we don't have a residue.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 18:59:28 -07:00
Leonardo de Moura
ffef055e34
Add options to ho_unifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 18:19:25 -07:00