summary refs log tree commit diff stats
path: root/lib/system
Commit message (Collapse)AuthorAgeFilesLines
* bump NimVersion to 2.2.1 (#24215)Miran2024-10-021-1/+1
|
* bump NimVersion to 2.2.0 (#24210)Miran2024-09-301-2/+2
|
* revert second argument of `inc` not being generic (#24129)metagn2024-09-171-4/+4
| | | | refs #22328, fixes regression in https://forum.nim-lang.org/t/12465#76998
* fix string literal assignment with different lengths on ARC (#24083)metagn2024-09-081-1/+1
| | | fixes #24080
* remove fauxMatch for tyFromExpr, remove tyProxy and tyUnknown aliases (#24018)metagn2024-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | updated version of #22193 After #22029 and the followups #23983 and #24005 which fixed issues with it, `tyFromExpr` no longer match any proc params in generic type bodies but delay all non-matching calls until the type is instantiated. Previously the mechanism `fauxMatch` was used to pretend that any failing match against `tyFromExpr` actually matched, but prevented the instantiation of the type until later. Since this mechanism is not needed anymore for `tyFromExpr`, it is now only used for `tyError` to prevent cascading errors and changed to a bool field for simplicity. A change in `semtypes` was also needed to prevent calling `fitNode` on default param values resolving to type `tyFromExpr` in generic procs for params with non-generic types, as this would try to coerce the expression into a concrete type when it can't be instantiated yet. The aliases `tyProxy` and `tyUnknown` for `tyError` and `tyFromExpr` are also removed for uniformity.
* bump NimVersion to 2.1.99 (2.0.2 RC2) (#24016)Miran2024-08-271-1/+1
|
* Fixed nimscript docs (#23938)Antonis Geralis2024-08-111-7/+7
|
* Add a document to toOpenArray proc (#23905)Tomohiro2024-08-011-0/+6
|
* fixes JS semicolon omissions (#23896)ringabout2024-07-262-3/+3
|
* Allocator: Always place free cells into the active chunk and add ↵SirOlaf2024-07-221-21/+96
| | | | | | | | | | | | | | documentation (#23871) Lets single threaded applications benefit from tracking foreign cells as well. After this, `SmallChunk` technically doesn't need to act as a linked list anymore I think, gotta investigate that more though. The likelihood of overflowing `chunk.free` also rises, so to work around that it might make sense to check `foreignCells` instead of adjusting free space or replace free with a counter for the local capacity. For Nim compile I can observe a ~10mb reduction, and smaller ones for other projects.
* Allocator: Track number of foreign cells a small chunk has access to (#23856)SirOlaf2024-07-201-29/+46
| | | | | | | | | Ref: https://github.com/nim-lang/Nim/issues/23788 There was a small leak in the above issue even after fixing the segfault. The sizes of `free` and `acc` were changed to 32bit because adding the `foreignCells` field will drastically increase the memory usage for programs that hold onto memory for a long time if they stay as 64bit.
* Add warnings about exec usage. (#23820)Antonis Geralis2024-07-171-2/+9
| | | | | | | | | | | Related to https://github.com/nim-lang/Nim/issues/23819 and also found in discord https://discord.com/channels/371759389889003530/371759389889003532/1260845467147829372 Since nothing can be done, besides deprecating the function, a warning is a better option. --------- Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
* bump NimVersion to 2.1.9 (#23831)Miran2024-07-121-1/+1
| | | This is a 2.2 RC1.
* Adjust the correct chunk's free space in allocator (#23795)SirOlaf2024-07-081-2/+2
| | | Fixes #23788
* fixes #23725; Size computations work better when they are correct (#23758)Andreas Rumpf2024-06-261-6/+10
| | | [backport]
* fixes #23742; setLen(0) no longer allocates memory for uninitialized ↵ringabout2024-06-211-2/+8
| | | | | | | | | | strs/seqs for refc (#23745) fixes #23742 Before my PR, `setLen(0)` doesn't free buffer if `s != nil`, but it allocated unnecessary memory for `strs`. This PR rectifies this behavior. `setLen(0)` no longer allocates memory for uninitialized strs/seqs
* fixes #22927; no test case extractable [backport] (#23707)Andreas Rumpf2024-06-121-11/+23
|
* fixes #22510 (#23100)Andreas Rumpf2024-06-061-27/+24
|
* revert #23436; remove workaround (#23653)ringabout2024-05-281-2/+0
| | | revert #23436
* fixes #22852; fixes #23435; fixes #23645; SIGSEGV when slicing string or ↵ringabout2024-05-271-4/+1
| | | | | | | | | | | | | | | | | | seq[T] with index out of range (#23279) follow up https://github.com/nim-lang/Nim/pull/23013 fixes #22852 fixes #23435 fixes #23645 reports rangeDefect correctly ```nim /workspaces/Nim/test9.nim(1) test9 /workspaces/Nim/lib/system/indices.nim(116) [] /workspaces/Nim/lib/system/fatal.nim(53) sysFatal Error: unhandled exception: value out of range: -2 notin 0 .. 9223372036854775807 [RangeDefect] ```
* rework `wasMoved`, `move` on the JS backend (#23577)ringabout2024-05-081-31/+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
* fixes #23556; typeinfo.extendSeq generates random values in ORC (#23557)ringabout2024-05-031-0/+6
| | | | | fixes #23556 It should somehow handle default fields in the future
* workaround #23435; real fix pending #23279 (#23436)ringabout2024-04-181-0/+2
| | | | | | | workaround #23435 related to https://github.com/nim-lang/Nim/issues/22852 see also #23279
* fixes #4695; closure iterators support for JS backend (#23493)ringabout2024-04-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | fixes #4695 ref https://github.com/nim-lang/Nim/pull/15818 Since `nkState` is only for the main loop state labels and `nkGotoState` is used only for dispatching the `:state` (since https://github.com/nim-lang/Nim/pull/7770), it's feasible to rewrite the loop body into a single case-based dispatcher, which enables support for JS, VM backend. `nkState` Node is replaced by a label and Node pair and `nkGotoState` is only used for intermediary processing. Backends only need to implement `nkBreakState` and `closureIterSetupExc` to support closure iterators. pending https://github.com/nim-lang/Nim/pull/23484 <del> I also observed some performance boost for C backend in the release mode (not in the danger mode though, I suppose the old implementation is optimized into computed goto in the danger mode) </del> allPathsAsgnResult???
* strictdefs for `repr` so that it can used for debugging purposes in t… ↵ringabout2024-04-151-2/+2
| | | | | (#23501) …he compiler
* fixes #23487; JS chckNilDisp is wrong (#23490)ringabout2024-04-131-1/+1
| | | | | fixes #23487 uses JSRef
* fixes #4299 #12492 #10849; lambda lifting for JS backend (#23484)ringabout2024-04-111-0/+12
| | | | | | | | fixes #4299 fixes #12492 fixes #10849 It binds `function` with `env`: `function.bind(:env)` to ease codegen for now
* fix atomicarc increment (#23427)Jaremy Creechley2024-03-251-1/+1
| | | | | | | | | | | | The fix to the atomicArc looks to use `-1` as the check value from the `SharedPtr` solution. However, it should be `-rcIncrement` since the refcount is bit shifted in ARC/ORC. I discovered this playing around doing atomic updates of refcounts in a user library. Related to https://github.com/nim-lang/Nim/issues/22711 @ringabout I believe you ported the sharedptr fix?
* ORC: added -d:nimOrcStats switch and related API (#23272)Andreas Rumpf2024-02-213-4/+46
|
* fixes #23304; uses `snprintf` instead of `sprintf` (#23322)ringabout2024-02-202-1/+4
| | | fixes #23304
* clean up goto exceptions; remove the setjmp.h dep (#23259)ringabout2024-01-272-34/+52
|
* Fix system.currentSourcePath() documentation [backport 2.0] (#23243)rockcavera2024-01-231-4/+5
| | | | | The documentation links for `parentDir()` and `getCurrentDir()` are broken as they are no longer part of `std/os`. Link changed to `std/private/ospaths2`.
* fixes #23139; Cannot get repr of range type of enum (#23164)ringabout2024-01-051-1/+1
| | | fixes #23139
* Deprecate asm stmt for js target (#23149)ASVIEST2024-01-022-85/+85
| | | | | | | | | | | | | | | | | | | | | | | 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>
* make `-d:debugHeapLinks` compile again (#23126)ringabout2023-12-241-4/+6
| | | | | I have made `realloc` absorb unused adjacent memory, which improves the performance. I'm investigating whether `deallocOsPages` can be used to improve memory comsumption.
* fixes #22852; real bugfix is tied to bug #22672 (#23013)Andreas Rumpf2023-11-301-1/+4
|
* enable vtable implementation for C++ and make it an experimental feature ↵ringabout2023-11-301-1/+1
| | | | | | | | | | | (#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/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* reserve `sysFatal` for `Defect` (#22158)Jacek Sieka2023-11-062-8/+8
| | | | | | | | 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 #22860; suppress `AnyEnumConv` warning when iterating over set (#22904)ringabout2023-11-041-1/+4
| | | fixes #22860
* complete std prefixes for stdlib (#22887)ringabout2023-10-303-3/+3
| | | | follow up https://github.com/nim-lang/Nim/pull/22851 follow up https://github.com/nim-lang/Nim/pull/22873
* NIR: VM + refactorings (#22835)Andreas Rumpf2023-10-291-2/+2
|
* NIR: store sizes, alignments and offsets in the type graph; beginning… ↵Andreas Rumpf2023-10-162-1/+4
| | | | | (#22822) …s of a patent-pending new VM
* NIR: progress (#22817)Andreas Rumpf2023-10-121-0/+3
| | | | | | Done: - [x] Implement conversions to openArray/varargs. - [x] Implement index/range checking.
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-115-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #22790; use cast suppress AnyEnumConv warnings for enums withou… ↵ringabout2023-10-111-4/+13
| | | | | | | (#22813) …t holes fixes #22790
* fixes #22711; Check atomicArc for atomic destroy race condition (#22788)ringabout2023-10-041-8/+15
| | | | | fixes #22711 Per @elcritch's awesome solution
* docs: add another switch example for nimscript (#22772)daylin2023-09-301-0/+1
| | | | | I couldn't find any documentation on the syntax for --hint:X:on|off with `nimscript` except in [this old forum post](https://forum.nim-lang.org/t/8526#55236).
* deprecates `newSeqUninitialized` replaced by `newSeqUninit` (#22739)ringabout2023-09-291-2/+0
| | | | | | | ref #19727 closes #22586 https://github.com/nim-lang/Nim/issues/22554 needs it to move on. `newSeqUnsafe` can be introduced later.
* ref #19727; implement `setLenUninit` for seqsv2 (#22767)ringabout2023-09-281-0/+24
| | | ref #19727