Commit Graph

22821 Commits

Author SHA1 Message Date
araq
cf4ac37643 progress 2025-11-09 09:50:11 +01:00
araq
44f3dcc9a3 wip 2025-11-08 23:42:04 +01:00
araq
2cb1c539e0 wip 2025-11-08 15:51:55 +01:00
araq
e173a6a7b5 added TLoc writing 2025-11-08 09:04:37 +01:00
araq
0bf8bbfd9f progress 2025-11-08 08:52:19 +01:00
araq
940ce87c73 prepare for dependency tracking 2025-11-08 07:42:26 +01:00
Araq
e6a1c14d91 progress 2025-11-07 23:35:45 +01:00
araq
b4c942c4cd wip 2025-11-07 21:27:08 +01:00
Andreas Rumpf
dc2fb81d9d Merge branch 'devel' into demotomohiro-add-ast2nif2 2025-11-07 17:16:32 +01:00
araq
6a2f4d29c4 wip 2025-11-07 15:52:00 +01:00
Andreas Rumpf
a866bf2a39 VM: optimize 'return' slots; saves millions of node allocations for N… (#25266)
…imbus
2025-11-07 13:53:24 +01:00
ringabout
6d3254a86f fixes #25251; SIGBUS with iterator over const Table lookup - premature temporary destruction (#25255)
fixes #25251

enforce a copy if the arg is a deref of a lent pointer since the arg
could be a temporary that will go out of scope
2025-11-07 13:53:24 +01:00
Jacek Sieka
155b06a4f5 Add heaptrack support (#25257)
This PR, courtesy of @NagyZoltanPeter
(https://github.com/waku-org/nwaku/pull/3522) adds the ability to track
memory allocations in a program suitable for use with
[heaptrack](https://github.com/KDE/heaptrack).

By passing `-d:heaptrack --debugger:native` to compilation, calls to
heaptrack will be injected when memory is being allocated and released -
unlike `-d:useMalloc` this strategy also works with `refc` and the
default memory pool.

See https://github.com/KDE/heaptrack for usage examples. The resulting
binary needs to be run with `heaptrack` and with the shared
`libheaptrack_preload.so` in the `LD_LIBRARY_PATH`.
2025-11-07 13:53:24 +01:00
ringabout
116c220e3f fixes #25263; provides a new switch mangle:nim/cpp for debug name mangling (#25264)
fixes #25263

- [x] documentation and changelogs
2025-11-07 13:53:24 +01:00
metagn
839cbeb371 js: replace push.apply with for loop for string add [backport] (#25267)
While `a.push.apply(a, b)` is better for performance than the previous
`a = a.concat(b)` due to the fact that it doesn't create a new array,
there is a pretty big problem with it: depending on the JS engine, if
the second array is too long, it can [cause a
crash](https://tanaikech.github.io/2020/04/20/limitation-of-array.prototype.push.apply-under-v8-for-google-apps-script/)
due to the function `push` taking too many arguments. This has
unfortunately been what the codegen produces since 1.4.0 (commit
707367e1ca).

So string addition is now moved to a compilerproc that just uses a `for`
loop. From what I can tell this is the most compatible and the fastest.
Only potential problem compared to `concat` etc is with aliasing, i.e.
adding an array to itself, but I'm guessing it's enough that the length
from before the iteration is used, since it can only grow. The test
checks for aliased nim strings but I don't know if there's an extra
protection for them.
2025-11-07 20:19:50 +08:00
Andreas Rumpf
809662a228 VM: optimize 'return' slots; saves millions of node allocations for N… (#25266)
…imbus
2025-11-07 11:05:13 +01:00
ringabout
6f73094263 fixes #25251; SIGBUS with iterator over const Table lookup - premature temporary destruction (#25255)
fixes #25251

enforce a copy if the arg is a deref of a lent pointer since the arg
could be a temporary that will go out of scope
2025-11-07 10:06:05 +01:00
Jacek Sieka
861ebc0f19 Add heaptrack support (#25257)
This PR, courtesy of @NagyZoltanPeter
(https://github.com/waku-org/nwaku/pull/3522) adds the ability to track
memory allocations in a program suitable for use with
[heaptrack](https://github.com/KDE/heaptrack).

By passing `-d:heaptrack --debugger:native` to compilation, calls to
heaptrack will be injected when memory is being allocated and released -
unlike `-d:useMalloc` this strategy also works with `refc` and the
default memory pool.

See https://github.com/KDE/heaptrack for usage examples. The resulting
binary needs to be run with `heaptrack` and with the shared
`libheaptrack_preload.so` in the `LD_LIBRARY_PATH`.
2025-11-06 17:33:52 +01:00
ringabout
1d08c4e241 fixes #25263; provides a new switch mangle:nim/cpp for debug name mangling (#25264)
fixes #25263

- [x] documentation and changelogs
2025-11-06 16:41:13 +01:00
demotomohiro
43ff7b1dc4 loads modules imported by system module and create module sym before decode 2025-11-06 04:50:21 +09:00
demotomohiro
54aa552fb6 refers imported symbols like Nimony 2025-11-06 04:50:21 +09:00
demotomohiro
ab13900fad saves/loads PSym.ast, constraint and instantiatedFrom 2025-11-06 04:50:21 +09:00
demotomohiro
5f3be1e991 makes tencode_node2node.nim faster 2025-11-06 04:50:21 +09:00
demotomohiro
f3178e4515 saves/loads flags of nkIdent node 2025-11-06 04:50:21 +09:00
demotomohiro
9f73412e93 saves/loads float Inf, NaN and NegInf literals 2025-11-06 04:50:21 +09:00
demotomohiro
91db9ac8f5 uses ItemId instead of PSym or PType for the set of decoded syms and types 2025-11-06 04:50:21 +09:00
demotomohiro
3c599ed7db adds expression test code 2025-11-06 04:50:20 +09:00
demotomohiro
66d7a8e0b4 adds generics test code and fixes bug 2025-11-06 04:50:20 +09:00
demotomohiro
467a27948c adds pragma test code 2025-11-06 04:50:20 +09:00
demotomohiro
6a74316c0e fixes assertion defect when encoding empty object type definition 2025-11-06 04:50:20 +09:00
demotomohiro
10885d4dce adds statements test code 2025-11-06 04:50:20 +09:00
demotomohiro
3ceb223089 adds more procedure test code 2025-11-06 04:50:20 +09:00
demotomohiro
b50c453b14 adds procedure test code and fix bugs 2025-11-06 04:50:19 +09:00
demotomohiro
6f237be686 saves/loads symbol magic, options and offset 2025-11-06 04:50:19 +09:00
demotomohiro
8a4d921d6b saves/loads PNode and PSym line info 2025-11-06 04:50:19 +09:00
demotomohiro
51eccea910 saves/loads PSym guard, bitsize and alignment 2025-11-06 04:50:19 +09:00
demotomohiro
5eeede3a43 uses PSym.item and PType.item as id in NIF 2025-11-06 04:50:19 +09:00
demotomohiro
25ca7ccc79 encodes/decodes itemId.module 2025-11-06 04:50:19 +09:00
demotomohiro
e9127b2567 adds Nim's AST to/from NIF 2025-11-06 04:50:19 +09:00
Andreas Rumpf
cfefd1d95b produces vastly better error messages for implicit --import and --inc… (#25258)
…lude configuration options
2025-11-04 17:54:23 +01:00
ringabout
d54b5f3ae1 fixes #25252; Unexpected ambiguous call with fields over object with default fields (#25256)
fixes #25252
2025-11-04 20:08:07 +08:00
Tomohiro
5079074b1a uses newer Nimony (#25249)
Old Nimony has unfixed issue
https://github.com/nim-lang/nimony/issues/1313.
So https://github.com/nim-lang/Nim/pull/25243 doesn't work correctly
with float literal `-0.0`.
This PR updates the Nimony that fixed the issue.
2025-10-31 16:59:38 +01:00
Yuriy Glukhov
99a222d63d Respect noinit for generic types (#25250) 2025-10-31 16:59:24 +01:00
Miran
3e9a66599a bump the shipped version of Atlas (#25248) 2025-10-30 20:30:28 +01:00
ringabout
ce6a34597d fixes #24575; _GNU_SOURCE redefined (#25247)
fixes #24575
2025-10-28 18:39:50 +01:00
Yuriy Glukhov
7af4e3eefd Fixes #25202 (#25244) 2025-10-28 12:48:22 +01:00
ringabout
130eac2f93 fixes #25008; Compiler internal error with static overload (#25234)
fixes #25008

It seems that `semOverloadedCall` evaluates the same node twice using
`tryConstExpr` in order for `efExplain` to print all the diagnostic
output. The problem is that `tryConstExpr` has side effects, i.e., it
changes the slot index of variables after VM execution.
2025-10-28 11:47:20 +01:00
ringabout
b8ce11dd9d fixes #25027; nim doc uses doc comment from private field for public field (#25239)
fixes #25027
2025-10-23 19:19:27 +02:00
ringabout
b7c02e9bad fixes #25240; forbids modifying a Deque changed while iterating over it (#25242)
fixes #25240

> Deque items behavior is not the same on 2.0.16 and 2.2.0

The behavior seems to be caused by the temp introduced for the parameter
`deq.len`, which prevents it from being evaluated multiple times
2025-10-23 19:18:57 +02:00
Ryan McConnell
544c26c0b8 add srcDir variable to nim.cfg (#24919)
There might be a way to do this but I couldn't find anything about it.
This is a very simple thing that goes a long way in certain situations.
Trying to avoid needing to switch to nimscript just to get:
```nim
# config.nims
import os
let srcDir = currentSourcePath.parentDir()
switch("define", &"ProjPath:\"{srcDir}\"")
```
with this change just needs:
```
# nim.cfg
d %= "ProjPath=$srcDir"
```
2025-10-23 09:05:05 +02:00