Commit graph

232 commits

Author SHA1 Message Date
Leonardo de Moura
a336176017 feat(runtime/io): improve "file not found" error message 2019-07-27 09:45:38 -07:00
Sebastian Ullrich
8fb004f917 fix(runtime/alloc): fix out-of-bounds pointer reported by ubsan 2019-07-26 12:39:35 -07:00
Leonardo de Moura
a16df483fa fix(runtime/io): compilation error on windows 2019-07-26 10:09:55 -07:00
Sebastian Ullrich
e129a65948 fix(shell/CMakeLists): mark libleanstatic.a and libleanstdlib.a as cyclically dependent 2019-07-26 14:38:28 +02:00
Leonardo de Moura
798bbc0662 feat(library/init/system/io): new primitives 2019-07-25 18:12:44 -07:00
Leonardo de Moura
f6d3fc881d feat(library/init): add platform.cpp 2019-07-25 17:19:50 -07:00
Leonardo de Moura
02f516f09d feat(runtime/io): add primitives 2019-07-25 09:36:37 -07:00
Leonardo de Moura
77a59f4998 feat(library/init/io): add IO.getEnv 2019-07-25 08:31:23 -07:00
Leonardo de Moura
2ad33a23db chore(runtime,library/init/lean): remove evalConst 2019-07-19 11:04:57 -07:00
Leonardo de Moura
79545f55c0 feat(library/init/io): add IO.readTextFile 2019-07-18 17:31:31 -07:00
Leonardo de Moura
c9cd693b8e feat(runtime/object): avoid recursion at mark_mt and mark_persistent
Reason: potential stack overflows
2019-07-10 11:27:49 -07:00
Sebastian Ullrich
9707672cc8 fix(runtime/mpz): fix and document size_t functions 2019-07-05 16:27:04 -07:00
Sebastian Ullrich
723e9cc430 chore(runtime/object): fix usize_to_nat name 2019-07-05 16:26:54 -07:00
Sebastian Ullrich
26155442f1 fix(CMakeLists): cmake -E copy doesn't support wildcards on Windows
I don't think we'll need archives other than .a if we don't support MSVC
2019-07-05 11:24:15 +02:00
Sebastian Ullrich
2c9dce6eed fix(runtime/mpz): use size_t instead of unsigned long for Windows compatibility 2019-07-05 11:24:15 +02:00
Leonardo de Moura
4648be6451 feat(runtime/alloc): save memory using a smaller LEAN_OBJECT_SIZE_DELTA 2019-06-29 15:29:39 -07:00
Leonardo de Moura
3651dc7618 feat(library/init/lean): add evalConst
The implementation is good enough for implementing extensible parsers,
elaborators and tactics, but there are a few TODOs

1- We should have a better story for standalone applications.
   Most of them don't need `evalConst`, and the global table is
   just initialization overhead.

2- The global table introduces a dependency on the `Lean.Name`
   implementation. So, all standalone applications will depend on it.

3- We are not storing arity 0 constants in the table.
   This one should be easy to fix in the future.
2019-06-07 16:31:28 -07:00
Leonardo de Moura
c3a7cc4617 feat(library/init/lean/compiler/ir/emitcpp): register functions 2019-06-07 15:34:55 -07:00
Leonardo de Moura
fd29b7e45d feat(util/io): add helper functions for consuming IO results in C++ 2019-06-05 13:53:38 -07:00
Leonardo de Moura
30a6a2ade8 feat(library/init/data, runtime): remove parray support from runtime, and implement them in Lean using Scala/Clojure Radix trees
The Scala/Clojure approach for persistent arrays works great with our
`reset/reuse`. We seem to be much more efficient than their
implementations because of `reset/reuse`. The new approach also seems
better than the old one implemented in the runtime, and has a few
advantages:
1- The reroot procedure used in the old approach required
synchronization for multi-threaded code, or we would need to perform
deep copies when sending `parray` objects between threads.
2- We don't need any runtime extension for the new approach.
3- The old approach used "trail lists" for undoing array updates.
This works well for bactracking search use cases, but it is bad
in use cases where we are simultaneously updating the persistent
arrays that have shared nodes.
2019-06-02 09:18:19 -07:00
Leonardo de Moura
6f383ffa1d fix(runtime/object): overflow at lean::nat_mul 2019-06-01 09:23:41 -07:00
Leonardo de Moura
013f0c9edb feat(library/init/lean/compiler/ir/rc): missing optimization 2019-05-22 18:46:43 -07:00
Leonardo de Moura
6bed0ca5b5 chore(library/compiler): style 2019-05-22 18:46:37 -07:00
Leonardo de Moura
ae8a51c718 feat(library/init/lean/runtime): expose runtime limit 2019-05-21 14:24:16 -07:00
Leonardo de Moura
48ed3c5307 feat(runtime): inline hot path small object allocation 2019-05-17 10:12:43 -07:00
Leonardo de Moura
53ec9ee181 chore(*): style 2019-05-14 07:08:58 -07:00
Leonardo de Moura
5844913102 feat(library/module, library/init/lean/environment): add primitives for reading/writing files as compacted regions 2019-05-13 17:26:28 -07:00
Leonardo de Moura
2cd2bec831 fix(init/init.cpp): initialization bug 2019-05-11 17:51:23 -07:00
Leonardo de Moura
c46608ced5 feat(library/init/io): implement unsafeIO in Lean
Motivation: avoid closure allocation.
2019-05-11 16:28:11 -07:00
Leonardo de Moura
fd2a5dd45e feat(library/init/io): add IO.initializing 2019-05-10 11:26:49 -07:00
Leonardo de Moura
18aa7de408 feat(library/init/data): add ByteArray 2019-05-08 16:43:00 -07:00
Leonardo de Moura
81d11db5d2 chore(runtime/object): rename runtime primitives 2019-05-02 10:55:29 -07:00
Leonardo de Moura
af1d521706 feat(library/init/data/array/basic): add Array.swap 2019-05-01 17:38:44 -07:00
Leonardo de Moura
a32fcf33c7 feat(util/array_ref): simple wrapper for creating Lean array objects in C++ 2019-04-29 17:10:35 -07:00
Leonardo de Moura
dd5fa4626f chore(runtime/object): style 2019-04-28 09:18:54 -07:00
Leonardo de Moura
79e2abe33f feat(CMakeLists): put configuration options relevant to leanc at config.h 2019-04-27 21:04:41 -07:00
Leonardo de Moura
5c7849a869 feat(runtime): eager heap initialization 2019-04-25 18:10:36 -07:00
Leonardo de Moura
32f41f60d3 feat(runtime/object): add dbgTraceIfShared primitive for debugging RC reuse issues 2019-04-19 16:26:45 -07:00
Leonardo de Moura
273a0775d6 perf(library/init/data/array): mkArray in Lean doesn't seem to buy us anything
The primitive implementation combines all `inc`'s into a single one.
2019-04-03 10:27:58 -07:00
Leonardo de Moura
ee050431e0 feat(runtime): add primitive hash functions 2019-04-03 04:01:36 -07:00
Leonardo de Moura
a46e27a3d7 feat(runtime/hash): use size_t instead of unsigned 2019-04-03 03:19:50 -07:00
Leonardo de Moura
229e4a25b3 refactor(library/init/array): implement mkArray in Lean, add allow mkEmpty to set initial capacity 2019-03-29 10:19:21 -07:00
Sebastian Ullrich
21f1d231b8 fix(runtime/object): do not return temporary borrowed reference from a builtin 2019-03-29 14:32:15 +01:00
Leonardo de Moura
42fbe3c18c chore(library/init,runtime,library/compiler): add fix primitive back
The new `partial def`s allow us to define `fix` in Lean, but the Lean
implementation is not as efficient as the native one. The native one
in C++ use weak pointers to prevent a closure allocation at every
recursive invocation.

This commit also fixes the `fixCore` helper functions that were broken
after we switched to camelCase.

We have updated the test `fix1.lean` to demonstrate the native
implementation is faster. Here are the numbers on my desktop.

```
./run.sh fix1.lean 24
721420279
Time for 'native fix': 816ms
721420279
Time for 'fix in lean': 1.34s
```
2019-03-27 17:13:53 -07:00
Leonardo de Moura
ea3a38c5d3 chore(runtime/object): style 2019-03-27 14:08:10 -07:00
Leonardo de Moura
d536ee347d chore(runtime/object): remove fixpoint* primitives 2019-03-27 13:17:25 -07:00
Leonardo de Moura
4b83585103 chore(stage0, runtime): update stage0 and remove old String API 2019-03-26 15:51:13 -07:00
Leonardo de Moura
dd48d5ae18 feat(runtime/object): implement string primitives using Nat index 2019-03-26 15:27:14 -07:00
Leonardo de Moura
0d5ac5288a feat(runtime): increase small nat size
In 64-bit machines, the max small nat value should now be (2^63 - 1), and on 32-bit
machines (2^32 - 1).

The main motivation for this modification are the array indexing
operations. With the new representation, if a Nat index is not small,
then it must not be a valid index. This was not true in 64-bit
machines. Example: an array of size 2^33 would fit in memory, and but
an index `i` > 2^32 - 1 would not be a small nat value.
2019-03-26 14:21:03 -07:00
Leonardo de Moura
b0da4360d0 chore(runtime, library/init/data/string/basic): prepare to change String.Pos 2019-03-26 12:25:12 -07:00