Commit graph

15895 commits

Author SHA1 Message Date
Leonardo de Moura
cbc65544f0 chore(boot): update 2019-03-12 18:20:10 -07:00
Leonardo de Moura
77dc3f3d32 feat(library/init/io): use fix to implement iterate 2019-03-12 18:06:23 -07:00
Leonardo de Moura
88453f037c feat(library/compiler/csimp): erase base argument from fix_core 2019-03-12 18:05:41 -07:00
Leonardo de Moura
907627ee9e chore(boot): update 2019-03-12 14:11:27 -07:00
Leonardo de Moura
62df218a8e fix(library/compiler/specialize): another bug 2019-03-12 14:08:52 -07:00
Leonardo de Moura
e858d7f5b8 fix(library/compiler/specialize): yet another specializer bug
@kha I found yet another bug in the specializer code :(
The bug is related to the previous bug fix where we try avoid
duplication of work by lambda abstracting let-variables.
We knew this could introduce type errors, but I thought it would only
happen in very complicated programs that make a heavy use of dependent
types. Actually, this is not the case. I just found an instance when
I was playing with the new parser.
2019-03-12 12:25:32 -07:00
Leonardo de Moura
64e60f77b3 chore(runtime/object): remove dead code 2019-03-12 12:25:11 -07:00
Leonardo de Moura
51838aede9 refactor(library/init/lean/parser/rec): use init.fix 2019-03-12 08:31:58 -07:00
Leonardo de Moura
b320452f70 chore(runtime/object): remove iterator primitives from runtime
They are now implemented in Lean.
2019-03-12 07:09:48 -07:00
Leonardo de Moura
2a2f3c1429 chore(boot): update 2019-03-12 06:56:05 -07:00
Leonardo de Moura
68ebc2a5c5 feat(library/init/data/string/basic): implement iterators using uft8 low level API 2019-03-12 06:56:05 -07:00
Leonardo de Moura
cf3bbd7e25 feat(runtime): add utf8_prev and utf8_set
Next goal: implement string.iterator in Lean
2019-03-11 18:05:40 -07:00
Leonardo de Moura
609b8e87e5 feat(library/compiler/csimp): add fix_core_n => fix_core_m "eta-expansion-like" optimization
After this commit, `fix_1.lean` is not slower than `fix.lean` anymore.
2019-03-11 14:41:23 -07:00
Leonardo de Moura
d55a439542 test(tests/playground/fix_1): add fix.lean variant: fix_1.lean
`fix.lean` and `fix_1.lean` are very similar, but fix.lean is almost
twice as fast. Reason: `fix.lean` uses `fix_2` instead of `fix_1` and
avoid the creation of many closures. Here are runtime numbers on my
machine.

```
time ./fix_1.lean.out 23
352321527

real	0m0.729s
user	0m0.724s
sys	0m0.000s
```

```
~/projects/lean4/tests/playground (master +)$ time ./fix.lean.out 23
352321527

real	0m0.396s
user	0m0.388s
sys	0m0.004s
```

TODO: modify the compiler to replace `fix_core_n f a_1 ... a_m`
with `fix_core_m f a_1 ... a_m` whenever `n < m`.
This feature is quite useful for writing reusable/generic code. For
example, we cannot write an efficient `rec_t` without it because we
don't know the arity of `m A` when we write `rec_t`.
2019-03-11 13:44:07 -07:00
Leonardo de Moura
1e821d4057 chore(library/init/fix): rename primitives 2019-03-11 13:41:13 -07:00
Leonardo de Moura
5402178f73 test(tests/playground): fix tests
Forgot to add them.
2019-03-11 08:11:00 -07:00
Leonardo de Moura
a1cbd39d74 feat(library/init/lean/extern): remove restriction from expand_extern_pattern 2019-03-10 11:42:39 -07:00
Leonardo de Moura
ff3bf508aa feat(library/init/fix, runtime): add fixpoint2, ..., fixpoint6
The idea is to avoid allocating tuples when creating the fixpoint of
nary functions. For example, consider the new tests:
- tests/playground/fix.lean
- tests/playground/fix_with_tuples.lean

The second one (`fix_with_tuples`) uses the `fix` operator and tuples. For input = 20,
it creates more than 1 million extra objects. The first implementation
(`fix.lean`) using `fix₂` avoids this overhead.

TODO: Add support for pattern #N with N > 9 at
```
def expand_extern_pattern_aux (args : list string) : nat → string.iterator → string → string
```
2019-03-10 11:19:02 -07:00
Leonardo de Moura
4ca9c6f22e feat(runtime): add efficient fixpoint implementation 2019-03-10 10:09:57 -07:00
Leonardo de Moura
eb2633a5f2 fix(runtime/alloc): segment recycling 2019-03-09 13:42:55 -08:00
Leonardo de Moura
8f6998acac fix(runtime/alloc): we may deallocate in a new thread before we allocated anything 2019-03-09 13:20:06 -08:00
Leonardo de Moura
01b4983fa2 fix(runtime/object): string_utf8_extract 2019-03-09 12:57:51 -08:00
Leonardo de Moura
67944a6c81 test(tests/compiler/str): new test for utf8 primitives 2019-03-09 12:41:33 -08:00
Leonardo de Moura
ab73553bf2 chore(boot): update 2019-03-09 12:40:43 -08:00
Leonardo de Moura
c862ce4a75 feat(runtime, library/init/data/string/basic): add utf8_pos
`utf8_pos` is a low level alternative for `string.iterator`.
TODO: implement `string.iterator` using it.
2019-03-09 12:30:19 -08:00
Leonardo de Moura
2c3cfcf1dd feat(library/init/data/char/basic): add char.utf8_size 2019-03-09 10:46:29 -08:00
Leonardo de Moura
402034df1f chore(library/init/data): move usize to uint 2019-03-09 10:32:23 -08:00
Leonardo de Moura
2032b10482 feat(library/init/data): bitwise operations 2019-03-09 10:19:35 -08:00
Leonardo de Moura
114f7ed190 feat(tests/playground/flat_parser): minor edits
We need a low level string.iterator to efficiently implement
primitives such as `str`.
2019-03-09 08:08:37 -08:00
Leonardo de Moura
d2ef708763 feat(library/compiler/ll_infer_type): _unreachable 2019-03-09 07:49:51 -08:00
Leonardo de Moura
489eaf3b71 test(tests/playground/flat_parser): experiment 2019-03-08 17:09:42 -08:00
Leonardo de Moura
8799056607 chore(boot): update 2019-03-08 12:13:06 -08:00
Leonardo de Moura
4828df1c7a chore(library/init/lean/frontend): revert 4333ab620
The specializer has been fixed. So, we don't need this workaround
anymore.
2019-03-08 12:06:49 -08:00
Leonardo de Moura
b43ebab32c fix(library/compiler/specialize): we should not lambda abstract join points 2019-03-08 11:54:51 -08:00
Leonardo de Moura
7b1d15ec43 fix(library/compiler/specialize): avoid work duplication in the specializer 2019-03-08 11:21:49 -08:00
Leonardo de Moura
baec9a1b78 chore(library/init/lean/compiler/ir): minor 2019-03-08 09:14:54 -08:00
Sebastian Ullrich
6a96d94259 chore(boot): update 2019-03-08 17:26:02 +01:00
Sebastian Ullrich
d0929c93cd perf(library/init/lean/frontend): make file_map construction explicit, do it only once 2019-03-08 17:17:27 +01:00
Sebastian Ullrich
ef7053dac9 chore(boot): update 2019-03-08 17:05:42 +01:00
Sebastian Ullrich
4333ab620c refactor(library/init/lean/frontend): use direct unbounded recursion instead of iterate_eio 2019-03-08 17:04:46 +01:00
Sebastian Ullrich
0580ce7cfa chore(boot): update 2019-03-08 15:34:37 +01:00
Sebastian Ullrich
e0bbc094ad chore(library/init): remove coroutines from stdlib 2019-03-08 15:34:17 +01:00
Sebastian Ullrich
234e4d1e8a refactor(library/init/lean/elaborator): replace coroutines with explicit state 2019-03-08 15:23:01 +01:00
Leonardo de Moura
9962441b7b chore(boot): update 2019-03-07 15:44:43 -08:00
Leonardo de Moura
db6f08e66d feat(library/init/lean/compiler/ir): collect fnbody free variables 2019-03-07 15:37:45 -08:00
Leonardo de Moura
27028309a3 feat(library/init/lean/kvmap): add == for kvmap 2019-03-07 14:12:10 -08:00
Leonardo de Moura
a836bcc204 feat(library/init/lean/compiler/ir): alpha equivalence 2019-03-07 13:50:35 -08:00
Leonardo de Moura
29770d73b3 chore(boot): update 2019-03-07 12:49:53 -08:00
Leonardo de Moura
67f4698593 feat(library/compiler): do not generate code for decls that have irrelevant types
We were generating hundreds of definitions that just return
`lean::box(0)`.
2019-03-07 12:48:16 -08:00
Leonardo de Moura
057d90b7ff chore(runtime/object): track number of external objects allocated 2019-03-07 12:31:05 -08:00