summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* Update readme.md (#22827)Himaj Patil2023-10-151-3/+5
| | | Added table view in Compiling section of documentation
* fixes #19250; fixes #22259; ORC AssertionDefect not ↵ringabout2023-10-132-0/+55
| | | | | | | | | | | containsManagedMemory(n.typ) (#22823) fixes #19250 fixes #22259 The strings, seqs, refs types all have this flag, why should closures be treated differently? follow up https://github.com/nim-lang/Nim/pull/14336
* fixes #22354; Wrong C++ codegen for default parameter values in ORC (#22819)ringabout2023-10-132-30/+49
| | | | | | fixes #22354 It skips `nkHiddenAddr`. No need to hoist `var parameters` without side effects. Besides, it saves lots of temporary variables in ORC.
* NIR: progress (#22817)Andreas Rumpf2023-10-1216-101/+281
| | | | | | Done: - [x] Implement conversions to openArray/varargs. - [x] Implement index/range checking.
* update nimble (#22814)ringabout2023-10-111-1/+1
| | | | | | | | | | Issues like https://github.com/nim-lang/nimble/issues/1149 keep popping up. One way or another, we should alleviate the pain. Finally, we should consider https://github.com/nim-lang/nimble/pull/1141#discussion_r1316829521 as an option using some kind of cron script to update https://nim-lang.org/nimble/packages.json. It's turning into a really annoying problem.
* Import std/stackframes in ast2ir.nim (#22815)SirOlaf2023-10-111-0/+3
| | | | | Ref https://github.com/nim-lang/Nim/pull/22777#issuecomment-1758090410 Co-authored-by: SirOlaf <>
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-1135-122/+4009
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-113-4/+16
| | | | | | | (#22813) …t holes fixes #22790
* use lent for the return value of index accesses of tables (#22812)ringabout2023-10-111-2/+2
| | | ref https://forum.nim-lang.org/t/10525
* suppress incorrect var T destructor warnings for newFinalizer in stdlib (#22810)ringabout2023-10-112-3/+5
| | | | | | | | | | | | in `std/nre` ```nim proc initRegex(pattern: string, flags: int, study = true): Regex = new(result, destroyRegex) ``` gives incorrect warnings like ``` C:\Users\blue\Documents\Nim\lib\impure\nre.nim(252, 6) Error: A custom '=destroy' hook which takes a 'var T' parameter is deprecated; it should take a 'T' parameter [Deprecated ```
* allows cast int to bool/enum in VM (#22809)ringabout2023-10-111-2/+2
| | | | | Since they are integer types, by mean of allowing cast integer to enums in VM, we can suppress some enum warnings in the stdlib in the unified form, namely using a cast expression.
* adds support for noDecl in constructor (#22811)Juan M Gómez2023-10-113-2/+12
| | | Notice the test wouldnt link before
* fixes #8893; guard against array access in renderer (#22807)ringabout2023-10-091-1/+1
| | | fixes #8893
* marking a field with noInit allows to skip constructor initialiser (#22802)Juan M Gómez2023-10-085-4/+85
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes nimsuggest false error on lifetime tracking hook fixes #22794 (#22805)Juan M Gómez2023-10-081-0/+1
| | | | | fixes #22794 Not sure if it's too much.
* Add getCursorPos() to std/terminal (#22749)Matt Rixman2023-10-081-1/+47
| | | | | | | | | | | This would be handy for making terminal apps which display content below the prompt (e.g. `fzf` does this). Need to test it on windows before I remove "draft" status. --------- Co-authored-by: Matt Rixman <MatrixManAtYrService@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22787; marks `var section` in the loop as reassign preventing cursor ↵ringabout2023-10-072-0/+41
| | | | | | | | | (#22800) fixes #22787 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Fix typo/grammar in exception tracking section (#22801)Levi Notik2023-10-071-1/+1
| | | | | | | | I came across this sentence in the Nim Manual and couldn't make sense of it. I believe this is the correct fix for the sentence. --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* remove the O(n*n) `addUnique` one from std (#22799)ringabout2023-10-061-12/+0
| | | | It's not used in the compiler, besides, it doesn't seem to be a common operation. Follows the discussion on the Discord.
* fixes #22711; Check atomicArc for atomic destroy race condition (#22788)ringabout2023-10-041-8/+15
| | | | | fixes #22711 Per @elcritch's awesome solution
* document `atomicInc` and `atomicDec` (#22789)ringabout2023-10-041-0/+2
|
* arraymancer switches to the offical URL (#22782)ringabout2023-10-031-1/+1
|
* nimsuggest: Clear generic inst cache before partial recompilation (#22783)Pylgos2023-10-033-3/+57
| | | | | fixes #19371 fixes #21093 fixes #22119
* fixes #22778 regression: contentLength implementation type mismatched (#22780)ringabout2023-10-032-1/+2
| | | | fixes #22778 follow up https://github.com/nim-lang/Nim/pull/19835
* fixes #22753; Nimsuggest segfault with invalid assignment to table (#22781)ringabout2023-10-025-9/+49
| | | | | | | | fixes #22753 ## Future work We should turn all the error nodes into nodes of a nkError kind, which could be a industrious task. But perhaps we can add a special treatment for error nodes to make the transition smooth.
* Fix IndexDefect in asyncfile.readLine (#22774)CMD2023-10-011-0/+2
| | | | `readLine` proc in asyncfile module caused IndexDefect when it reached EoF. Now it returns empty string instead.
* copyFile with POSIX_FADV_SEQUENTIAL (#22776)Juan Carlos2023-10-012-0/+9
| | | | | | | | | | | - Continuation of https://github.com/nim-lang/Nim/pull/22769 - See https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html - The code was already there in `std/posix` since years ago. 3 line diff. --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* docs: add another switch example for nimscript (#22772)daylin2023-09-302-0/+3
| | | | | 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).
* Make `typeRel` behave to spec (#22261)Ryan McConnell2023-09-304-29/+78
| | | | | | | | | | | | | | | | | | | | | | | | The goal of this PR is to make `typeRel` accurate to it's definition for generics: ``` # 3) When used with two type classes, it will check whether the types # matching the first type class (aOrig) are a strict subset of the types matching # the other (f). This allows us to compare the signatures of generic procs in # order to give preferrence to the most specific one: ``` I don't want this PR to break any code, and I want to preserve all of Nims current behaviors. I think that making this more accurate will help serve as ground work for the future. It may not be possible to not break anything but this is my attempt. So that it is understood, this code was part of another PR (#22143) but that problem statement only needed this change by extension. It's more organized to split two problems into two PRs and this issue, being non-breaking, should be a more immediate improvement. --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22554; makes `newSeqWith` use `newSeqUninit` (#22771)ringabout2023-09-302-7/+13
| | | fixes #22554
* copyFile with bufferSize instead of hardcoded value (#22769)Juan Carlos2023-09-302-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `copyFile` allows to specify `bufferSize` instead of hardcoded wrong value. Tiny diff. # Performance - 1200% Performance improvement. # Check it yourself Execute: ```bash for i in $(seq 0 10); do bs=$((1024*2**$i)) printf "%7s Kb\t" $bs timeout --foreground -sINT 2 dd bs=$bs if=/dev/zero of=/dev/null 2>&1 | sed -n 's/.* \([0-9.,]* [GM]B\/s\)/\1/p' done ``` (This script can be ported to PowerShell for Windows I guess, it works in Windows MinGW Bash anyways). # Stats - Hardcoded `8192` or `8000` Kb bufferSize gives `5` GB/s. - Setting `262144` Kb bufferSize gives `65` GB/s (script suggestion). --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22696; func `strutils.join` for non-strings uses proc `$` which can ↵ringabout2023-09-301-1/+1
| | | | | | | | have side effects (#22770) fixes #22696 partially revert https://github.com/nim-lang/Nim/pull/16281 `join` calls `$` interally, which might introduce a sideeffect call.
* case macro now can be used inside generic. Fixes #20435 (#22752)Juan M Gómez2023-09-302-1/+45
| | | | | | | | | fixes #20435 --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Jake Leahy <jake@leahy.dev> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* deprecates `newSeqUninitialized` replaced by `newSeqUninit` (#22739)ringabout2023-09-294-6/+32
| | | | | | | ref #19727 closes #22586 https://github.com/nim-lang/Nim/issues/22554 needs it to move on. `newSeqUnsafe` can be introduced later.
* fixes #22763; nimcache in nim.cfg uses the relative path to the config file ↵ringabout2023-09-285-3/+16
| | | | | (#22764) fixes #22763
* C++ Adds support for default arg using object construction syntax. Fixes a ↵Juan M Gómez2023-09-282-3/+35
| | | | | | | | | | compiler crash (#22768) `Foo()` below makes the compiler crash. ```nim proc makeBoo(a:cint = 10, b:cstring = "hello", foo: Foo = Foo()): Boo {.importcpp, constructor.} ```
* ref #19727; implement `setLenUninit` for seqsv2 (#22767)ringabout2023-09-282-0/+26
| | | ref #19727
* Removed `localStorage.hasKey` binding (#22766)Thiago2023-09-281-1/+0
| | | | | | | | Doesn't exists anymore. Use `window.localStorage.getItem("key").isNil` instead ![Screenshot from 2023-09-28 07-22-41](https://github.com/nim-lang/Nim/assets/74574275/65d58921-58c7-4a81-9f3b-5faa3a79c4f2)
* Fix #21407 (#22759)Juan Carlos2023-09-282-0/+9
| | | | | | | - Fix #21407 --------- Co-authored-by: Amjad Ben Hedhili <amjadhedhili@outlook.com>
* Documentation only (#22760)Juan Carlos2023-09-271-12/+12
| | | | - Documentation only. - Sometimes newbies try to use Valgrind with RefC etc.
* iNim switch to the official URL (#22762)ringabout2023-09-271-1/+1
| | | ref https://github.com/inim-repl/INim/pull/139
* Documentation only (#22761)Juan Carlos2023-09-271-0/+4
| | | - Mention Bisect bot in Bisect documentation.
* fixes #10542; suppresses varargs conversion warnings (#22757)ringabout2023-09-263-2/+27
| | | | fixes #10542 revives and close #20169
* Add test case for #15351 (#22754)Jake Leahy2023-09-261-0/+5
| | | | | Closes #15351 Stumbled across the issue and found it now works
* fixes stint CI (#22756)ringabout2023-09-261-1/+1
|
* fixes #22706; turn "unknown hint" into a hint (#22755)ringabout2023-09-252-1/+7
| | | fixes #22706
* Make `newStringUninit` available in the VM [backport] (#22748)Amjad Ben Hedhili2023-09-251-9/+12
| | | It's equivalent to `newString`.
* Update Bisect (#22750)Juan Carlos2023-09-251-15/+16
| | | | | | | | | | | | | | | | | - Support multiple OS Bisects (Linux, Windows, MacOS). - Install Valgrind only if needed to speed up non-Valgrind builds. - Valgrind+MacOS bisect support. - Show IR of OK repro code samples. - YAML only, tiny diff. #### New features - Bisect bugs that only reproduce on Windows and OSX. #### See also - https://github.com/juancarlospaco/nimrun-action/pull/10
* 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.