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
Leonardo de Moura
8c5c17ee12
Fix typo
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 16:30:37 -07:00
Leonardo de Moura
42482622f6
Add imitation for lambdas and Pis
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 16:28:23 -07:00
Leonardo de Moura
4afeb1a400
Add imitation step for equalities.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 16:28:23 -07:00
Leonardo de Moura
b3aa8b37f3
Remove cleanup_subst. The residue may still reference auxiliary variable. So, it is not safe to remove then from the resultant partial substitution.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 16:28:23 -07:00
Leonardo de Moura
d7cc5d2404
Fix bug in ho_unifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 16:28:23 -07:00
Soonho Kong
0005d22bd1
Update memcheck.supp, add a new suppression rule for 32bit ubuntu
...
[skip ci]
2013-09-19 11:46:47 -07:00
Leonardo de Moura
2f29ff70d7
Implement higher-order unification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-18 20:46:00 -07:00
Leonardo de Moura
ad901ce087
Use consistent naming conventions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 14:43:07 -07:00
Leonardo de Moura
22949051f1
Higher-order unifier skeleton
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 14:43:07 -07:00
Soonho Kong
27d5ae13d7
Move src/interval to src/util/interval
2013-09-17 14:10:53 -07:00
Leonardo de Moura
df054477eb
Remove unnecessary TODOs.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 13:33:52 -07:00
Leonardo de Moura
3df6149daa
Add support for metavariables in the type checker.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 11:09:59 -07:00
Leonardo de Moura
9f9dcf9a29
Fix bug in the creation of children environments. Remove unnecessary function.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 07:37:33 -07:00
Leonardo de Moura
30b19c314a
Add basic support for metavariables at is_convertible. Swap is_convertible arguments to make it more intuitive.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 07:15:47 -07:00
Leonardo de Moura
a26c7d47f2
Add simplification to add_lift
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 03:14:02 -07:00
Leonardo de Moura
99e8d2feae
Add simplification rule to add_inst
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 02:57:28 -07:00
Leonardo de Moura
21c7a45f67
Relax definition of identity_stack. Fix printer for metavariable contexts.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 02:09:45 -07:00
Leonardo de Moura
d3bce584f4
Add support for new metavariable representation in the normalizer.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 01:57:21 -07:00
Leonardo de Moura
da09e7217a
Cleanup meta_entry code
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
99a163f11d
Simplify metavariable context. Now, we have only 'lift' and 'inst' instead of 'subst', 'lift' and 'lower'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
cad562a448
Add support for metavariables in the normalizer.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
1be2a30c8c
Fix bug in normalizer. We must create a scope whenever we extend the value stack.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Soonho Kong
01339a93a3
Fix cpplint warning in util/safe_arith.cpp
2013-09-16 19:12:12 -07:00