summary refs log tree commit diff stats
path: root/compiler/dfa.nim
Commit message (Collapse)AuthorAgeFilesLines
* updated compiler DFA docs (#23527)Andreas Rumpf2024-04-221-13/+3
|
* type refactor: part 4 (#23077)Andreas Rumpf2023-12-151-1/+1
|
* prepare for the enforcement of `std` prefix (#22873)ringabout2023-10-291-1/+2
| | | follow up https://github.com/nim-lang/Nim/pull/22851
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-111-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Theoretical Benefits / Plans: - Typed assembler-like language. - Allows for a CPS transformation. - Can replace the existing C backend by a new C backend. - Can replace the VM. - Can do more effective "not nil" checking and static array bounds checking. - Can be used instead of the DFA. - Easily translatable to LLVM. - Reasonably easy to produce native code from. - Tiny memory consumption. No pointers, no cry. **In very early stages of development.** Todo: - [x] Map Nim types to IR types. - [ ] Map Nim AST to IR instructions: - [x] Map bitsets to bitops. - [ ] Implement string cases. - [ ] Implement range and index checks. - [x] Implement `default(T)` builtin. - [x] Implement multi string concat. - [ ] Write some analysis passes. - [ ] Write a backend. - [x] Integrate into the compilation pipeline.
* replaces `doAssert false` with `raiseAssert` for unreachable branches, which ↵ringabout2023-08-101-1/+1
| | | | | works better with strictdefs (#22436) replaces `doAssert false` with `raiseAssert`, which works better with strictdefs
* use strictdefs for compiler (#22365)ringabout2023-08-061-2/+3
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* fixes #22001 (#22177)Andreas Rumpf2023-06-271-2/+4
| | | | | * fixes #22001 * added test case
* adds an experimental `mm:atomicArc` switch (#21798)ringabout2023-05-081-1/+1
|
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-1/+1
| | | | | * fixes #20572 * added a test case
* DAA and 'out' parameters (#20506)Andreas Rumpf2022-10-061-4/+3
| | | | | | | | | | | * DAA and 'out' parameters * progress * documented strictDefs and out parameters * docs, tests and a bugfix * fixes silly regression
* new move analyser2 (#20471)Andreas Rumpf2022-10-011-426/+106
| | | | | | | | * produce better code for closure environment creation * new 'first write' analysis; * scope based move analyser * code cleanup Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* support cstring in `case` (#20130)metagn2022-09-011-1/+1
| | | | | | | | | | | | | | | * implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* compiler: Handle nkCheckedFieldExpr better in dfa (#19616)Clyybber2022-03-181-4/+2
| | | | | | | Simply recurse into their first child, which is always a nkDotExpr instead of treating them seperately. This fixes the rhs sym of a nkCheckedFieldExpr being checked twice in aliases. This double checking didn't cause any issues, but was unintentional and redundant.
* [backport] arc: improve compile time of (nested) loops (#18890)Clyybber2021-09-241-3/+8
|
* fixes #18665 DFA generator bug (#18676)Andreas Rumpf2021-08-111-0/+6
|
* followup #18362: make `UnusedImport` work robustly (#18366)Timothee Cour2021-06-271-1/+1
| | | | * warnDuplicateModuleImport => hintDuplicateModuleImport * improve DuplicateModuleImport msg, add test
* ORC: progress (#18000)Andreas Rumpf2021-05-121-1/+1
| | | | | | | | | * ORC: progress * ORC: bugfix; don't follow acyclic data even if only at runtime the subtype is marked as acyclic * progress * minor style changes
* Fix #17712 (#17873)Clyybber2021-04-271-3/+4
|
* fixes #17198, DFA failure on large case stmts (#17210)Saem Ghani2021-03-021-3/+8
| | | | | | This alters the DFA control flow graph generation for case statments. Gotos are now generated as a chained link, this ensures that evaluation of variant branches collapses as early as possible, without hitting the 2k call limit.
* add -d:nimStrictMode in CI to keep code from regressing; fixes ↵Timothee Cour2021-02-171-2/+0
| | | | ConvFromXtoItselfNotNeeded, UnusedImport notes (#16764)
* ARC Analysis in one pass v3 (#17068)Clyybber2021-02-171-14/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut * Cache alias results This improves performance by a lot, since many CFG locations map to a single PNode * Improve performance * Improve performance * Cleanup * Fix #17025 * Grammar * Expand testcase
* Revert "ARC: Analysis in one pass v2 (#17000)" (#17046)Clyybber2021-02-151-3/+14
| | | This reverts commit 216be4060a853b3425501318537d598c4842eefc.
* ARC: Analysis in one pass v2 (#17000)Clyybber2021-02-101-14/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut * Cache alias results This improves performance by a lot, since many CFG locations map to a single PNode * Improve performance * Improve performance * Cleanup
* Revert "ARC Analysis in one pass (#16849)" (#16984)Clyybber2021-02-091-3/+14
| | | This reverts commit ab740cb5b9bfbacece26956fa2444763a790ccd1.
* ARC Analysis in one pass (#16849)Clyybber2021-02-091-14/+3
| | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut
* Finer analysis for array access (#16787)Clyybber2021-01-241-27/+73
| | | | | * Refine the analysis for array access * Cleanup * Add comments
* move asciitables to std/private/ (#16498)flywind2020-12-291-1/+2
| | | | | * move asciitables * minor
* fixes #15130 (#15141)Andreas Rumpf2020-08-011-1/+1
| | | | | * fixes #15130 * you really have to copy from cursors
* fixes #15111 (#15136)Andreas Rumpf2020-08-011-2/+2
|
* injectdestructors fixes and refactor (#14964)Clyybber2020-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * injectdestructors fixes and refactor * Tiny cleanup * Refactor and expand testcase * Closes #14902 by adding testcase * Better naming * Fix test failures * Misc cleanup * Add testcase for #14968 * Better approach; expand testcases * Optimizations and fixes * Add testcase * typo * Tiny cleanup
* DFA and injectdestructors cleanup (#14824)Clyybber2020-06-281-135/+92
| | | | | | | | | | | | | | | * DFA and injectdestructors cleanup * More precise write analysis * Cleanup obsoleted path * Unify defInstrTargets and useInstrTargets * Misc cleanups * Nicer CFG printing * Misc cleanups 2
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-4/+2
| | | | | | | | | | | * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog
* more checking for --gc:arc, no need for valgrind (#14467)Andreas Rumpf2020-05-291-1/+4
| | | | * sigmatch: removed dead code
* New "ping-pong" DFA (#14322)Clyybber2020-05-151-41/+22
| | | | | | | | | | | | | | | | | * New ping-pong analysis * Add testcase for #13456 * Remove debugging leftover * Unquote "unstructured controlflow" * Fix typo * Fix exponential complexity in edge cases * Add sanity testcase * Fix
* Fix #14269 (#14286)Clyybber2020-05-091-1/+2
|
* Fix the DFA for "unstructured controlflow" (#14263)Clyybber2020-05-071-74/+115
| | | | | * Fix the DFA for "unstructured controlflow" * Add testcase from #14233
* destructors: don't produce stupid code for 'cast' (#14208) [backport:1.2]Andreas Rumpf2020-05-041-2/+2
| | | | | * destructors: don't produce stupid code for 'cast' * fixes #14207
* fixes #14159 [backport:1.2]Araq2020-05-021-1/+3
|
* Deprecate when declared(echo):echo (#13840)Juan Carlos2020-04-021-2/+1
|
* sink parameter inference for types that have destructors (#13544)Andreas Rumpf2020-03-041-0/+2
| | | | | | | | | | | | | | * ensure capitalize doesn't take an inferred sink parameter * sink parameter inference: first version, for now disabled. Changed that sink parameters can be consumed multiple times in order to adhere to our spec. * sink inference can now be disabled with .nosinks; sometimes for proc type interop this is required * fixes yet another critical DFA bug * better implementation that also understands if expressions etc * document sink parameter inference and allow for global disabling
* fixes #13314 (#13372)Andreas Rumpf2020-02-091-4/+9
|
* Cleanup DFA (#13173)Clyybber2020-01-161-34/+14
|
* ARC: misc bugfixes (#13156)Andreas Rumpf2020-01-151-2/+8
| | | | | | | | * fixes #13102 * closes #13149 * ARC: fixes a move optimizer bug (there are more left regarding array and tuple indexing) * proper fix; fixes #12957 * fixes yet another case object '=' code generation problem
* minor refactoringsAndreas Rumpf2019-12-271-9/+1
|
* fixes #12669Araq2019-11-291-11/+26
|
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-44/+43
| | | | | | | | | | | | | | | | | | * Cleanup compiler code base * Unify add calls * Unify len invocations * Unify range operators * Fix oversight * Remove {.procvar.} pragma * initCandidate -> newCandidate where reasonable * Unify safeLen calls
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* fix #12037 (#12089)Clyybber2019-08-301-14/+3
|
* [refactoring] remove unused imports in the compiler and in some stdlib modulesAraq2019-07-181-1/+1
|