Commit Graph

1203 Commits

Author SHA1 Message Date
lit
a88b275bc3 doc(format): system.nim: doc of hostCPU for loongarch64 (#23621)
In doc, `loongarch64` used to be written as `'"loongarch64"'`

since it's [supported](https://github.com/nim-lang/Nim/pull/19223)

(cherry picked from commit b3b26b2e56)
2024-05-23 13:55:24 +02:00
ringabout
e3f4c3d417 fixes #23524; global variables cannot be analysed when injecting move (#23529)
fixes #23524

```nim
proc isAnalysableFieldAccess*(orig: PNode; owner: PSym): bool =
  ...
  result = n.kind == nkSym and n.sym.owner == owner and
    {sfGlobal, sfThread, sfCursor} * n.sym.flags == {} and
    (n.sym.kind != skParam or isSinkParam(n.sym))
```
In `isAnalysableFieldAccess`, globals, cursors are already rejected

(cherry picked from commit cd3cf3a20e)
2024-05-22 09:23:43 +02:00
narimiran
33817f2c30 Revert "fixes #22923; fixes =dup issues (#23182)"
This reverts commit fbb9ce4d5c.
2024-04-23 06:57:09 +02:00
ringabout
45f1b19942 clean up goto exceptions; remove the setjmp.h dep (#23259)
(cherry picked from commit e3350cbe6f)
2024-04-22 08:53:03 +02:00
ringabout
2c964268f8 fixes #23223; prevents insert self-assignment (#23225)
fixes #23223

(cherry picked from commit 3379d26629)
2024-04-20 09:44:30 +02:00
ringabout
fbb9ce4d5c fixes #22923; fixes =dup issues (#23182)
fixes #22923

(cherry picked from commit 29ac3c9986)
2024-04-20 09:44:29 +02:00
Jacek Sieka
71dde8f7cf reserve sysFatal for Defect (#22158)
Per manual, `panics:on` affects _only_ `Defect`:s - thus `sysFatal`
should not redirect any other exceptions.

Also, when `sysFatal` is used in `nimPanics` mode, it should use regular
exception handling pipeline to ensure exception hooks are called
consistently for all raised defects.

(cherry picked from commit 58c44312af)
2024-04-18 10:30:26 +02:00
ringabout
bd829c093d fixes #22883; replace default(typeof( with reset; suppress `Unsaf… (#22895)
fixes #22883

…eDefault` warnings

avoid issues mentioned by https://forum.nim-lang.org namely, it
allocated unnecessary stack objects in the loop

```c
while (1)
{
tyObject_N__8DSNqSGSHBKOhI8CqSgAow T5_;
nimZeroMem((void *)(&T5_), sizeof(tyObject_N__8DSNqSGSHBKOhI8CqSgAow));
eqsink___test4954_u450((&(*t_p0).data.p->data[i].Field1), T5_);
}
```

It might be more efficient in some cases

follow up https://github.com/nim-lang/Nim/pull/21821

(cherry picked from commit 92141e82ed)
2024-04-18 10:29:59 +02:00
ringabout
adf3e3ceb5 fixes incorrect cint overflow in system (#22718)
fixes #22700

(cherry picked from commit 63c2ea5566)
2024-04-18 08:59:28 +02:00
Amjad Ben Hedhili
12f2c36aca Make newSeqOfCap not initialize memory. (#21842)
It's used in `newSeqUninitialized`.

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
(cherry picked from commit 8853fb0775)
2024-04-17 15:53:16 +02:00
ringabout
09109c55c9 clean up gc:arc or gc:orc in docs and in error messages (#22408)
* clean up gc:arc/orc in docs

* in error messages

(cherry picked from commit 10a6e4c236)
2024-04-17 10:54:56 +02:00
konsumlamm
526dbf0cf2 Make repr(HSlice) always available (#22332)
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
(cherry picked from commit d37b620757)
2024-04-17 09:34:31 +02:00
Amjad Ben Hedhili
ef8b8317ff Fix capacity for const and shallow [backport] (#22705)
(cherry picked from commit b542be1e7d)
2023-12-14 17:47:00 +01:00
ringabout
f0f3904ff0 implement ensureMove (#22339)
* 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
2023-07-29 10:57:03 +02:00
ringabout
11c8dfc9b3 fixes docs (#22331) 2023-07-26 10:04:34 +08:00
ringabout
7d9fe106ec fixes #22268; fixes move codegen (#22288) 2023-07-19 12:57:58 +02:00
Juan Carlos
db1ce4ff12 Fix #22273 (#22275)
* Fix #22273
2023-07-14 12:40:57 +02:00
ringabout
1ad618d96c clean up the documentation (#22196) 2023-07-02 22:36:05 +02:00
ringabout
e422b3c860 adds =destroy T support for strings and seqs (#22167)
* adds =destroy T support for strings and seqs

* fixes system

* fixes tests
2023-06-27 13:07:29 +02:00
ringabout
4546f5dfe5 adds T destructor for refs (#22147)
* adds T destructor for refs

* add `newRefdestructor`

* adds ref overload for destructors

* fixes config
2023-06-26 15:10:06 +02:00
ringabout
f524d60fa1 fixes #22123; Compiler bug with default initializer values and arrays (#22128) 2023-06-20 08:02:06 +02:00
ringabout
64b27edd3a make move use =wasMoved internally (#22032)
* make `move` use `=wasMoved` internally

* fixes tests

* fixes spawn finally

* fixes views

* rename to internalMove

* add a test case
2023-06-09 15:53:12 +02:00
ringabout
0f3d6b5a52 small fixes for atomicArc (#22017)
* small fixes for atomicArc

* Update lib/system/arc.nim
2023-06-06 21:22:07 +02:00
ringabout
1133f20fe2 lift the =dup hook (#21903)
* fixes tests again
* remove helper functions
* fixes closures, owned refs
* final cleanup
2023-06-02 16:03:32 +02:00
ringabout
ddce555998 improve wasMoved hooks; allow reset to use the overridden wasMoved hook (#21831)
* improve `wasMoved` hooks

* Because `wasMoved` is lifted
2023-05-12 15:24:14 +02:00
ringabout
3b9999b93c adds documentation for =wasMoved and =dup hooks and small fixes (#21827)
* adds documentation for `=wasMoved` and `=dup` hooks and small fixes

* Update doc/destructors.md

* Update doc/destructors.md

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-05-11 19:38:27 +08:00
ringabout
055a00a6ef make reset use the =destroy and wasMoved pair (#21821)
* make reset use the `=destroy` and `waMoved` pair

* fixes a space

* fixes `shrink` instead

* tiny fix

* fixes vm

* suppress the annotations since it breaks some important packages
2023-05-11 09:02:29 +02:00
ringabout
b562e1e6d8 implement =dup hook eliminating wasMoved and =copy pairs (#21586)
* import `=dup` hook eliminating `wasMoved` and `=copy` pairs

* add dup

* add a test for dup

* fixes documentation

* fixes signature

* resolve comments

* fixes tests

* fixes tests

* clean up
2023-05-06 21:36:57 +02:00
metagn
380dafcc32 fix iterator equality + add test for proc equality + fix sameType (#21707)
* fix iterator equality + add test also for procs

fixes #21706

* all targets

* and isNil and repr

* separate overloads, fix sameType

* more restricted sameType?

* merge overloads again??

* remove sametype change for now

* fix sameType anyway (CI failure was not related)

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2023-04-23 17:43:59 +08:00
metagn
1bb117cd7a proc typeclass accounts for iterator, call conventions + nil fix + document typeclass AST (#21629)
* test fix #16546 #16548 + another issue

* please don't tell me other packages do this

* fix CI + test typeclass callconv pragma

* better logic in parser

* docs and changelog
2023-04-11 09:23:41 +02:00
Tomohiro
6ec9c7f683 Fix example code of proc add*[T](x: var seq[T], y: sink openArray[T]) (#21607)
* Fix example code in system.nim

* Add example code to lib/system.nim

* Fix compile error

* Fix example code that can be unsafe
2023-04-03 05:15:14 +02:00
Century Systems
3b9e9fd7b2 Add support for NuttX RTOS. (#21372)
* Add support for NuttX RTOS.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

* lib: pure: asyncdispatch: assign to result.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

* lib: std: typedthreads: add support for parameters to adjust Thread Stack Size.

Like FreeRTOS/Zephyr, add support for following configurations.

  -d:nimThreadStackSize=xxxxx
  -d:nimThreadStackGuard=yyyy

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

---------

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
2023-02-16 13:47:52 +01:00
ringabout
ebd1c678be fixes #21195; std/assertions continue to use sysFatal when nimPreviewSlimSystem is not defined (#21196)
* fixes #21195; `std/assertions` continue to use `sysFatal`

* try includes

* make `std/assertions` self-contained

* fixes tests

* fixes tests
2022-12-29 14:15:08 -05:00
ringabout
f7c203fb6c remove legacy code (#21134)
* remove legacy code

* fixes
2022-12-26 13:20:05 +01:00
metagn
37daed3897 remove misleading slimsystem deprecated warnings (#21156)
refs #20967
2022-12-22 09:54:41 +01:00
Xavier Noria
e4aadcf1c1 Document that system:pop() may raise IndexDefect (#21070)
* Document system:pop() may raise IndexDefect

* Add backticks to KeyError
2022-12-13 08:47:01 +01:00
Andreas Rumpf
3812d91390 alternative, much simpler algorithm for strict func checking (#21066)
* alternative, much simpler algorithm for strict func checking

* forgot to git add new compiler module

* new spec is incredibly simple to describe

* fixes bigints regression

* typos

* closes #16305; closes #17387; closes #20863
2022-12-11 16:58:50 +01:00
ringabout
55373e65b4 unpublic arrayWith and rename it to nimArrayWith (#21006)
* unpublic arrayWith

* unindent
2022-12-04 15:39:14 +08:00
Bung
658b28dc57 tyInt tyUint fit target int bit width (#20829) 2022-12-01 13:34:00 +01:00
ringabout
09b7f90475 move system/atomics out of system; std/atomics should be preferred (#20875)
* move `system/atomics` out of system; `std/atomics` should be preferred

* add deprecation message

* fixes

* fixes

* fixes

* fixes more tests
2022-11-22 20:39:30 +01:00
Tanguy
19cc494b80 echo: only lock when threading is enabled (#20890) 2022-11-21 14:56:54 -05:00
ringabout
bce1f35f87 fixes strict effects (#20885)
* fixes strict effects

* remove nosideeffect

* Update lib/system/comparisons.nim
2022-11-21 14:55:13 -05:00
ringabout
e03a178bff rename std/threads to std/typedthreads (#20850)
* rename `std/threads` to `std/oldthreads`

* fixes tests

* rename to `typedthreads`

* changelog
2022-11-16 16:35:20 +01:00
ringabout
06cd15663d fixes ptr to cstring warnings[backport] (#20848)
* fix =#13790 ptr char (+friends) should not implicitly convert to cstring

* Apply suggestions from code review

* first round; compiles on windows

* nimPreviewSlimSystem

* conversion is unsafe, cast needed

* fixes more tests

* fixes asyncnet

* another try another error

* last one

* true

* one more

* why bugs didn't show at once

* add `nimPreviewCstringConversion` switch

* typo

* fixes ptr to cstring warnings[backport]

* add fixes

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
2022-11-16 10:22:51 +01:00
ringabout
f11b7debf7 remove name field for ARC (#20797)
* remove name field for ARC

* mistake

* improvement

* better

* typo

* fixes a pre-existing bug
2022-11-09 16:22:55 +01:00
ringabout
7d15fdd375 implements display based subtype checking (6.4x faster without threads; 2.8x 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>
2022-11-08 13:08:01 +01:00
ringabout
66b0c843c3 fixes #20694; the exit function now takes cint type (#20775) 2022-11-07 12:17:52 +01:00
Ico Doornekamp
0b4f502393 Export trace member of exception type to allow custom stack trace entries (#20772)
Added insertStackTraceEntry() proc to allow custom stack trace entries
2022-11-07 12:17:00 +01:00
ringabout
fc8bfd781a fixes pre-existing quit documentation regression [backport] (#20763)
fixes pre-existing `quit` documentation regression
2022-11-06 11:50:10 +01:00
ringabout
d5cc2085ea ref #20694; quit value gets saturated to ranges (#20753)
* quit value gets saturated to ranges

* add documentation

* minimal changes

* refactor

* small fix

* add documentation

* fixes

* Update lib/system.nim

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
2022-11-05 10:58:57 +01:00