summary refs log tree commit diff stats
path: root/lib/system.nim
Commit message (Collapse)AuthorAgeFilesLines
* remove `internalNew` from system (#23475)ringabout2024-04-041-3/+0
|
* ORC: added -d:nimOrcStats switch and related API (#23272)Andreas Rumpf2024-02-211-14/+16
|
* clean up goto exceptions; remove the setjmp.h dep (#23259)ringabout2024-01-271-1/+1
|
* workaround arrayWith issues (#23230)ringabout2024-01-181-1/+2
| | | I'm working on it, but it's quite tricky. I will fix it soon
* fixes #23223; prevents `insert` self-assignment (#23225)ringabout2024-01-181-0/+2
| | | fixes #23223
* remove unnecessary workaround from `arrayWith` (#23208)ringabout2024-01-151-2/+1
| | | The problem was fixed by https://github.com/nim-lang/Nim/pull/23195
* patches for #23129 (#23198)ringabout2024-01-111-1/+1
| | | fixes it in the normal situation
* fixes #22923; fixes `=dup` issues (#23182)ringabout2024-01-111-1/+2
| | | fixes #22923
* Deprecate asm stmt for js target (#23149)ASVIEST2024-01-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | why ? - We already have an emit that does the same thing - The name asm itself is a bit confusing, you might think it's an alias for asm.js or something else. - The asm keyword is used differently on different compiler targets (it makes it inexpressive). - Does anyone (other than some compiler libraries) use asm instead of emit ? If yes, it's a bit strange to use asm somewhere and emit somewhere. By making the asm keyword for js target deprecated, there would be even less use of the asm keyword for js target, reducing the amount of confusion. - New users might accidentally use a non-universal approach via the asm keyword instead of emit, and then when they learn about asm, try to figure out what the differences are. see https://forum.nim-lang.org/t/10821 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #23006; newSeqUninit -> CT Error; imitate `newStringUninit` (#23007)ringabout2023-11-301-1/+4
| | | fixes #23006
* enable vtable implementation for C++ and make it an experimental feature ↵ringabout2023-11-301-2/+5
| | | | | | | | | | | (#23004) follow up https://github.com/nim-lang/Nim/pull/22991 - [x] turning it into an experimental feature --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* rework the vtable implementation embedding the vtable array directly with ↵ringabout2023-11-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | new strictions on methods (#22991) **TODO** - [x] fixes changelog With the new option `nimPreviewVtables`, `methods` are confined in the same module where the type of the first parameter is defined - [x] make it opt in after CI checks its feasibility ## In the following-up PRs - [ ] in the following PRs, refactor code into a more efficient one - [ ] cpp needs special treatments since it cannot embed array in light of the preceding limits: ref https://github.com/nim-lang/Nim/pull/20977#discussion_r1035528927; we can support cpp backends with vtable implementations later on the comprise that uses indirect vtable access --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22286; enforce Non-var T destructors by `nimPreviewNonVarDestructor` ↵ringabout2023-11-251-9/+14
| | | | | | | | | | | | | | | | | | (#22975) fixes #22286 ref https://forum.nim-lang.org/t/10642 For backwards compatibilities, we might need to keep the changes under a preview compiler flag. Let's see how many packags it break. **TODO** in the following PRs - [ ] Turn the `var T` destructors warning into an error with `nimPreviewNonVarDestructor` --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* reserve `sysFatal` for `Defect` (#22158)Jacek Sieka2023-11-061-1/+1
| | | | | | | | 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.
* fixes #22898; fix #22883 differently (#22900)ringabout2023-11-051-4/+0
| | | | | | fixes #22898 In these cases, the tables/sets are clears or elements are deleted from them. It's reasonable to suppress warnings because the value is not accessed anymore, which means it's safe to ignore the warnings.
* fixes #22883; replace `default(typeof(` with `reset`; suppress `Unsaf… ↵ringabout2023-11-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | (#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
* fixes #22856; enables `-d:nimStrictDelete` (#22858)ringabout2023-10-241-5/+1
| | | | | | | | fixes #22856 `-d:nimStrictDelete` is introduced in 1.6.0, which promised to be enabled in the coming versions. To keep backwards incompatibilities, it also extends the feature of `-d:nimAuditDelete`, which now mimics the old behaviors.
* fixes `system.delete` that raises defects (#22857)ringabout2023-10-231-1/+1
|
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-111-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fixes #22554; makes `newSeqWith` use `newSeqUninit` (#22771)ringabout2023-09-301-6/+7
| | | fixes #22554
* deprecates `newSeqUninitialized` replaced by `newSeqUninit` (#22739)ringabout2023-09-291-2/+29
| | | | | | | ref #19727 closes #22586 https://github.com/nim-lang/Nim/issues/22554 needs it to move on. `newSeqUnsafe` can be introduced later.
* Make `newStringUninit` available in the VM [backport] (#22748)Amjad Ben Hedhili2023-09-251-9/+12
| | | It's equivalent to `newString`.
* Add magic toOpenArrayChar (#22751)SirOlaf2023-09-241-0/+3
| | | | | | Should help with stuff like the checksums package which only takes `openArray[char]` Co-authored-by: SirOlaf <>
* Fix `newStringUninit` not setting the '\0' terminator [backport] (#22746)Amjad Ben Hedhili2023-09-231-2/+6
| | | Causes problems when working with `cstring`s.
* Make `newStringUninit` available on the js backend [backport] (#22743)Amjad Ben Hedhili2023-09-231-0/+3
|
* Fix `capacity` for const and shallow [backport] (#22705)Amjad Ben Hedhili2023-09-181-4/+4
|
* Add descriptions and examples for `rawProc` and `rawEnv` (#22710)sls10052023-09-181-1/+31
| | | | | | | | | | Add descriptions for `rawProc` and `rawEnv`. See <https://forum.nim-lang.org/t/10485> for more informations. --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Juan Carlos <juancarlospaco@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes incorrect cint overflow in system (#22718)ringabout2023-09-181-1/+1
| | | fixes #22700
* 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 #22555; implements `newStringUninit` (#22572)ringabout2023-08-291-22/+36
| | | | | | | | | | | | | * fixes newStringUninitialized; implement `newStringUninitialized` * add a simple test case * adds a changelog * Update lib/system.nim * Apply suggestions from code review rename to newStringUninit
* Markdown code blocks migration part 9 (#22506)Amjad Ben Hedhili2023-08-191-62/+62
| | | | | * Markdown code blocks migration part 9 * fix [skip ci]
* Markdown code blocks migration part 8 (#22478)Andrey Makarov2023-08-151-3/+3
|
* replace `doAssert false` with `raiseAssert` in lib, which works better with ↵ringabout2023-08-111-1/+1
| | | | strictdefs (#22458)
* clean up `gc:arc` or `gc:orc` in docs and in error messages (#22408)ringabout2023-08-081-2/+2
| | | | | * clean up gc:arc/orc in docs * in error messages
* Make `repr(HSlice)` always available (#22332)konsumlamm2023-08-041-0/+10
| | | Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* implement `ensureMove` (#22339)ringabout2023-07-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 docs (#22331)ringabout2023-07-261-1/+1
|
* fixes #22268; fixes `move` codegen (#22288)ringabout2023-07-191-20/+8
|
* Fix #22273 (#22275)Juan Carlos2023-07-141-1/+1
| | | * Fix #22273
* clean up the documentation (#22196)ringabout2023-07-021-13/+13
|
* adds =destroy T support for strings and seqs (#22167)ringabout2023-06-271-1/+7
| | | | | | | * adds =destroy T support for strings and seqs * fixes system * fixes tests
* adds T destructor for refs (#22147)ringabout2023-06-261-0/+4
| | | | | | | | | * adds T destructor for refs * add `newRefdestructor` * adds ref overload for destructors * fixes config
* fixes #22123; Compiler bug with default initializer values and arrays (#22128)ringabout2023-06-201-2/+5
|
* make `move` use `=wasMoved` internally (#22032)ringabout2023-06-091-5/+20
| | | | | | | | | | | | | * make `move` use `=wasMoved` internally * fixes tests * fixes spawn finally * fixes views * rename to internalMove * add a test case
* small fixes for atomicArc (#22017)ringabout2023-06-061-4/+4
| | | | | * small fixes for atomicArc * Update lib/system/arc.nim
* lift the `=dup` hook (#21903)ringabout2023-06-021-2/+2
| | | | | | * fixes tests again * remove helper functions * fixes closures, owned refs * final cleanup
* improve `wasMoved` hooks; allow reset to use the overridden `wasMoved` hook ↵ringabout2023-05-121-4/+9
| | | | | | | (#21831) * improve `wasMoved` hooks * Because `wasMoved` is lifted
* adds documentation for `=wasMoved` and `=dup` hooks and small fixes (#21827)ringabout2023-05-111-1/+1
| | | | | | | | | | | * 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>
* make `reset` use the `=destroy` and `wasMoved` pair (#21821)ringabout2023-05-111-1/+9
| | | | | | | | | | | | | * 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
* implement `=dup` hook eliminating `wasMoved` and `=copy` pairs (#21586)ringabout2023-05-061-0/+6
| | | | | | | | | | | | | | | | | | | * 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