summary refs log tree commit diff stats
path: root/compiler/cgen.nim
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Fix #13093 C++ Atomics: operator= is implicitly deleted because the ↵ringabout2023-01-271-4/+0
| | | | | | | default definition would be ill-formed " (#21307) Revert "Fix #13093 C++ Atomics: operator= is implicitly deleted because the default definition would be ill-formed (#21169)" This reverts commit a7bae919adb952362cb53206140872d2b7424b47.
* Fix #13093 C++ Atomics: operator= is implicitly deleted because the default ↵Bung2023-01-271-0/+4
| | | | | | | | | | | | | definition would be ill-formed (#21169) * add test * fix #17982 Invalid C++ code generation when returning discardable var T * fix #13093 * cpp atomic good example * clearify the condition
* fixes #21261; always checking `nimTestErrorFlag` in the main module (#21288)ringabout2023-01-241-0/+3
| | | | | * fixes #21261; always checking nimTestErrorFlag in the main module * add a test
* remove legacy code (#21134)ringabout2022-12-261-2/+0
| | | | | * remove legacy code * fixes
* NimMain/NimPreMain calls are now only volatile when it makes sense. (#20882)Yuriy Glukhov2022-11-221-49/+31
|
* Small cleanup to cgen output (#20874)Matt Moseley2022-11-211-9/+9
|
* reduce openArray-related C undefined behavior (#20795)tersec2022-11-091-0/+6
|
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-2/+2
| | | | | * fixes #20572 * added a test case
* refactorings (#20536)Andreas Rumpf2022-10-101-1/+1
| | | | | | | * refactoring * refactoring: removed unused macroUsagesSection * enum instead of bool for better readability
* no ropes WIP (#20433)Andreas Rumpf2022-09-271-96/+138
| | | | | | | | | | | | | * 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
* fix #17351; switch to c++17 and remove hacks (#20407)ringabout2022-09-231-2/+1
| | | | | * fix #17351; switch to c++17 * remove workaround
* 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
* ref #19830; multiple definition of in Nim generated static libraries (#19934)flywind2022-06-271-18/+18
| | | | | * ref #19830; multiple definition of in Nim generated static libraries * fix compile errors
* not generate initStackBottomWith in arc/orc [backport] (#19875)flywind2022-06-101-1/+1
| | | not generate initStackBottomWith in arc/orc
* Refactor and doc package handling, module name mangling (#19821)quantimnot2022-05-301-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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/+4
|
* fixes #19569 (#19595) [backport]Andreas Rumpf2022-03-091-1/+1
| | | | | * minor code refactorings * fixes #19569
* Remove volatiles when compiling with ARC/ORC (#19545)PMunch2022-02-251-18/+50
| | | | | | | This removes volatiles on ARC/ORC targets in NimMain and PreMainInner. This avoids an issue where they couldn't be optimised out on microcontrollers leading to larger code. Since the stack bottom doesn't have to be initialised this way when using ARC or ORC (or None, which is also covered by this PR) these can be safely removed.
* nvro don't touch cdecl types [backport: 1.6] (#19461)flywind2022-01-281-2/+2
| | | * nvro don't touch cdecl types; fix #19342 again
* enable weave (#19363) [backport:1.6]flywind2022-01-201-2/+7
| | | | * enable weave * workaround CI
* added --nimMainPrefix switch; fixes #15955; refs #16945 [backport:1.6] (#19235)Andreas Rumpf2021-12-101-17/+20
|
* fix #19193 (#19195) [backport:1.2]Tanguy2021-12-071-2/+8
|
* fix #18410 (Errors initializing an object of RootObj with the C++ backend) ↵flywind2021-10-311-1/+2
| | | | | | | | | | | | | [backport] (#18836) * fix #18410 * one line comment * typo * typo * cover cpp
* Removes deprecated {.injectStmt.}. Fixes #18666 (#18984)Dominik Picheta2021-10-131-3/+0
|
* this ensures libp2p continues to compile [backport] (#18908)Andreas Rumpf2021-09-271-3/+8
|
* more minor bootstrapping cleanups (#18759)Miran2021-08-281-1/+0
|
* properly fix #10053 ; `FieldDefect` msg now shows discriminant value + ↵Timothee Cour2021-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lineinfo, in all backends (c,vm,js) (#11955) * fix #10053 FieldError for vm * fixup * FieldError now also shows runtime value of discriminant * fix field error reporting in vm * also report culprit line info in err msg * fix errors for newruntime 2 * fix for js * fixup * PRTEMP4 * works * works * works perfect * refactor * std/private/repr_impl * suppport --gc:arc * cleanup * refactor * simplify * simplify * simplify * fixup * move out compiler.vmgen.genCustom * fixup * fixup * add tests * revert compiler/debugutils.nim * simplify reprDiscriminant * fixup * lib/std/private/repr_impl.nim -> lib/system/repr_impl.nim * try to fix D20210812T165220 * honor --declaredlocs * control toFileLineCol via --declaredlocs
* followup #18362: make `UnusedImport` work robustly (#18366)Timothee Cour2021-06-271-2/+0
| | | | * warnDuplicateModuleImport => hintDuplicateModuleImport * improve DuplicateModuleImport msg, add test
* Genode platform fixes (#17521)Emery Hemingway2021-04-091-1/+1
| | | | | | | | | | | | | | | | | | | * Genode: move dyncall failures to runtime Do not use the "error" pragma to warn that dynamic library loading is not implemented, print a message at runtime and exit. * Genode: use stricter dataspace type in page allocator * Genode: remove compiler configuration from nim.cfg Self-hosting Nim is not supported on Genode and defining the cross-compilation environment can be done externally. * Genode: use new mutex API * Genode: call nim_component_construct as a C procedure * Genode: implement echo for NimStringV2
* added a 'koch ic' command for easier adhoc testing of IC (#17508)Andreas Rumpf2021-03-261-0/+30
| | | | | | * added a 'koch ic' command for easier adhoc testing of IC * IC: progress * IC: enable generics test * make tests green
* IC: green tests (#17311)Andreas Rumpf2021-03-191-74/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* fixes #11225; generic sandwich problems; [backport:1.2] (#17255)Andreas Rumpf2021-03-091-1/+2
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* attempt to fix #16374 (#17232)flywind2021-03-021-1/+6
| | | | | | | | | * remove unnecessary when statement * remove outdated codes * attempt to fix #16374 * fix
* fixes #17085 [backport:1.2] (#17101)Andreas Rumpf2021-02-191-1/+1
|
* IC: bugfixes (WIP) (#16836)Andreas Rumpf2021-02-021-1/+3
| | | | | | | | * minor improvements * IC: added the required logic for compilerProcs * LazySym ftw * we need this testing logic * reimplement the old way we use for module package creation * fixes a regression; don't pick module names if you can avoid it
* IC: next steps (#16729)Andreas Rumpf2021-01-231-56/+30
| | | | | | | | | | | * IC: dead code elimination pass * preparations for a different codegen strategy * added documentation to the newly written code * IC: backend code * IC: backend adjustments * optimized the compiler a bit * IC: yet another massive refactoring * fixes regressions * cleanups
* fix #16265; fix #13999 (HCR on OSX); cgen now does not line wrap string ↵Timothee Cour2020-12-141-0/+3
| | | | | | | | | | | | | | | | | litterals (#16329) * fix #16265: cgen now does not line wrap string litterals which, in combination with other hacks, caused a really obscure looking bug * fix #13999; nimhcr_integration.nim now works for osx * try to make appveyor CI disappear * disable openbsd + add diagnostic for openbsd * enable for openbsd * PTEMP * re-disable openbsd
* fixes #16249 [backport:1.4] (#16251)Andreas Rumpf2020-12-051-1/+1
|
* cmdline: improve command processing (#16056)Timothee Cour2020-11-261-1/+1
|
* fixes https://github.com/status-im/nimbus-eth2/issues/1549 (#16146)Andreas Rumpf2020-11-261-0/+8
| | | | | * fixes https://github.com/status-im/nimbus-eth2/issues/1549 [backport:1.4] * test fixup
* fixes #15942 [backport:1.2] [backport:1.4] (#16051)Andreas Rumpf2020-11-191-1/+1
|
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-5/+6
| | | | | | | | | | | | | | | | | * refactoring: idents don't need inheritance * refactoring: adding an IdGenerator (part 1) * refactoring: adding an IdGenerator (part 2) * refactoring: adding an IdGenerator (part 3) * refactoring: adding an IdGenerator (part 4) * refactoring: adding an IdGenerator (part 5) * refactoring: adding an IdGenerator (part 5) * IdGenerator must be a ref type; hello world works again * make bootstrapping work again * progress: add back the 'exactReplica' ideas * added back the missing exactReplica hacks * make tcompilerapi work again * make important packages green * attempt to fix the build for 32 bit machines (probably need a better solution here)
* make cgen header consistent with jsgen header (#15682)Timothee Cour2020-10-231-16/+9
|
* fix cgen header copyright (#15649)Timothee Cour2020-10-211-3/+1
| | | | * remove copyright Andreas Rumpf from cgen files
* const view types; fixes some cases from ↵Andreas Rumpf2020-10-051-1/+2
| | | | https://github.com/nim-lang/Nim/issues/15428 (#15488)
* .noalias annotation; frontend support (#15419)Andreas Rumpf2020-09-281-0/+3
| | | | | * .noalias annotation; frontend support * added .noalias support to Nim; implements https://github.com/nim-lang/RFCs/issues/204
* allow old styled RTTI for arc/orc (#15331)Andreas Rumpf2020-09-161-3/+6
|
* borrow checking (#15282)Andreas Rumpf2020-09-091-25/+31
| | | | | | | | | | | * refactoring: move procs to typeallowed.nim * frontend preparations for first class openArray support * prepare the code generator for first class openArray * code generation for first class openArray; WIP * code generation for open arrays, progress * added isViewType proc * preparations for borrow checking * added borrow checking to the front end
* Big compiler Cleanup (#14777)Clyybber2020-08-281-1/+1
|
* scoped memory management (#14790)Andreas Rumpf2020-07-041-1/+5
| | | | | | | * fixes the regressions * closes #13936 * scope based memory management implemented * enabled tcontrolflow.nim test case * final cleanups