Commit graph

1402 commits

Author SHA1 Message Date
Leonardo de Moura
bdea42b2a9 style(lua): ignore bogus warning
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 14:13:06 -08:00
Leonardo de Moura
abe93dfec0 fix(lua/splay_tree): for_each method was crashing if the map was updated during for_each
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 13:48:23 -08:00
Leonardo de Moura
64cce595a5 feat(lua): add splay_maps to the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 13:35:36 -08:00
Leonardo de Moura
8e56726116 fix(library/expr_lt): fix bug when using hash codes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 13:18:33 -08:00
Leonardo de Moura
b0322787ff feat(lua): add has_metavar method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 10:28:50 -08:00
Leonardo de Moura
9e445d1917 feat(lua): interrupt and sleep Lua APIs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 10:04:32 -08:00
Leonardo de Moura
691893258d feat(kernel/expr): add hash code based on allocation time
The new hash code has the property that given expr_cell * c1 and expr_cell * c2,
if c1 != c2 then there is a high propbability that c1->hash_alloc() != c2->hash_alloc().

The structural hash code hash() does not have this property because we may have
c1 != c2, but c1 and c2 are structurally equal.

The new hash code is only compatible with pointer equality.
By compatible we mean, if c1 == c2, then c1->hash_alloc() == c2->hash_alloc().
This property is obvious because hash_alloc() does not have side-effects.

The test tests/lua/big.lua exposes the problem fixed by this commit.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 02:43:11 -08:00
Leonardo de Moura
ae7ea99b56 fix(lua): copy_values and add tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 21:31:27 -08:00
Leonardo de Moura
c759fc93f7 test(lua): object Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 20:59:28 -08:00
Leonardo de Moura
6e0fc0ca9b chore(build): include dl.so when compiling on Linux
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 18:44:28 -08:00
Leonardo de Moura
6964e374c0 fix(lua): luajit incompatibility
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 18:08:00 -08:00
Leonardo de Moura
cbc4254ff5 feat(lua): add occurs method to expr Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 17:10:09 -08:00
Leonardo de Moura
ad1180c5b4 fix(kernel/occurs): typos
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 17:04:56 -08:00
Leonardo de Moura
351ef867d2 feat(lua): add abstract, instantiate, has_free_vars, lift/lower free_vars to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 17:02:49 -08:00
Leonardo de Moura
ed3cf8152b feat(lua): add for_each to expr Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 16:30:59 -08:00
Leonardo de Moura
eacd60de9c feat(frontends/lean): return the operator associated with constant expressions that are names of builtin values
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 16:08:21 -08:00
Leonardo de Moura
3dea7ae0d6 test(frontends/lean): example mixing Lean and Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 16:07:15 -08:00
Leonardo de Moura
1bf6051866 test(lua): expr LUA API test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 15:29:31 -08:00
Leonardo de Moura
9a22702383 feat(lua): make objects() and localobjects() methods return iterators in the environment LUA API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 14:26:01 -08:00
Leonardo de Moura
8c52d47692 chore(lua): rename env() to get_env()
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 13:58:51 -08:00
Leonardo de Moura
ba0889265e refactor(lua): cleanup Lua bindings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 13:55:05 -08:00
Leonardo de Moura
b5f0185729 fix(lua): replace lua_pushfstring with lua_pushstring
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 12:14:55 -08:00
Leonardo de Moura
a80adae1c3 feat(lua): add fields method to sexpr Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 12:10:24 -08:00
Leonardo de Moura
e2efce6b62 style(util/sexpr): name convetion for enumeration types
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 11:50:12 -08:00
Leonardo de Moura
450128e28b refactor(lua): cleanup Lua bindings, and add accessor/tester to expr Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 11:46:09 -08:00
Leonardo de Moura
c4c548dc5d feat(*): simplify interrupt propagation
Instead of having m_interrupted flags in several components. We use a thread_local global variable.
The new approach is much simpler to get right since there is no risk of "forgetting" to propagate
the set_interrupt method to sub-components.

The plan is to support set_interrupt methods and m_interrupted flags only in tactic objects.
We need to support them in tactics and tacticals because we want to implement combinators/tacticals such as (try_for T M) that fails if tactic T does not finish in M ms.
For example, consider the tactic:

    try-for (T1 ORELSE T2) 5

It tries the tactic (T1 ORELSE T2) for 5ms.
Thus, if T1 does not finish after 5ms an interrupt request is sent, and T1 is interrupted.
Now, if you do not have a m_interrupted flag marking each tactic, the ORELSE combinator will try T2.
The set_interrupt method for ORELSE tactical should turn on the m_interrupted flag.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 21:45:48 -08:00
Leonardo de Moura
b31233e8c2 feat(util/interrupt): restore interrupt module
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 21:16:10 -08:00
Soonho Kong
e1047c4ebb chore(travis): fix .travis.osx.yml 2013-11-12 23:15:03 -05:00
Leonardo de Moura
126c45626c chore(memcheck.supp): add suppressions for LuaJIT bugs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 18:52:03 -08:00
Leonardo de Moura
e96fe9b6e6 chore(build): exclude leanslowtests from OSX debug regression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 18:48:19 -08:00
Leonardo de Moura
be093ecf90 feat(lua): use formatter available in the state object to convert Lean objects into strings in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 16:56:30 -08:00
Leonardo de Moura
9a5f86fce6 feat(lua): use (** ... **) instead of {{ ... }} for nested Lua scripts
The token }} is a bad delimiter for blocks of Lua script code nested in Lean files.
The problem is that the sequence }} occurs very often in Lua code because Lua uses { and } to build tables/lists/arrays.
Here is an example of Lua code that contains the sequence }}
     t = {{1, 2}, {2, 3}, {3, 4}}

In Lean, (* ... *) is used to create comments. Thus, (** ... **) code blocks will not affect
valid Lean files. It also looks reasonably good.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 16:05:49 -08:00
Leonardo de Moura
8190d4fed5 feat(lua): allow Lua scripts to update 'global' options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 15:38:00 -08:00
Leonardo de Moura
0a6f622aec chore(build): remove CheckLuaObjlen, it is easier to check the Lua version
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 12:58:22 -08:00
Leonardo de Moura
b986af09ed feat(lua): add support for copying closures between Lua states
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 12:54:34 -08:00
Leonardo de Moura
c46edcf370 feat(lua): expose formatter in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 11:19:15 -08:00
Leonardo de Moura
2af2a69fc6 feat(lua): expose kernel objects in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 09:40:29 -08:00
Leonardo de Moura
d257156b88 fix(lua): memory leaks, we should not use luaL_error because it does not unwind C++ stack
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 21:45:13 -08:00
Leonardo de Moura
a30e02d862 fix(lua): redefine Lua 'print' function, and make sure it is thread safe
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 21:15:21 -08:00
Leonardo de Moura
eb9d0f0552 test(lua): add example showing how to access/update an environment object using multiple threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:53:23 -08:00
Leonardo de Moura
0af8f17834 feat(lua): allow Booleans to be copied between Lua states
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:39:46 -08:00
Leonardo de Moura
7cb15cdac5 feat(lua): allow environment object references to be moved between Lua states
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:32:36 -08:00
Leonardo de Moura
ac6c18321a fix(lua): make sure environment objects can be safely accessed/updated from current threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:29:53 -08:00
Leonardo de Moura
596e4aeb57 feat(util/shared_mutex): add shared_mutex object, this is a temporary replacement for std::shared_mutex that will be available in C++11
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:00:21 -08:00
Leonardo de Moura
2ac594a159 test(lua): add a new example showing how to create nested State objects and threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 18:27:09 -08:00
Leonardo de Moura
cc7b5b7e50 fix(lua): disable custom allocation for Lua, it is crashing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 18:20:52 -08:00
Leonardo de Moura
7d49df3985 style(lua): fix cpplint.py warnings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 17:46:39 -08:00
Soonho Kong
d4e515f38e doc(README.md): "Code coverage" => "Coverage" to fit in one line
[skip ci]
2013-11-11 20:42:15 -05:00
Soonho Kong
2bdc8d0370 doc(README.md): use horizontal layout for the badges
simplified the title (i.e. from Ubuntu 12.04 LTS => Ubuntu), however, the detailed information are still accessible by positioning mouse over the icons.

[skip ci]
2013-11-11 20:40:32 -05:00
Soonho Kong
ed4526a4f0 doc(coding_style.md): add section about git pre-push hook
[skip ci]
2013-11-11 20:18:38 -05:00