Commit graph

195 commits

Author SHA1 Message Date
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
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
6307beedc9 feat(scoped_map): add operator<< to scoped_map for debugging 2013-09-27 01:42:11 -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
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
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
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
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
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
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
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
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
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
Leonardo de Moura
d31f3facac Implement splay trees
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-23 22:31:18 -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
d29ec9ab6f Add tests for memory.cpp
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-20 22:37:13 -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
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
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
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
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
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
Soonho Kong
13401d534c Add static assertion to util/safe_arith.cpp 2013-09-16 18:17:05 -07:00
Leonardo de Moura
63e102055e Move metavariables to the kernel. This is the first step for implementing the new elaborator.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-15 12:09:01 -07:00
Soonho Kong
dcc917a6b4 Use "sprintf" instead of "snprintf" because cygwin doesn't support "snprintf" 2013-09-15 01:38:21 -07:00
Soonho Kong
60903d3cea Fix cygwin build which was failed due to snprintf 2013-09-14 17:11:37 -07:00
Soonho Kong
bc60b47295 Apply coding style 2013-09-13 18:48:09 -07:00
Leonardo de Moura
bcc3827a99 Modify Doxygen file to extract all elements even the undocumented ones. Disable warnings for undocumented entities. Add extra comments.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 13:46:22 -07:00
Leonardo de Moura
8c735f1daa Use consistent coding style for spaces after ','
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 12:49:03 -07:00
Soonho Kong
5c3866cd71 Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
Leonardo de Moura
26097475fd Use fullpath in #include directives.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 20:04:10 -07:00
Leonardo de Moura
c655e9fe7b Move sexpr_funcs to sexpr_fn. Using consistent file name conventions.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 18:27:46 -07:00
Leonardo de Moura
bc69e7803f Add support for writing a[i] = v instead of a.set(i, v) in the pdeque class.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 11:18:26 -07:00
Leonardo de Moura
74b8a4f0ac Add support for writing a[i] = v instead of a.set(i, v) in the pvector class.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 11:12:02 -07:00
Leonardo de Moura
f972cc9aae Fix bugs in pvector. Improve test driver
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 11:01:40 -07:00
Leonardo de Moura
55ff49d2d5 Replace queue.h with pdeque.h
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 10:09:54 -07:00