Commit graph

867 commits

Author SHA1 Message Date
Nuno Lopes
1a9962011d chore(style): fix cast style 2018-02-13 10:42:08 -08:00
Nuno Lopes
7b45d28e77 chore(unicode): use utf8 chars directly in strings 2018-02-13 10:42:08 -08:00
Nuno Lopes
977e11f9be fix(warnings): fix warnings on VS. its now /W2 clean 2018-02-13 10:42:08 -08:00
Nuno Lopes
5cee9f8279 fix(crash) due to calling isalpha/isalnum with signed char in is_id_first() and is_id_rest() 2018-02-06 10:11:10 -08:00
Nuno Lopes
1e03151412 fix(msvc): compiler warning 2018-02-06 10:11:10 -08:00
Nuno Lopes
a69541ab67 fix(msvc): crashes in getopt and read_dir 2018-02-06 10:11:10 -08:00
Nuno Lopes
a8021c2176 fix(msvc): bugfix for LEAN_DISPLAY macros
tested with gcc, clang, and MSVC 15
2018-02-06 10:11:10 -08:00
Nuno Lopes
caab1c58d2 fix(build): style 2018-02-06 10:11:10 -08:00
Nuno Lopes
b984079449 fix(build): tentatively fix msys buildbot 2018-02-06 10:11:10 -08:00
Nuno Lopes
ac6a16ddba feat(msvc): further work on MSVC compatibility 2018-02-06 10:11:09 -08:00
Nuno Lopes
59b5a4a07a feat(build): add preliminary MSVC support
Still doesn't build fully, but at least Intellisense sort of works now
2018-02-06 10:11:09 -08:00
Leonardo de Moura
ec1a490a15 chore(*): annotate candidates for thread local cache reset 2018-02-01 14:59:37 -08:00
Leonardo de Moura
cee73e8309 chore(util/lp): remove lp module
It has been moved to Z3.
2018-01-23 12:18:30 -08:00
matt rice
1538615e8c feat(util): allow some math alphanum symbol latin letter variations
Add the Script, Double-struck, and Fractur blocks from,
https://unicode.org/charts/PDF/U1D400.pdf
to is_letter_like() so they may be bound to variables.
2018-01-23 11:20:05 -08:00
Nuno Lopes
0d820fa23d fix(build): fix Cygwin build 2018-01-22 18:07:04 -08:00
Sebastian Ullrich
f3b0cb936f feat(util/lean_path): detect all instances of ambiguous imports 2018-01-15 09:58:19 +01:00
Leonardo de Moura
b7de24715b fix(util/rbtree): make sure traversal methods do not crash if given function updates the tree
This is a fix for a nasty bug at `type_context::set_instance_fingerprint`.
This method traverses the local context `m_lctx` and invokes `is_class`
which may invoke `whnf`, and `whnf` may temporarily update the local
context. The local context is implemented using a `rb_tree`.
Note that the updates performed by `whnf` are temporary, but it
its representation in memory may be different.
2018-01-05 14:10:28 -08:00
Leonardo de Moura
a2dc2b6549 fix(util): null_output_channel
On OSX, Lean was often crashing when using trace messages.
I identified a problem in the thread finalization process.
In OSX, the `silent_ios_helper` at `library/trace.cpp` was being
finalized after the `null_streambuf` at `util/null_ostream.cpp`.
There was also a memory corruption problem also related to
`null_streambuf`.

This commit fixes this problem by using the following recipe
for creating null output stream buffers in C++.

https://stackoverflow.com/questions/11826554/standard-no-op-output-stream
2017-12-20 11:50:41 -08:00
Sebastian Ullrich
14b2c343d0 chore(util/debug): show current task in assertion message 2017-12-05 17:15:55 -08:00
Sebastian Ullrich
1a80ea9c8e fix(util/utf8): UTF8 decoding 2017-10-27 09:48:09 -07:00
Leonardo de Moura
9399ce8346 feat(library/vm/vm_string): provide native implementation of type string in the VM
closes #1175

The types `string_imp` and `string.iterator_imp` were supposed to be
marked private, but we cannot do it because we need to provide
`string_imp.mk`, `string_imp.cases_on`, `string.iterator_imp.mk` and
`string.iterator_imp.cases_on` in the VM since we use a different
internal representation. Note that marking them as private does not
work since users can still access `string_imp.cases_on` using
meta-programming.
So, we need better support for private declarations.

Missing feature, char literals do not support non ASCII values.
That is, in the current implementation, we cannot write 'α'.
This will be implemented in the future.

The VM native implementation does not behave correctly for huge
strings (i.e., strings with more than 4G characters).
The problem is that the current implementation relies on
```
size_t force_to_size_t(vm_obj const & o, size_t def)
```
We may also have overflow problems in the string.iterator implementation
code. This is not a big deal right now, since I doubt we will try
to process string with more than 2^32 characters.

@Kha the `core_lib` and tests seem to be working correctly, but
we need more tests.
2017-10-23 10:55:26 -07:00
Leonardo de Moura
28501a0e0e feat(library/init/data/string): string as a list of unicode scalar values, and iterator abstraction
TODO:
- Implement string primitives in the VM.
- Support for unicode char literals.
2017-10-23 10:55:26 -07:00
Gabriel Ebner
2804a0ea27 fix(util/name): escape empty name components using french quotes 2017-07-31 16:01:46 +01:00
Gabriel Ebner
36dc037d65 perf(util/rc): do not use fences
As suggested by David Chisnall.  If I read the spec correctly, it would
be unsafe to use the release ordering for dec_ref_core: then the
following situation could happen:

```c++
// m_rc -> 2

// Thread 1:
unsigned x = atomic_fetch_sub_explicit(&m_rc, 1u, memory_order_release);

// Thread 2:
unsigned y = atomic_fetch_sub_explicit(&m_rc, 1u, memory_order_release);

// x = y = 1u, m_rc -> 2
```

That is, a release store operation is not required to be visible to
another release operation.

Herb Sutter also recommends the acq_rel ordering for reference counters.
2017-07-28 18:31:04 +01:00
Gabriel Ebner
bfed11a6f7 fix(util/memory): fix jemalloc support 2017-06-29 11:26:41 +02:00
Sebastian Ullrich
426f1afb4e feat(util/name): accept more subscripts in identifiers 2017-06-28 10:43:19 -07:00
Sebastian Ullrich
f53fa97c4a feat(frontends/lean): escape identifiers when pretty-printing 2017-06-28 10:43:19 -07:00
Gabriel Ebner
33679a11b9 feat(shell/lean,util/log_tree): show currently executing task in lean --make
@dselsam @johoelzl This should make it easier to diagnose which proofs
time out or take a very long time.
2017-06-27 18:48:25 +02:00
Gabriel Ebner
af3f6fd181 fix(util/hash): add missing cast to unsigned 2017-06-25 14:58:18 +02:00
Gabriel Ebner
4a6513e5f5 refactor(util/serializer,library/module): use basic_ostream::write for the olean code 2017-06-23 15:13:40 +02:00
Gabriel Ebner
16c6e0ffaf fix(util/object_serializer): do not compare chars 2017-06-19 20:48:24 +02:00
Gabriel Ebner
856a88833f fix(util/debug,util/serializer): use basic_ios::eof to check for end-of-file 2017-06-19 13:04:06 +02:00
Gabriel Ebner
5528a26592 fix(library/tactic/tactic_state): make tactic.sleep interruptible
Fixes leanprover/vscode-lean#52
2017-06-15 17:16:40 +02:00
Sebastian Ullrich
a72687661b fix(util/stackinfo): avoid and guard against negative overflow in g_stack_threshold computation 2017-06-07 13:22:11 +02:00
Leonardo de Moura
b9a22155da perf(util/stackinfo): optimize check_stack 2017-06-06 16:35:20 -07:00
Gabriel Ebner
1e7e440951 fix(library/module_mgr): actually cancel invalidated tasks 2017-06-05 19:36:09 +02:00
Gabriel Ebner
86f4c9a794 fix(util/thread): disable thread finalizer manager finalization due to race condition 2017-06-04 23:29:34 +02:00
Gabriel Ebner
0c90e97134 fix(util/lp): fix compile error due to missing functions 2017-06-03 15:44:22 +02:00
Gabriel Ebner
9a706daf12 chore(util/debug): mark assertion failures as LEAN_UNLIKELY 2017-06-03 15:44:22 +02:00
Gabriel Ebner
88a1067435 fix(util/debug): extract exit-to-debugger functionality 2017-06-03 15:44:22 +02:00
Gabriel Ebner
910d63d314 refactor(util/compiler_hints): move LEAN_UNLIKELY macro out of vm code 2017-06-03 15:44:22 +02:00
Gabriel Ebner
d394654490 feat(util/debug): throw exceptions for failed assertions in server mode 2017-06-03 15:29:37 +02:00
Leonardo de Moura
6af3084f9a feat(util/numerics/mpz): add mpz(uint64) constructor 2017-06-02 16:36:40 -07:00
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
24048c4258 fix(*): gcc 7 weird uninitialized warnings
I think most of them are incorrect.
I didn't find a workaround for the one at json.hpp.
So, I just disabled this warning at server.cpp
2017-05-31 18:05:03 -07:00
Leonardo de Moura
ac17270894 fix(*): more gcc 7 warnings 2017-05-31 17:29:30 -07:00
Leonardo de Moura
603bbe5987 fix(*): gcc 7 linking errors 2017-05-31 16:35:09 -07:00
Leonardo de Moura
919cf420ea fix(*): gcc 7 warnings 2017-05-31 16:35:09 -07:00
Leonardo de Moura
8ef5acd615 feat(util/numerics/mpz): add test_bit 2017-05-30 13:08:51 -07:00
Mario Carneiro
9d676776b5 feat(library/vm/vm_nat): implementations of bitwise ops 2017-05-30 12:47:44 -07:00