summary refs log tree commit diff stats
path: root/compiler/ic/ic.nim
Commit message (Collapse)AuthorAgeFilesLines
* opensym as node kind + fixed experimental switch (#23892)metagn2024-08-121-2/+2
| | | | | | | | | | | | | | | refs https://github.com/nim-lang/Nim/pull/23873#discussion_r1687995060, fixes #23386, fixes #23385, supersedes #23572 Turns the `nfOpenSym` node flag implemented in #23091 and extended in #23102 and #23873, into a node kind `nkOpenSym` that forms a unary node containing either `nkSym` or `nkOpenSymChoice`. Since this affects macros working on generic proc AST, the node kind is now only generated when the experimental switch `genericsOpenSym` is enabled, and a new node flag `nfDisabledOpenSym` is set to the `nkSym` or `nkOpenSymChoice` when the switch is not enabled so that we can give a warning. Now that the experimental switch has more reasonable semantics, we define `nimHasGenericsOpenSym2`.
* refactor: The popular 'r' field is now named 'snippet' (#23829)Andreas Rumpf2024-07-121-2/+2
|
* remove nir; succeeded by nif (#23809)ringabout2024-07-091-1/+1
| | | ref https://github.com/nim-lang/nif
* IC: use tables instead of huge seqs because the compiler can create l… ↵Andreas Rumpf2024-06-181-43/+32
| | | | | (#23737) …ots of dummy syms and types
* allow replacing captured syms in macro calls in generics (#23091)metagn2023-12-181-4/+6
| | | | | | | | | | | | | | | | | | fixes #22605, separated from #22744 This marks symbol captures in macro calls in generic contexts as `nfOpenSym`, which means if there is a new symbol in the local instantiatied body during instantiation time, this symbol replaces the captured symbol. We have to be careful not to consider symbols outside of the instantiation body during instantiation, because this will leak symbols from the instantiation context scope rather than the original declaration scope. This is done by checking if the local context owner (maybe should be the symbol of the proc currently getting instantiated instead? not sure how to get this) is the same as or a parent owner of the owner of the replacement candidate symbol. This solution is distinct from the symchoice mechanisms which we originally assumed had to be related, if this assumption was wrong it would explain why this solution took so long to arrive at.
* fixes yet another strictdefs bug (#23069)ringabout2023-12-151-4/+3
|
* type graph refactor; part 3 (#23064)Andreas Rumpf2023-12-141-1/+1
|
* forbides adding sons for `PType` (#23030)ringabout2023-12-041-1/+3
| | | I image `add` for `PType` to be used everythere
* fixes #22552 (#23014)Andreas Rumpf2023-12-021-1/+2
|
* rework the vtable implementation embedding the vtable array directly with ↵ringabout2023-11-281-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | new strictions on methods (#22991) **TODO** - [x] fixes changelog With the new option `nimPreviewVtables`, `methods` are confined in the same module where the type of the first parameter is defined - [x] make it opt in after CI checks its feasibility ## In the following-up PRs - [ ] in the following PRs, refactor code into a more efficient one - [ ] cpp needs special treatments since it cannot embed array in light of the preceding limits: ref https://github.com/nim-lang/Nim/pull/20977#discussion_r1035528927; we can support cpp backends with vtable implementations later on the comprise that uses indirect vtable access --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* progress: 'm' command line switch (#22976)Andreas Rumpf2023-11-221-0/+3
|
* IC: progress and refactorings (#22961)Andreas Rumpf2023-11-201-104/+196
|
* IC: use better packed line information format (#22917)Andreas Rumpf2023-11-071-55/+61
|
* prepare for the enforcement of `std` prefix (#22873)ringabout2023-10-291-2/+2
| | | follow up https://github.com/nim-lang/Nim/pull/22851
* Instantiates generics in the module that uses it (#22513)Juan M Gómez2023-09-091-0/+2
| | | | | | | | | | Attempts to move the generic instantiation to the module that uses it. This should decrease re-compilation times as the source module where the generic lives doesnt need to be recompiled --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* unpublic the sons field of PType; the precursor to PType refactorings (#22446)ringabout2023-08-111-2/+2
| | | | | | | | | | | * unpublic the sons field of PType * tiny fixes * fixes an omittance * fixes IC * fixes
* use strictdefs for compiler (#22365)ringabout2023-08-061-1/+8
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* fixes overriden typo (#22044)ringabout2023-06-081-2/+2
|
* fixes #19863; move sha1, md5 to nimble packages for 2.0 (#21702)ringabout2023-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move sha1, md5 to nimble packages * boot the compiler * fixes tests * build the documentation * fixes docs * lol, I forgot koch.nim * add `nimHasChecksums` define * clone checksums but maybe copying is better * bump nimble hash * use ChecksumsStableCommit * fixes tests * deprecate them * fixes paths * fixes koch
* refactoring in preparation for better, simpler name mangling that wor… ↵Andreas Rumpf2023-04-241-1/+2
| | | | | | | | | | | (#21667) * refactoring in preparation for better, simpler name mangling that works with IC flawlessly * use new disamb field * see if this makes tests green * make tests green again
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-2/+2
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* time to make IC work with ORC (here we go again...) (#20538)Andreas Rumpf2022-10-111-1/+10
| | | works for me
* refactorings (#20536)Andreas Rumpf2022-10-101-3/+0
| | | | | | | * refactoring * refactoring: removed unused macroUsagesSection * enum instead of bool for better readability
* no ropes WIP (#20433)Andreas Rumpf2022-09-271-1/+1
| | | | | | | | | | | | | * refactorings in preparation for ropes elimination of the C code generator; mostly the usual ': Rope' -> 'result: var Rope' rewrite * rewrote ccgcalls.nim * refactored ccgexprs.nim * ccgliterals: refactoring * refactoring: code dealing with name mangling * refactoring: getRecordFieldsAux * ropes are strings (insert obscene joke here) * optimize JS code gen * optimizations and code improvements * more optimizations * final cleanups
* move formatfloat out of system (#20195)ringabout2022-08-241-1/+1
| | | | | | | | | | | | | | | * move formatfloat out of system * fixes doc * Update changelog.md * careless * fixes * deprecate system/formatfloat * better handling
* Refactor and doc package handling, module name mangling (#19821)quantimnot2022-05-301-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor and doc package handling, module name mangling * Consolidate, de-duplicate and extend package handling * Alter how duplicate module names of a package are handled * Alter how module names are mangled * Fix crash when another package is named 'stdlib' (test case added) * Doc what defines a package in the manual Modules with duplicate names within a package used to be given 'fake' packages to resolve conflicts. That prevented the ability to discern if a module belonged to the current project package or a foreign package. They now have the proper package owner and the names are mangled in a consistent manner to prevent codegen clashes. All module names are now mangled the same. Stdlib was treated special before, but now it is same as any other package. This fixes a crash when a foreign package is named 'stdlib'. Module mangling is altered for both file paths and symbols used by the backends. Removed an unused module name to package mapping that may have been intended for IC. The mapping was removed because it wasn't being used and was complicating the issue of package modules with duplicate names not having the proper package owner assigned. * Fix some tests * Refactor `packagehandling` * Remove `packagehandling.withPackageName` and its uses * Move module path mangling from `packagehandling` to `modulepaths` * Move `options.toRodFile` to `ic` to break import cycle * Changed import style to match preferred style Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* [minor]use `addInt` and `addFloat` (#18733)flywind2021-08-241-2/+2
| | | | | | | * unify int and uint * back * minor
* fixes #17943 (#18045)Andreas Rumpf2021-05-191-0/+3
| | | | | | | | | | | * fixes #17943 * IC: test 'nim check --ic:on' for the full Nim compiler * Update testament/testament.nim Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
* CIs: attempt to use csources_v1 (#16282)Andreas Rumpf2021-04-211-3/+3
| | | | | | | | * CIs: attempt to use csources_v1 * also updated the BSDs * also updated azure pipelines * std modules should not itself use the 'std/' import dir... * compiler has to be careful with std/ for v1 booting
* IC navigator: added support for include files (#17784)Andreas Rumpf2021-04-191-1/+1
| | | | | | | | | | | | | | | | | * ic fixed navigator crash when track wrong/missed Also fixed an issue with getNimcacheDir not observing the outDir. * closer, but not sure how to test[skip ci][ci skip] * IC navigator: added support for include files * update * make posix happy via expandFilename * update Co-authored-by: Saem Ghani <saemghani+github@gmail.com>
* ic refactoring (#17778)Andreas Rumpf2021-04-191-64/+111
| | | | | * minor IC documentation update * IC: refactoring: removed the 'shared' type and fields, these were a leftover from an earlier design
* -d:nimDebug: calls doAssert false instead of quit (#17739)Timothee Cour2021-04-171-2/+1
|
* IC: yet another embarrassing omission (#17743)Andreas Rumpf2021-04-171-1/+2
| | | | | * IC: yet another embarrassing omission * VM: fewer hacks that kept IC from working
* ic navigator tests (#17735)Andreas Rumpf2021-04-161-1/+2
| | | * IC navigator: first basic test
* `import foo {.all.}` reboot (#17706)Timothee Cour2021-04-161-16/+42
|
* IC: rodfiles: no floats (#17720)Andreas Rumpf2021-04-141-11/+8
|
* IC: first steps towards 'nim check --def --ic:on' (#17714)Andreas Rumpf2021-04-141-5/+23
| | | | | | | | | * IC: first steps towards 'nim check --def --ic:on' * IC navigator: deduplicate output lines * IC navigator: progress * IC navigator: use a different nimcache entry * IC navigator: special logic for templates/macros * IC navigator: proper error messages * IC navigator: prepare for testing code; document only what currently works somewhat
* IC: code cleanup (#17708)Andreas Rumpf2021-04-131-45/+12
|
* IC: serialization bugfix (#17701)Andreas Rumpf2021-04-131-4/+4
|
* IC: integrity checking (#17695)Andreas Rumpf2021-04-111-1/+2
| | | | | | * IC: integrity checking: the plumbing code * progress * progress + bugfix (yes, the code already found a bug) * implemented integrity checking
* IC: added basic test case for methods (#17679)Andreas Rumpf2021-04-091-1/+1
| | | | | * IC: added basic test case for methods * IC: better methods test
* IC: bugfix (#17533)Andreas Rumpf2021-03-271-2/+5
| | | | * cleanups * IC: bugfix
* added a 'koch ic' command for easier adhoc testing of IC (#17508)Andreas Rumpf2021-03-261-5/+17
| | | | | | * added a 'koch ic' command for easier adhoc testing of IC * IC: progress * IC: enable generics test * make tests green
* IC: backend: remember produced type information (#17440)Andreas Rumpf2021-03-231-2/+9
|
* IC: green tests (#17311)Andreas Rumpf2021-03-191-0/+1147
* IC: renamed to_packed_ast module to ic module * IC: don't store the --forceBuild flag, makes it easier to test * IC: enable hello world test * Codegen: refactorings for IC; changed the name mangling algorithm * fixed the HCR regressions * life is too short for HCR * tconvexhull is now allowed to use deepCopy * IC exposed a stdlib bug, required a refactoring * codegen: code cleanups * IC: even if a module is outdated, its dependencies might come from disk * IC: progress * IC: better name mangling, module IDs are not stable * IC: another refactoring helping with --ic:on --gc:arc * disable arraymancer on Windows for the time being * disable arraymancer altogether * IC: make basic test work with 'nim cpp' * IC: progress on --ic:on --gc:arc * wip; name mangling for type info