summary refs log tree commit diff stats
path: root/compiler/cgen.nim
Commit message (Collapse)AuthorAgeFilesLines
* NIR: progress (#22817)Andreas Rumpf2023-10-121-1/+1
| | | | | | Done: - [x] Implement conversions to openArray/varargs. - [x] Implement index/range checking.
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-111-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* `constructor` now uses `result` instead of `this` (#22724)Juan M Gómez2023-09-191-5/+1
|
* implements RFC: [C++] Constructors as default initializers (#22694)Juan M Gómez2023-09-141-4/+8
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* produce better code for object constructions and 'result' [backport] (#22668)Andreas Rumpf2023-09-111-6/+16
|
* fixes #22680 Nim zero clear an object inherits C++ imported class when a ↵Juan M Gómez2023-09-111-3/+10
| | | | proc return it (#22684)
* fixes #22669 constructor pragma doesnt init Nim default fields (#22670)Juan M Gómez2023-09-101-0/+5
| | | | | | | fixes #22669 constructor pragma doesnt init Nim default fields --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22679 Nim zero clear an object contains C++ imported class when a ↵Juan M Gómez2023-09-101-3/+4
| | | | proc return it (#22681)
* Fix #22366 by making nimlf_/nimln_ part of the same line (#22503)Alberto Torres2023-08-181-2/+2
| | | Fix #22366 by making nimlf_/nimln_ part of the same line so the debugger doesn't advance to the next line before executing it
* fixes #22469; generates nimTestErrorFlag for top level statements (#22472)ringabout2023-08-141-2/+2
| | | fixes #22469; generates `nimTestErrorFlag` for top level statements
* `initNodeTable` and friends now return (#22444)ringabout2023-08-111-1/+1
|
* `getTemp` and friends now return `TLoc` as requested (#22440)ringabout2023-08-101-3/+3
| | | getTemp and friends now return `TLoc`
* `initLocExpr` and friends now return `TLoc` (#22434)ringabout2023-08-101-21/+14
| | | `initLocExpr` and friends now return TLoc
* makes asmnostackframe work with cpp member #22411 (#22429)Juan M Gómez2023-08-091-3/+4
|
* fix #22287 nimlf_ undefined error (#22382)Bung2023-08-081-0/+1
|
* use out parameters for getTemp (#22399)ringabout2023-08-071-18/+10
|
* [C++] Member pragma RFC (https://github.com/nim-lang/RFCs/issues/530) (#22272)Juan M Gómez2023-08-071-2/+2
| | | | | | | | | | * [C++] Member pragma RFC #530 rebase devel * changes the test so `echo` is not used before Nim is init * rebase devel * fixes Error: use explicit initialization of X for clarity [Uninit]
* use strictdefs for compiler (#22365)ringabout2023-08-061-9/+18
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* fixes #22321; fixes building DLL with --noMain still produces a DllMain (#22323)ringabout2023-07-241-1/+1
| | | | | * fixes #22321; Building DLL with --noMain produces an unexpected DllMain on devel branch * remove implicit nomain
* Expands codegenDecl to work in function params. fixes #22306 (#22307)Juan M Gómez2023-07-231-2/+2
| | | | | | | * Expands codegenDecl to work in function params. fixes #22306 * makes the test more concrete so T{lit} params dont match * adds sfCodegenDecl
* implemented 'push quirky' switch for fine grained control over the ex… ↵Andreas Rumpf2023-07-231-5/+5
| | | | | | | (#22318) * implemented 'push quirky' switch for fine grained control over the exception handling overhead * documentation
* adds nimbasePattern compiler option (#22144)Juan M Gómez2023-06-241-1/+3
| | | adds optonal --nimbasepattern
* Implements: [C++] constructor pragma improvement (fix #21921) (#21916)Juan M Gómez2023-05-301-7/+9
| | | | | | | | | | | | | | | * implements: [C++] constructor pragma improvement (fix #21921) t * fix test so it doesnt use echo in globals * Update compiler/ccgtypes.nim * Update lib/std/private/dragonbox.nim --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* simple micro-optimizations of ropes' runtime-formatting (#21962)heterodoxic2023-05-301-7/+3
|
* hot code reloading: fix regression? and PreMain with arc/orc (#21940)metagn2023-05-301-6/+9
| | | | | * fix PreMain for hot code reloading with arc/orc * fix regression? actually test nimhcr_basic
* prevent spamming of thread local forward declarations in C/C++ output (#21955)heterodoxic2023-05-291-1/+1
|
* fix & add test for basic hot code reloading case (#21915)metagn2023-05-261-1/+4
| | | fixes #21885
* fix #21501 by making --app:lib and --app:staticLib imply --noMain (#21910)heterodoxic2023-05-261-7/+5
|
* actually fixes #21889 "constructor pragma doing nothing in globals" (#21897)Juan M Gómez2023-05-241-2/+15
| | | actually fixes #21889
* small refactor in preparation to fix #21889 (#21892)Juan M Gómez2023-05-231-17/+23
|
* implements allow byref to work in params #21873 (#21875)Juan M Gómez2023-05-211-15/+15
|
* refactor gettypedesc so it accepts its own kind instead of symkind (#21867)Juan M Gómez2023-05-191-22/+22
|
* Cpp Vfunctions draft (#21790)Juan M Gómez2023-05-171-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * introduces virtual pragma, modifies proc def, prevents proc decl * marks virtual procs as infix * forward declare vfuncs inside the typedef * adds naked callConv to virtual * virtual proc error if not defined in the same top level scope as the type * first param is now this. extracts genvirtualheaderproc * WIP syntax * supports obj. Removes the need for the prefix * parameter count starts as this. Cleanup * clean up * sem tests * adds integration tests * uses constraint to store the virtual content * introduces genVirtualProcParams --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* ignore inline hint for dynlib procs in codegen [backport] (#21817)metagn2023-05-091-14/+14
|
* adds an experimental `mm:atomicArc` switch (#21798)ringabout2023-05-081-4/+4
|
* amends #21690 to fix broken Nim to C++ source line mappings (#21784)heterodoxic2023-05-041-32/+36
| | | resync fork
* improve C/C++ debug output readability (1/N) (#21690)heterodoxic2023-04-281-35/+62
| | | | | * hacky attempt to reconcile default explicit constructors with enforcement of brace initialization, instead of memsetting imported objects to 0 * improve C/C++ debug output readability (1/N)
* fixes #21632; enforce deref for `wasMoved` in ORC (#21647)ringabout2023-04-121-4/+4
| | | fixes #21632; enforce deref for `wasMoved`
* fixes #21617; createTypeBoundOps with PContext in order to instantiate ↵ringabout2023-04-071-4/+3
| | | | | | | generics (#21619) * fixes #21617; createTypeBoundOps with PContext in order to instantiate generics * keep idgen
* fixes #21592; create type bound operations for calls in the method ↵ringabout2023-04-011-1/+1
| | | | | | | dispatcher for ORC (#21594) * fixes #21592; create type operations for the method dispatcher * add a test case
* fixes #21505 (overload resolution of explicit constructors for imported C++ ↵heterodoxic2023-03-271-4/+17
| | | | | types) (#21511) hacky attempt to reconcile default explicit constructors with enforcement of brace initialization, instead of memsetting imported objects to 0
* Optimize `cgen.addIndent` (#21508)Amjad Ben Hedhili2023-03-131-2/+6
| | | | | * Optimize `cgen.addIndent` * Avoid temporaries
* Add line directives for C code variables (#21466)Joey2023-03-051-2/+6
| | | | | * Add line directives for C code variables * Refactor genCLineDir to only use toFullPath if necessary
* remove nosinks hacks from compiler (#21469)ringabout2023-03-041-1/+1
|
* replaces implicit passes array registed at runtime with explicit function ↵ringabout2023-03-031-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | calls; simplify compilation pipeline (#21444) * abolish using passes in the compiler; simplify compilation pipeline * duplicate code * Really cool to have the same signature... * haul * unify other backends * refactor process * introduce PipelinePhase * refactor compiler * fixes passes * fixes nimsuggest * add a sentinel * enable docs checkj * activate doc testing * clean up * complete cleanups
* fixes #20139; hash types based on its path relative to its package path ↵ringabout2023-03-021-1/+1
| | | | | | | | | | | | | | | (#21274) [backport:1.6] * fixes #20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* suggestion for a simple fix for #21279 (#21378)heterodoxic2023-03-011-3/+9
|
* fixes #19795; fixes #11852; fixes #19974; remove parsing pipeline, Nim now ↵ringabout2023-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parses the whole module at one time (#21379) * fixes #19795; remove parse pipeline * isScript * fixes nimscriptapi * don't touch reorder * check script * fixes tests * it seems implicit imports of system cause troubles * access the first child of `nkStmtList` * ignore comments * minor messages * perhaps increases hloLoopDetector * the module is a stmtList, which changes the errors * fixes nimdoc * fixes tlinter * fixes nim secret tests * fixes arc_misc * fixes nim secret tests again * safe; fixes one more test * GlobalError is the root cause too * fixes parsing errors * put emit types to the cfsForwardTypes section * fixes #11852; `{.push checks:off}` now works in procs * disable navigator * fixes nimdoc * add tests for JS * fixes nimsuggest
* 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