Leonardo de Moura
5c925f9345
feat: add functions to create small arrays and use them in the constant folder
...
It reduces the code generated for functions using a bunch
of quotations. For example, the size of
`Lean.Elab.Term.Do.ToTerm.matchNestedTermResult` went from 2348 to 1507
2022-09-28 22:00:50 -07:00
Leonardo de Moura
6bc6522d86
feat: constructor => discriminant optimization
2022-09-28 21:14:19 -07:00
Leonardo de Moura
73ebaf8499
feat: improve visitLambda at toLCNF
2022-09-28 19:17:28 -07:00
Leonardo de Moura
94c2ec38d5
feat: implement cast TODO
...
fixes issue reported at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Annoying.20LCNF.20errors/near/301269857
2022-09-28 15:40:53 -07:00
Leonardo de Moura
970331de05
chore: avoid a.getAppFn.isAnyType idiom
2022-09-28 15:34:09 -07:00
Leonardo de Moura
fd5f3a5bad
feat: track recursively inlining
...
closes #1657
see #1646
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/inline.20codegen.20crash/near/301099703
2022-09-27 16:26:49 -07:00
Leonardo de Moura
002c7d2f22
feat: configuration options for the code generator
2022-09-27 16:26:49 -07:00
Leonardo de Moura
135790f41a
fix: missing eraseCode at inlineProjInst?
...
Fixes issue reported at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/LCNF.20local.20context.20contains.20unused.20local.20variable.20declaratio/near/301102923
2022-09-27 16:26:49 -07:00
Leonardo de Moura
65c307a7b7
feat: add environment extension for constant folder
...
TODO: add command/attribute for conveniently installing folders
2022-09-27 16:26:49 -07:00
Leonardo de Moura
8596e4af88
fix: mark code as simplified
2022-09-26 21:27:45 -07:00
Leonardo de Moura
193e3fd184
feat: add basic String folding
2022-09-26 21:23:08 -07:00
Leonardo de Moura
e6f5b3758c
feat: precompute folders
2022-09-26 21:10:38 -07:00
Leonardo de Moura
1e75001405
feat: preserve user provided names at LCNF Simp
...
It helps preserving let-declaration names in pure code, but it is not
very useful for monadic let-decls (e.g., `let x <- act`). The binder
names are often lost we eliminating the abstraction layers.
2022-09-26 21:04:13 -07:00
Leonardo de Moura
24e584cf00
feat: add Renaming.lean
2022-09-26 21:04:13 -07:00
Henrik Böving
2958b8a7f5
feat: basic constant folder
...
supports:
- arithmetic operations:
- folding full constants
- folding neutral elements
- folding annihilators
- List.toArray
2022-09-26 21:03:47 -07:00
Leonardo de Moura
73d5e12ac5
fix: baseExt must not use SimplePersistentEnvExtension
...
We invoke `Decl.saveBase` more than once when we update a declaration.
2022-09-26 08:15:47 -07:00
Leonardo de Moura
ba619be393
fix: apply macroInline again after inlineMatchers
2022-09-26 07:31:27 -07:00
Leonardo de Moura
837ce4374c
feat: use reduceJpArity after successful simpJpCases?
2022-09-26 07:25:29 -07:00
Leonardo de Moura
35ca2b203c
refactor: split Simp.lean
2022-09-26 07:04:20 -07:00
Mario Carneiro
85119ba9d1
chore: move Std.* data structures to Lean.*
2022-09-26 05:46:04 -07:00
Leonardo de Moura
fd1ae3118c
feat: replace isCasesOnCases? with simpJpCases?
...
It addresses the code explosion issue with the old optimization.
For example, the resulting size for `Lean.Json.Parser.escapedChar`
went from 31593 to 361.
2022-09-25 20:57:24 -07:00
Leonardo de Moura
bbac49e925
feat: add collectJpCasesInfo
...
Collect statistics for implementing new optimization that will replace `isCasesOnCases?`
2022-09-25 20:57:24 -07:00
Leonardo de Moura
236885e72e
chore: remove Stage1
2022-09-25 13:17:50 -07:00
Leonardo de Moura
afb457ca2a
feat: add forEachDecl for LCNF
2022-09-24 20:18:27 -07:00
Leonardo de Moura
ce12ecfe13
fix: free variable collision at LCNF/Specialize.lean
2022-09-24 18:51:32 -07:00
Leonardo de Moura
5969dc2694
feat: beta-reduce at LCNF normExpr
2022-09-24 18:26:34 -07:00
Leonardo de Moura
f7a1429cfd
feat: improve ppDecl'
2022-09-24 18:09:43 -07:00
Leonardo de Moura
c858aa3088
feat: replace getStage1Decl? with new getDecl?
2022-09-24 15:00:19 -07:00
Leonardo de Moura
33fdde9b22
fix: LCNF compatibleTypes
...
Missing rules:
`⊤ a` is compatible with anything.
`◾ a` is compatible with anything.
2022-09-24 14:20:21 -07:00
Leonardo de Moura
7ca7139fe8
fix: incorrect [inline] annotation
2022-09-24 14:20:21 -07:00
Leonardo de Moura
6343b97acb
feat: display inlining stack when maximum recursion depth has been reached
2022-09-24 14:20:21 -07:00
Leonardo de Moura
7d583f9543
fix: convert _unsafe_rec to original name
2022-09-24 08:19:41 -07:00
Leonardo de Moura
b88bd98afa
fix: unreach case for Code.bind
2022-09-24 08:13:17 -07:00
Leonardo de Moura
947811cab8
fix: zero exit points != one exit point
2022-09-24 08:13:17 -07:00
Leonardo de Moura
85c468c853
fix: remove internal name hack at [specialize] and [inline] attributes
2022-09-23 20:25:16 -07:00
Leonardo de Moura
011521013d
feat: use phase at inferConstType, save specialization
2022-09-23 16:45:04 -07:00
Leonardo de Moura
0c82e8bd0d
feat: make sure base phase contains an entry for each declaration being compiled at `init
2022-09-23 16:31:38 -07:00
Leonardo de Moura
2be8cb93ac
feat: store phase at CompilerM context
2022-09-23 16:30:51 -07:00
Leonardo de Moura
c333581689
fix: functions occurring as arguments of other functions are not inlined
2022-09-23 14:43:06 -07:00
Leonardo de Moura
e4f0f4b794
fix: shouldGenerateCode fix for axiom
2022-09-23 14:25:48 -07:00
Leonardo de Moura
5322aa79f6
fix: apply findJoinPoints before pullFunDecls
...
`pullFunDecls` affects the effectiveness of `findJoinPoints`
2022-09-23 14:00:24 -07:00
Leonardo de Moura
004822aba4
fix: mixing Lean and LCNF types at toLCNF
2022-09-23 13:56:31 -07:00
Leonardo de Moura
609d241ad4
fix: improve updateFunDeclInfo precision
2022-09-23 13:56:14 -07:00
Leonardo de Moura
8cf225e9ce
fix: PassInstaller staging issue
...
The builtin pass installer cannot be installed using `[cpass]` because
it will not be activated until we process `Passes.lean`
2022-09-23 08:17:58 -07:00
Leonardo de Moura
e53ac503da
refactor: move PassInstaller to CoreM
2022-09-23 07:22:54 -07:00
Leonardo de Moura
aa17641f18
chore: LCNF imports
2022-09-23 07:05:57 -07:00
Leonardo de Moura
4323205185
fix: support user-defined empty inductives at toLCNF
2022-09-23 05:50:02 -07:00
Leonardo de Moura
eed569153b
fix: dependent field issue
2022-09-22 20:38:42 -07:00
Leonardo de Moura
5db452cfe7
doc: add note at LCNF internalizer
...
We should also new tests that expose the problem.
2022-09-22 20:19:01 -07:00
Leonardo de Moura
412a05d0d6
fix: ensure cases field parameters do not occur in types
2022-09-22 20:15:39 -07:00