summary refs log tree commit diff stats
path: root/compiler/ccgexprs.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes #23858; 2.2.0 rc1 regression with cdecl functions (#23859)ringabout2024-07-181-1/+2
| | | | | | fixes #23858 We should not assign fields to fields for returns of function calls because calls might have side effects.
* refactor: The popular 'r' field is now named 'snippet' (#23829)Andreas Rumpf2024-07-121-91/+91
|
* fixes #20865; fixes #20987; Missing bounds check in array slicing (#23814)ringabout2024-07-101-3/+3
| | | | fixes #20865 fixes #20987
* [backport] fixes #23748; do not skip materializing temporaries for proc ↵Alexander Kernozhitsky2024-06-301-0/+2
| | | | | arguments (#23769) fixes #23748
* fixes #23759; rework move for refc (#23764)ringabout2024-06-291-3/+8
| | | fixes #23759
* ref #20653; fixes chronos empty case branches (#23706)ringabout2024-06-141-7/+11
| | | | | | | | | | | | | | | ref #20653 ```nim Error* = object case kind*: ErrorType of ErrorA: discard of ErrorB: discard ``` For an object variants without fields, it shouldn't generate empty brackets for default values since there are no fields at all in case branches.
* fixes #23627; Simple destructor code gives invalid C (#23631)ringabout2024-05-211-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | fixes #23627 ```nim type TestObj = object of RootObj TestTestObj = object of RootObj testo: TestObj proc `=destroy`(x: TestTestObj) = echo "Destructor for TestTestObj" proc testCaseT() = echo "\nTest Case T" let tt1 {.used.} = TestTestObj(testo: TestObj()) ``` When generating const object fields, it's likely that we need to generate type infos for the object, which may be an object with custom hooks. We need to generate potential consts in the hooks first. https://github.com/nim-lang/Nim/pull/20433 changed the semantics of initialization. It should evaluate`BracedInit` first.
* fixes #16671; openarray conversion for object construction (#23618)ringabout2024-05-161-3/+7
| | | | | fixes #16671 related to https://github.com/nim-lang/Nim/pull/18911
* rework `wasMoved`, `move` on the JS backend (#23577)ringabout2024-05-081-9/+0
| | | | | `reset`, `wasMoved` and `move` doesn't support primitive types, which generate `null` for these types. It is now produce `x = default(...)` in the backend. Ideally it should be done by ast2ir in the future
* remove unused magics: mIntToStr, mInt64ToStr, mFloatToStr (#23486)ringabout2024-04-091-7/+0
| | | mIntToStr, mInt64ToStr, mFloatToStr,
* fixes #23422; card regression (#23437)ringabout2024-03-281-1/+1
| | | | | | | | | fixes #23422 ref https://github.com/nim-lang/Nim/issues/20997 https://github.com/nim-lang/Nim/pull/21165 The function `cardSet` is used for large sets that are stored in the form of arrays. It shouldn't be passed as a pointer
* fixes #12703; nim cpp rejects valid code would lose const qualifier for ↵ringabout2024-03-051-4/+15
| | | | | | cstring to string via cstrToNimstr (#23371) fixes #12703 ref #19588
* fixes regression #23280; Operations on inline toOpenArray len return a wrong ↵ringabout2024-02-061-3/+3
| | | | | result (#23285) fixes #23280
* fixes #22597; avoid side effects for call returning openArray types (#23257)ringabout2024-01-261-4/+11
| | | | | | | | | | | | | | fixes #22597 ```nim proc autoToOpenArray*[T](s: Slice[T]): openArray[T] = echo "here twice" result = toOpenArray(s.p, s.first, s.last) ``` For functions returning openarray types, `fixupCall` creates a temporary variable to store the return value: `let tmp = autoToOpenArray()`. But `genOpenArrayConv` cannot handle openarray assignements with side effects. It should have stored the right part of the assignment first instead of calling the right part twice.
* fixes #22923; fixes `=dup` issues (#23182)ringabout2024-01-111-0/+2
| | | fixes #22923
* type refactor: part 4 (#23077)Andreas Rumpf2023-12-151-6/+5
|
* fixes yet another strictdefs bug (#23069)ringabout2023-12-151-4/+5
|
* type refactoring: part 2 (#23059)Andreas Rumpf2023-12-131-2/+2
|
* Types: Refactorings; step 1 (#23055)Andreas Rumpf2023-12-121-24/+25
|
* C++: ptr fields now pulls the whole type if it's a member in nkDotExpr (#22855)Juan M Gómez2023-10-231-0/+6
|
* NIR: progress (#22817)Andreas Rumpf2023-10-121-3/+0
| | | | | | Done: - [x] Implement conversions to openArray/varargs. - [x] Implement index/range checking.
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-111-33/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* produce better code for object constructions and 'result' [backport] (#22668)Andreas Rumpf2023-09-111-2/+6
|
* fixes #22669 constructor pragma doesnt init Nim default fields (#22670)Juan M Gómez2023-09-101-19/+25
| | | | | | | fixes #22669 constructor pragma doesnt init Nim default fields --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Make `newSeqOfCap` not initialize memory. (#21842)Amjad Ben Hedhili2023-09-091-1/+1
| | | | | | | It's used in `newSeqUninitialized`. --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* fixes #17197; fixes #22560; fixes the dest of newSeqOfCap in refc (#22594)ringabout2023-08-311-0/+1
|
* fixes an issue where sometimes wasMoved produced bad codegen for cpp (#22587)Juan M Gómez2023-08-301-1/+4
|
* 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
* fixes move sideeffects issues [backport] (#22439)ringabout2023-08-101-3/+15
| | | | | | | * fixes move sideeffects issues [backport] * fix openarray * fixes openarray
* `getTemp` and friends now return `TLoc` as requested (#22440)ringabout2023-08-101-37/+29
| | | getTemp and friends now return `TLoc`
* `initLocExpr` and friends now return `TLoc` (#22434)ringabout2023-08-101-235/+164
| | | `initLocExpr` and friends now return TLoc
* simplify isAtom condition (#22430)ringabout2023-08-091-4/+1
|
* clean up `gc:arc` or `gc:orc` in docs and in error messages (#22408)ringabout2023-08-081-1/+1
| | | | | * clean up gc:arc/orc in docs * in error messages
* use out parameters for getTemp (#22399)ringabout2023-08-071-11/+17
|
* use strictdefs for compiler (#22365)ringabout2023-08-061-105/+116
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* Revert "fix #22173 `sink` paramers not moved into closure (refc) (#22… ↵Bung2023-08-031-9/+6
| | | | | | | (#22376) Revert "fix #22173 `sink` paramers not moved into closure (refc) (#22359)" This reverts commit b40da812f7aa590ed16df54a492684c228320549.
* fix #22173 `sink` paramers not moved into closure (refc) (#22359)Bung2023-08-021-6/+9
| | | | | * use genRefAssign when assign to sink string * add test case
* implement `ensureMove` (#22339)ringabout2023-07-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * implement `ensureMove` * use an additional flag * improve some logics * progress: fixes discard ensureMove * forbids nested expressions * improve error messages * checkpoint * fixes cursor * ADD MORE TESTS * fixes cursorinference again * tiny cleanup * improve error messages * fixes docs * implement comments add more tests * fixes js
* fixes #22268; fixes `move` codegen (#22288)ringabout2023-07-191-0/+7
|
* fixes #22175 (#22229)Andreas Rumpf2023-07-061-2/+5
|
* alternative to #22219; adds a pointer wrapper for T destructor (#22225)ringabout2023-07-061-4/+0
| | | | | | | | | | | | | | | * alternative to #22219; adds a pointer wrapper for T destructor * clean up and add comments * Update compiler/ccgtypes.nim * tidy up * fixes comments * fixes cpp * fixes cpp
* fixes #19101; zero initialization union casts (#22185)ringabout2023-06-291-2/+9
| | | | | | | * zero initialization union casts * cleans up and adds a test case for #19101 * uses nimZeroMem
* fixes #16331; aliasing of tuple construction within a single assignme… ↵Andreas Rumpf2023-06-161-3/+18
| | | | | | | (#22113) * fixes #16331; aliasing of tuple construction within a single assignment, great coding style * added test case
* fixes explicit deref block (#22093)ringabout2023-06-151-2/+0
| | | fixes explicit deref
* make `move` use `=wasMoved` internally (#22032)ringabout2023-06-091-1/+2
| | | | | | | | | | | | | * make `move` use `=wasMoved` internally * fixes tests * fixes spawn finally * fixes views * rename to internalMove * add a test case
* lift the `=dup` hook (#21903)ringabout2023-06-021-10/+0
| | | | | | * fixes tests again * remove helper functions * fixes closures, owned refs * final cleanup
* fixes fieldDefect loses enum type info in ORC; consistent with VM and refc ↵ringabout2023-05-291-10/+13
| | | | | (#21954) fixes fieldDefect loses enum type info in ORC
* fixes #15428 by updating deep open array copy codegen (#21935)heterodoxic2023-05-271-2/+3
| | | | | * fix #15428 * add test
* fix #10964 by honoring pointer deref syntax if a reified openarray is used ↵heterodoxic2023-05-271-2/+11
| | | | | | | to get an array's length (#21925) * fix #10964 * add test
* implements allow byref to work in params #21873 (#21875)Juan M Gómez2023-05-211-7/+7
|