Commit graph

118 commits

Author SHA1 Message Date
Leonardo de Moura
56215b36e8 fix(*): [[fallthrough]] ==> /* fall-thru */
Older gcc compilers generate a warning when the attribute is used.
I found out that GCC 7 will not produce a warning if comments
such as /* fall-thru */ or /* FALLTHRU */ are used instead of the
attribute [[fallthrough]]
2017-05-31 21:18:47 -07:00
Leonardo de Moura
ac17270894 fix(*): more gcc 7 warnings 2017-05-31 17:29:30 -07:00
Gabriel Ebner
7353a54aac fix(library/vm/vm): prevent segfault 2017-05-18 09:41:31 -07:00
Gabriel Ebner
9424e6fa24 refactor(frontends/lean/definition_cmds): make profiling threshold configurable 2017-04-23 11:22:41 -07:00
Leonardo de Moura
470f2bc547 feat(library/compiler, library/vm): remove additional irrelevant information 2017-04-16 12:46:14 -07:00
Gabriel Ebner
fa19b3c94d fix(library/vm/vm): prevent segfault in out-of-memory conditions 2017-03-23 09:00:59 +01:00
Sebastian Ullrich
5d68938a9c feat(frontends/lean): expr literals ```(...) 2017-03-05 08:37:16 -08:00
Sebastian Ullrich
44b27a9a44 chore(library/vm/vm): fix comment 2017-02-23 01:52:13 +01:00
Leonardo de Moura
3f87fd15eb feat(library/vm): add liveness analysis, and support destructive updates for lean arrays 2017-02-21 15:09:37 -08:00
Leonardo de Moura
87eaedc580 feat(library/vm): shrink VM stack eagerly
TODO: liveness analysis objects on the VM stack
2017-02-20 23:10:50 -08:00
Johannes Hölzl
3db0ebdcf0 feat(library/tactic/match_tactic): return also assignments for universe meta-variables 2017-02-17 20:08:09 -08:00
Leonardo de Moura
7886a78967 fix(library/vm/vm): incorrect lean_vm_check 2017-02-16 11:39:23 -08:00
Leonardo de Moura
bff3e44656 fix(library/vm/vm): compilation error when multi threading is disabled 2017-02-15 22:50:44 -08:00
Leonardo de Moura
245b4be315 fix(library/vm/vm): compilation warning 2017-02-15 20:32:22 -08:00
Leonardo de Moura
c5287237ee fix(library/vm): race condition in the profiler initialization code 2017-02-15 15:35:41 -08:00
Gabriel Ebner
cbebedb53b feat(library/vm/vm): improve vm check error message 2017-02-15 13:39:10 -08:00
Gabriel Ebner
93d00534e0 fix(library/vm): enable bounds checks 2017-02-15 13:39:00 -08:00
Leonardo de Moura
4d765fa25b fix(library/vm): profiler was not including builtin functions 2017-02-13 16:12:25 -08:00
Leonardo de Moura
1306e56381 feat(library/vm): check heartbeat in function calls 2017-02-12 12:29:32 -08:00
Leonardo de Moura
7112f6d685 feat(library/tactic): add try_for tactic 2017-02-11 20:35:42 -08:00
Leonardo de Moura
7a58da1181 fix(library/tactic/user_attribute): nasty interaction between eval_expr and attribute_manager
eval_expr creates auxiliary definitions in the VM. These auxiliary
definitions are gone after the VM finishes.

We store vm_obj's in the attribute_manager.

Before this commit, Lean was crashing in the following scenario:

1- A new caching_user_attribute is defined, and the user data structure
contains closures.

2- The closures are created using eval_expr.

3- When reusing the cached values, the system crashes when trying
to apply a closure created using eval_expr. The closure points to
an auxiliary definition that has already been deleted.

The new test exposes the problem. This is not a hypothetical scenario,
the new test is based on the Lean - Mathematica integration being
developed by @rlewis1988.

The fix consists in making sure we do not cache anything if
the VM environment has been updated by eval_expr.

I believe this is acceptable behavior. eval_expr is a very low level
tactic, and I don't see a good motivation for invoking it when
constructing the cache.

BTW, the test can be relaxed if the vm_attr does not contain closures.
However, it doesn't seem to pay off.

Another potential fix would be to propagate the definitions created
by eval_expr to the main environment. However, I think this is not
acceptable.
We will be flooding the main environment with useless temporary definitions
created by `eval_expr`.

This commit also stores the environment at caching time, and make
sure the cache is only reused if the current environment is a descendant
of the the one at caching time. This is fixing a different potential
bug.
2017-02-10 15:24:01 -08:00
Gabriel Ebner
94565113a6 chore(checker): remove gmp, mpfr, and dl library dependencies 2017-01-31 09:39:31 +01:00
Gabriel Ebner
952f444710 feat(init/meta/task): allow task creation from VM 2017-01-28 08:27:23 +01:00
Leonardo de Moura
6f502b9afd fix(library/vm): make sure vm_rb_map objects can be stored in ts_vm_obj
See discussion at #1337
2017-01-26 15:58:11 -08:00
Leonardo de Moura
4e625b35ad fix(library/vm/vm): memory leak at operator= 2017-01-26 13:32:44 -08:00
Leonardo de Moura
7a6b9e193c feat(library/vm, frontends/lean/info_manager): add thread safe vm_obj wrapper, and use it to store arbitrary vm thunks in the info_manager 2017-01-21 22:38:33 -08:00
Leonardo de Moura
3967cd28fa fix(library/vm/vm): curr_fn() may not be available 2017-01-12 11:47:45 -08:00
Leonardo de Moura
ff455d3ec9 chore(library/vm/vm): warning 2017-01-06 21:22:27 -08:00
Leonardo de Moura
de8ba72a86 feat(library/vm/vm): suppress snapshots when printing profiling information 2017-01-06 19:22:07 -08:00
Leonardo de Moura
94e6fbcbbf perf(library/vm/vm): make sure builtin cases_on recursors are assigned ids first
This will minimize the size of the m_builtin_cases_vector.
It also indirectly prevents the crash decribed at 144d9096e2.
However, the fix used there is more robust.
2016-12-22 18:46:51 -08:00
Leonardo de Moura
144d9096e2 fix(library/vm/vm): serialization/deserialization of builtin cases_on instruction
We generate internal ids for builtin cases_on recursors.
These ids were being saved in the .olean files.
This was fine before commit 41e8a1712e because we had a separate
mapping for builtin cases_on recursors. Now, all ids are stored in the
same mapping. Thus, minor changes in the set of VM builtin operations
make lean crash when importing .olean files because they will change the
internal id for the builtin cases_on.
The problem can be reproduced in the following way:

0- Go to build/release

1- make clean-olean

2- make
Everything is fine after step 2

3- Comment the following line at tactic_state.cpp

    DECLARE_VM_BUILTIN(name({"tactic", "open_namespaces"}),      tactic_open_namespaces);

4- make

5- Lean will crash when executing the following command

   ../../bin/lean ../../library/init/meta/tactic.lean

I believe this bug is reponsible by the crash that @jroesch reported on Slack.

This commit fixes the problem by storing the name of the builtin
cases_on recursor in the .olean file.
2016-12-22 18:35:30 -08:00
Leonardo de Moura
e5c4231248 fix(library/vm/vm): bug at vm_index_manager?
@gebner, I have been experiencing crashes that are hard to reproduce.
I think one of the problems was that get_vm_name was returning a `name const &`.
I think this may produce a memory access violation in the following
scenario:

1- Thread 1 invokes get_vm_name, and gets a reference R. This is a
   reference to a memory cell in the vector m_idx2name.
2- Thread 2 invokes get_vm_index, and it triggers a vector resize
   operation. After the resize, reference R is invalid.
3- Thread 1 crashes trying to access R.
2016-12-22 18:19:33 -08:00
Leonardo de Moura
5f72e37501 chore(library/vm): fix warning 2016-12-20 10:19:20 -08:00
Gabriel Ebner
a26e2c9108 feat(library/module): intermediary data structure for environment modifications 2016-12-20 10:15:19 -08:00
Gabriel Ebner
41e8a1712e refactor(library/vm): use global indices for declarations and cases 2016-12-20 10:13:58 -08:00
Leonardo de Moura
e248577e1c feat(library/vm): allow vm bytecode to invoke native closures 2016-12-14 19:16:55 -08:00
Leonardo de Moura
b0ce461fcd feat(library/vm): native closures that do not depend on vm_state
Remark: native_closures are used in the C++ code generator.
2016-12-14 18:51:24 -08:00
Leonardo de Moura
fe3396e1ae perf(library/vm/vm): cache the result of 0-ary vm_decls 2016-12-12 09:12:06 -08:00
Leonardo de Moura
e59515df5f chore(*): fix style 2016-12-05 16:39:58 -08:00
Jared Roesch
e65d90ac79 feat(*): C++ code generator
in progress move of Lean.native to init
2016-12-05 16:11:41 -08:00
Gabriel Ebner
7db2b8d014 fix(library/vm/vm): do not segfault in single-threaded builds 2016-12-02 16:51:10 -08:00
Gabriel Ebner
a8df381d20 feat(*): parallel compilation 2016-11-29 11:12:40 -08:00
Leonardo de Moura
31e159b80c fix(library/vm/vm): bug at add_native 2016-11-21 16:58:22 -08:00
Leonardo de Moura
91c8ff746f feat(cli_debugger): add commands for traversing stack frames 2016-11-16 12:37:18 -08:00
Leonardo de Moura
3628870121 feat(library/tactic/vm_monitor): extend VM introspection API 2016-11-15 15:05:46 -08:00
Leonardo de Moura
fffe69fdf9 feat(library/vm,library/tactic/vm_monitor): use optionT to define vm monad 2016-11-14 16:13:56 -08:00
Leonardo de Moura
7232e3a076 feat(library/vm/vm): invoke debugger (aka vm_monitor) 2016-11-14 14:45:49 -08:00
Leonardo de Moura
a7344671e1 feat(library/vm/vm): add stack_info 2016-11-13 12:20:02 -08:00
Leonardo de Moura
381b2edaf7 feat(library/vm/vm): store .olean file name at vm_decl's 2016-11-11 16:19:19 -08:00
Leonardo de Moura
e673fa65ba feat(library/vm/vm): Store position information at vm_decl's 2016-11-11 15:39:32 -08:00