Commit graph

54 commits

Author SHA1 Message Date
Leonardo de Moura
b1c187f717 feat(library/compiler): allow io unit as main function result type
When `io unit` is used, we use `return 0` for `result.ok`, and `return
1` for `result.except`.
2019-03-16 16:05:45 -07:00
Leonardo de Moura
0888dee25e chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07: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
8e9b0d2799 fix(library/compiler): inferred types for stage2 declarations 2019-03-06 17:24:43 -08:00
Leonardo de Moura
b32ba9cb9d feat(library/compiler/compiler): add compiler trace option ll_infer_type 2019-03-06 14:53:27 -08:00
Leonardo de Moura
19e111c2ff feat(library/compiler): allow main function to also have type io uint32 2019-02-13 16:29:10 -08:00
Leonardo de Moura
c27167f445 fix(library/compiler/ll_infer_type): use extern_attribute 2019-02-11 15:35:03 -08:00
Leonardo de Moura
8acb2d4ed8 chore(library/compiler): minor modifications before builtin ==> extern refactor 2019-02-11 13:29:39 -08:00
Leonardo de Moura
bf15ee48fd refactor(library/compiler): export_name ==> export_attribute 2019-02-09 17:59:46 -08:00
Leonardo de Moura
9aed74a5e0 refactor(library/compiler): move extension for storing LLNF code 2019-02-09 17:59:46 -08:00
Leonardo de Moura
4339afc802 chore(library/compiler): [extname] ==> [export] 2019-02-08 10:25:21 -08:00
Max Wagner
e663f75fb2 chore(library/compiler): move builtins into the environment 2019-02-08 09:56:03 -08:00
Leonardo de Moura
14dd0d4907 feat(library/compiler): treat a function named main as the main function 2019-02-06 17:20:23 -08:00
Leonardo de Moura
a8e2e535a2 feat(library/compiler): preserve the arity of entry points 2019-02-06 12:58:18 -08:00
Leonardo de Moura
0e8067e191 fix(library/compiler/compiler): ensure_arity bug 2019-01-28 15:42:23 -08:00
Leonardo de Moura
371baf2002 fix(library/compiler/compiler): typo 2019-01-28 15:34:58 -08:00
Leonardo de Moura
1f3201dca1 feat(library/compiler): add emit_fn_fn skeleton 2019-01-28 15:04:56 -08:00
Leonardo de Moura
274aeed30f fix(library/compiler/compiler): make sure that the type of functions that return closures match their arity
Before this commit, we could have a LLNF function `f` of arity 0 and
type `_obj -> _obj`. Now, this kind of function has type `_obj`.
2019-01-25 15:40:25 -08:00
Leonardo de Moura
8bcc965dc0 feat(library/compiler): make sure we emit bytecode and C++ 2019-01-23 14:13:04 -08:00
Leonardo de Moura
afd30d73c1 chore(library/compiler/compiler): generate Lean IR with explicit boxing and RC instructions
This is just for testing. These two steps are not used by `emit_bytecode`,
but they will be used to generate C++ code.
We can now compile the whole corelib in debug mode with these two extra
transformation without any assertion violation.
2019-01-18 16:01:47 -08:00
Leonardo de Moura
a001806996 feat(library/compiler/compiler): generate boxed version of builtin constants 2019-01-18 15:43:06 -08:00
Sebastian Ullrich
6d0b3afa7e fix(library/compiler/compiler): do not silently abort on user-given sorrys 2018-11-17 18:00:55 +01:00
Leonardo de Moura
3d24c6466b feat(library/compiler/llnf): generate _boxed version eagerly 2018-11-15 18:10:20 -08:00
Leonardo de Moura
e5666b3464 feat(library/compiler): remove another reference to vm.h 2018-11-15 16:38:01 -08:00
Sebastian Ullrich
2f8e6cc975 chore(frontends/lean/elaborator,library/compiler/compiler): avoid error recovery errors 2018-11-14 09:52:22 +01:00
Leonardo de Moura
7365b9ed30 feat(library/compiler/lambda_lifting): cache names for lifted lambdas
We were creating hundreds of different names for simple lambdas. Example:
```
λ a, @coroutine.done a
```
2018-11-13 15:13:55 -08:00
Leonardo de Moura
4136bad252 feat(library/compiler): insert boxing/unboxing instructions 2018-11-12 17:17:09 -08:00
Leonardo de Moura
3ae908f8de feat(library/compiler): add _jmp instruction, and skeleton for explicit boxing introduction step 2018-11-12 10:51:42 -08:00
Leonardo de Moura
7c86a4dae7 feat(library/compiler): add reduce_arity compilation step 2018-11-09 14:30:33 -08:00
Leonardo de Moura
d3ad1cbfe1 feat(library/compiler): add type inference for ENF and LLNF 2018-11-09 13:17:11 -08:00
Leonardo de Moura
df39be927d feat(library/compiler): make sure application arguments are free variables or neutral terms in LLNF 2018-11-07 17:25:20 -08:00
Leonardo de Moura
17679799a2 fix(library/compiler/cse): must take a flag indicating whether we are applying optimization after/before erasure 2018-11-07 16:38:24 -08:00
Leonardo de Moura
330e2700b1 chore(library/compiler/compiler): add trace.compiler.boxed option for debugging purposes 2018-11-06 16:55:02 -08:00
Leonardo de Moura
d871c4f7d8 feat(library/compiler): replace simp_inductive with llnf 2018-10-29 13:07:46 -07:00
Leonardo de Moura
388b4ea6ac feat(library/compiler/llnf): basic llnf module with support for unboxed types
TODO: support for reusing memory cells
2018-10-29 11:02:04 -07:00
Leonardo de Moura
a161eec8f2 feat(library/compiler): add llnf (low level normal form) skeleton 2018-10-27 12:36:30 -07:00
Leonardo de Moura
01229425a2 feat(library/compiler/compiler): inline "small" stage2 declarations at csimp after erasure 2018-10-22 15:49:07 -07:00
Leonardo de Moura
0bcd07f076 feat(library/compiler/compiler): cache "stage2" 2018-10-22 10:19:39 -07:00
Leonardo de Moura
e0bb21ba0b chore(library): remove noncomputable module 2018-10-22 09:39:03 -07:00
Leonardo de Moura
4929af1dd3 feat(library/compiler/extract_closed): extract_closed is working 2018-10-19 18:32:49 -07:00
Leonardo de Moura
356928c873 feat(library/compiler): add extract_closed skeleton 2018-10-19 16:14:59 -07:00
Leonardo de Moura
eb02add3de feat(library/compiler): simplify again after lambda lifting
Motivation: we avoid the creation of closures at join point declarations.
2018-10-19 15:17:07 -07:00
Leonardo de Moura
17b9b21555 feat(library/compiler/csimp): allow csimp to be used after erasure 2018-10-19 12:02:29 -07:00
Leonardo de Moura
611f6ae780 feat(library/compiler/specialize): code specialization
TODO:
- Cache results at `specialize_ext`
- Cleanup

It is not feasible to run code specializer without cache: code explosion.
2018-10-16 15:50:42 -07:00
Leonardo de Moura
42c056862d feat(library/compiler/compiler): cache stage1 result before specialization 2018-10-15 13:08:48 -07:00
Leonardo de Moura
9ca4c362ae feat(library/compiler/specialize): add spec_info
Store which arguments can be specialized.
2018-10-15 12:54:34 -07:00
Leonardo de Moura
27e6f7f424 feat(library/compiler): invoke specialize skeleton 2018-10-09 15:23:42 -07:00
Leonardo de Moura
5d726eb210 feat(library/compiler/compiler): switch to new compiler frontend
We also rename `vm_compiler` module to `emit_bytecode`.
We will eventually replace this module with the new IR emitter.
2018-10-08 17:38:17 -07:00
Leonardo de Moura
662c0ebb31 feat(library/compiler/compiler): cache stage1 2018-10-08 17:06:45 -07:00
Leonardo de Moura
124b4d37fe feat(library/compiler): port simp_inductive to the new compiler stack
This commit also fixes a bug in the old `simp_inductive` module, and
removes now obsolete files (`compiler_step_visitor` and `old_util`).
2018-10-08 16:58:43 -07:00