summary refs log tree commit diff stats
path: root/compiler/ccgstmts.nim
Commit message (Collapse)AuthorAgeFilesLines
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* C++ Adds support for default arg using object construction syntax. Fixes a ↵Juan M Gómez2023-09-281-1/+6
| | | | | | | | | | compiler crash (#22768) `Foo()` below makes the compiler crash. ```nim proc makeBoo(a:cint = 10, b:cstring = "hello", foo: Foo = Foo()): Boo {.importcpp, constructor.} ```
* fixes #22246; generate __builtin_unreachable hints for case defaults (#22737)ringabout2023-09-211-2/+5
| | | | fixes #22246 resurrects #22350
* implements RFC: [C++] Constructors as default initializers (#22694)Juan M Gómez2023-09-141-6/+9
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* `getTemp` and friends now return `TLoc` as requested (#22440)ringabout2023-08-101-9/+8
| | | getTemp and friends now return `TLoc`
* `initLocExpr` and friends now return `TLoc` (#22434)ringabout2023-08-101-49/+34
| | | `initLocExpr` and friends now return TLoc
* use out parameters for getTemp (#22399)ringabout2023-08-071-1/+2
|
* use strictdefs for compiler (#22365)ringabout2023-08-061-26/+29
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* Revert "fixes #22246; generate `__builtin_unreachable` hints for case ↵ringabout2023-07-311-5/+2
| | | | | | | defaults" (#22351) Revert "fixes #22246; generate `__builtin_unreachable` hints for case defaults (#22350)" This reverts commit b56df5c07f7dc9ac9d718ca47c10b0683a9b916f.
* fixes #22246; generate `__builtin_unreachable` hints for case defaults (#22350)ringabout2023-07-311-2/+5
| | | | | | | | | * fixes #22246; generate `__builtin_unreachable` hints * use elif * indentation * fixes holy enums in sim
* implemented 'push quirky' switch for fine grained control over the ex… ↵Andreas Rumpf2023-07-231-3/+4
| | | | | | | (#22318) * implemented 'push quirky' switch for fine grained control over the exception handling overhead * documentation
* fixes #21995: align C++ with C backend behavior for empty raise state… ↵heterodoxic2023-06-071-5/+1
| | | | | | | (#21998) * fixes #21995: align C with C++ backend behavior for empty raise statements * make runtime behavior match across both C and C++ backend and all exception modes
* shallow fix for #21972, #18552 by moving std::exception_ptr to the parent ↵heterodoxic2023-06-041-3/+2
| | | | | sco… (#21988) shallow fix for #21972 by moving std::exception_ptr to the parent scope, minor cleanup
* Implements: [C++] constructor pragma improvement (fix #21921) (#21916)Juan M Gómez2023-05-301-8/+10
| | | | | | | | | | | | | | | * 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>
* actually fixes #21889 "constructor pragma doing nothing in globals" (#21897)Juan M Gómez2023-05-241-19/+29
| | | actually fixes #21889
* implements allow byref to work in params #21873 (#21875)Juan M Gómez2023-05-211-1/+1
|
* refactor gettypedesc so it accepts its own kind instead of symkind (#21867)Juan M Gómez2023-05-191-1/+1
|
* potential fix for C++ codegen with ARC/ORC and goto exceptions fixes #21579, ↵heterodoxic2023-05-191-1/+2
| | | | | fixes #21862 (#21868) potential fix for C++ codegen with ARC/ORC and goto exceptions
* amends #21690 to fix broken Nim to C++ source line mappings (#21784)heterodoxic2023-05-041-35/+32
| | | resync fork
* improve C/C++ debug output readability (1/N) (#21690)heterodoxic2023-04-281-36/+39
| | | | | * 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)
* warn on set types bigger than max size, default to 0..255 for int literals ↵metagn2023-04-171-1/+1
| | | | | | | | | | | | | | | | | | | (#21659) * test implicitly huge set types refs https://github.com/nim-lang/RFCs/issues/298 * oh my god * boot at least * don't error, fix remaining issues, no 2 len arrays * fix runnable example * test assuming 0..255 for int literal * test refactor, add changelog, test
* minor codegen bugfix (#21670)Andreas Rumpf2023-04-151-1/+1
|
* fix #18977; disallow change branch of an object variant in ORC (#21526)ringabout2023-03-161-1/+3
| | | | | | | | | | | * fix #18977 disallow change branch of an object variant in ORC * check errors for goto exception * fixes conditions * fixes tests * add a test case for #18977
* fixes #20139; hash types based on its path relative to its package path ↵ringabout2023-03-021-3/+3
| | | | | | | | | | | | | | | (#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>
* fixes #19795; fixes #11852; fixes #19974; remove parsing pipeline, Nim now ↵ringabout2023-02-221-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fixes #14444; add `genLineDir` before assignment (#21201)ringabout2022-12-291-0/+1
| | | | | | | * fixes #14444; add `genLineDir` before raises * add a test case * fixes differently
* implements display based subtype checking (6.4x faster without threads; 2.8x ↵ringabout2022-11-081-15/+18
| | | | | | | | faster with threads) (#20781) * WIP: fast 'of' operator based on the literature * implement display based subtype checking Co-authored-by: Araq <rumpf_a@web.de>
* no ropes WIP (#20433)Andreas Rumpf2022-09-271-91/+97
| | | | | | | | | | | | | * 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
* support cstring in `case` (#20130)metagn2022-09-011-9/+28
| | | | | | | | | | | | | | | * 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
* Fixed noinit pragma for closure variables (#20101)Yuriy Glukhov2022-07-281-1/+1
|
* Fixing `nimRawSetJmp` for vcc and clangcl on Windows (#19959)rockcavera2022-07-041-7/+12
| | | | | | | | | | | | | * fix vcc rawsetjmp * changing `_longjmp()` to `longjmp()` and `_setjmp()` to `setjmp()` * fix * fix setjmp to clangcl on Windows * fix genTrySetjmp() to clangcl on Windows
* remove noop option `gc:v2` (#19810)flywind2022-06-101-1/+1
| | | | | * remove noop option gc:v2 * changelog
* fix #19266; allow reassign discriminant field (#19567)flywind2022-02-251-1/+1
| | | | | * add inUncheckedAssignSection * add one more test
* nvro don't touch cdecl types [backport: 1.6] (#19461)flywind2022-01-281-7/+14
| | | * nvro don't touch cdecl types; fix #19342 again
* nimRawSetjmp: support Windows (#19197)Ștefan Talpalaru2021-12-101-1/+12
| | | | | | | | | | | | * nimRawSetjmp: support Windows Using `_setjmp()` directly is required to avoid some rare (but very annoying) exception-related stack corruption leading to segfaults on Windows, with Mingw-w64 and SEH. More details: https://github.com/status-im/nimbus-eth2/issues/3121 Also add "nimBuiltinSetjmp" - mostly for benchmarking. * fix for Apple's Clang++
* Removes deprecated {.injectStmt.}. Fixes #18666 (#18984)Dominik Picheta2021-10-131-5/+0
|
* fixes #17085 [backport:1.2] (#17101)Andreas Rumpf2021-02-191-2/+2
|
* IC: next steps (#16729)Andreas Rumpf2021-01-231-14/+15
| | | | | | | | | | | * 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
* continue #15456 add #pragma directives compiler support (#16472)flywind2021-01-041-6/+13
| | | | | * continue #15456 * follow the advice from juan_carlos
* fix #12640 (#15829)flywind2020-11-031-1/+7
|
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-2/+2
| | | | | | | | | | | | | | | | | * 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)
* const view types; fixes some cases from ↵Andreas Rumpf2020-10-051-2/+2
| | | | https://github.com/nim-lang/Nim/issues/15428 (#15488)
* allow old styled RTTI for arc/orc (#15331)Andreas Rumpf2020-09-161-4/+4
|
* borrow checking (#15282)Andreas Rumpf2020-09-091-1/+1
| | | | | | | | | | | * 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
|
* fixes #15026 [backport] (#15040)Andreas Rumpf2020-07-221-1/+1
| | | no test case since only a special case was affected and the special case got removed
* fixes #14925 (#14947)Andreas Rumpf2020-07-091-0/+4
|
* scoped memory management (#14790)Andreas Rumpf2020-07-041-8/+16
| | | | | | | * fixes the regressions * closes #13936 * scope based memory management implemented * enabled tcontrolflow.nim test case * final cleanups
* fixes #14240 [backport:1.2] (#14757)Andreas Rumpf2020-06-221-8/+9
|
* fix #14369 (#14386)cooldome2020-05-181-0/+1
| | | | | * fix #14369 * empty commit