Commit Graph

232 Commits

Author SHA1 Message Date
metagn
d37901fe06 fix getNullValue for cstring in VM, make other VM code aware of nil cstring (#22527)
* fix getNullValue for cstring in VM

fixes #22524

* very ugly fixes, but fix #15730

* nil cstring len works, more test lines

* fix high

(cherry picked from commit 942f846f04)
2023-09-15 09:10:56 +02:00
ringabout
e8ec3efd3d allow addressing elements of openArray[char] in VM (#22045)
allow addressing elements of openArray[char]

(cherry picked from commit a8d0dda833)
2023-09-14 14:07:08 +02:00
narimiran
19b3f8c0ea Revert "fixes #16790; fixes #19075; put big arrays on the constant seqs; don't inline them in the VM; big performance boost (#21318)"
This reverts commit 7ad8c44e28.
2023-09-14 06:03:34 +02:00
metagn
79a1990774 use dummy dest for void branches to fix noreturn in VM (#22617)
fixes #22216

(cherry picked from commit 2542dc09c8)
2023-09-12 09:24:33 +02:00
metagn
965eeb68e2 handle typedesc params in VM (#22581)
* handle typedesc params in VM

fixes #15760

* add test

* fix getType(typedesc) test

(cherry picked from commit 2e4e2f8f50)
2023-09-11 21:33:48 +02:00
metagn
0dbac38d12 clearer error for different size int/float cast in VM (#22582)
refs #16547

(cherry picked from commit b6cea7b599)
2023-09-11 21:33:42 +02:00
ringabout
77da35db17 fixes #21704; remove nfIsRef for genLit in VM (#21765)
* fixes #21704; remove `nfIsRef` for genLit

* remove nfIsRef from the output of macros

* make the logic better

* try again

* act together

* excl nfIsRef

(cherry picked from commit 53c15f24e9)
2023-06-15 12:43:59 +02:00
ringabout
844717f52b fixes explicit globals in macros (#21502)
(cherry picked from commit b2c1dcbbc9)
2023-04-26 15:08:45 +02:00
ringabout
7ceb4e4c87 fixes #10938; fixes #13312; fixes #13918; fixes #20985; always initializes global variables with null values in VM (#21351)
* fixes #10938; always initialize global variable in VM

* fixes importc vars

* there is a pre-existing issue regarding closure types in the VM

* add tests

(cherry picked from commit 1b1412f3d1)
2023-04-26 12:48:13 +02:00
ringabout
ca620d6089 closes #17864; add a test case (#21434)
(cherry picked from commit d4782c9e42)
2023-04-26 12:48:12 +02:00
ringabout
7ad8c44e28 fixes #16790; fixes #19075; put big arrays on the constant seqs; don't inline them in the VM; big performance boost (#21318)
* don't inline arrays in VM

* add a test for #19075

(cherry picked from commit b5f64f55d0)
2023-04-26 12:48:12 +02:00
ringabout
e70379811b fixes regression #17121; adding doc comment in importc proc makes it silently noop at CT (#20766)
* fixes regression #17121; adding doc comment in importc proc makes it silently noop at CT

* Update compiler/vmgen.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit a228e331f3)
2023-04-26 09:31:32 +02:00
ringabout
26e52d7c5d fixes #19201; fixes sink causes crash in VM (#20658)
(cherry picked from commit 4b377b07fc)
2023-04-25 16:27:30 +02:00
Jason Beetham
32171fc66d Unpack mSlice tupleconstr for static openarrays (#20615)
(cherry picked from commit da0a2fdca2)
2023-04-25 16:27:29 +02:00
ringabout
6df5fa424a closes #12994; add testcase (#20511)
(cherry picked from commit a132f5502a)
2023-04-25 15:34:47 +02:00
ringabout
999a4bb750 closes #19969; add testcase for #19969 #15952 #16306 (#20610)
closes #19969; add testcase

(cherry picked from commit 1db25ffcd3)
2022-10-24 13:54:29 +02:00
Jason Beetham
2292ff950a Implemented mSlice on the VM allowing toOpenArray to work at compile time. (#20586)
* Implemented opcSlice to make 'toOpenArray' work on the VM

* Added nkOpenArray for VM to reduce bodgeness

* Fixed range issues and erraneous comments

* Range check correctly for openArrays in opcLdArr

* Inverted logic for ldArr checking

* vm now supports slicing strings

* Added string tests

* Removed usage of 'nkOpenArray' and redundant operations

* Refactored vmSlice implementation, removing redundant and incorrect code

* Made tuples go throw opcWrObj for field assignment

* All strkinds should be considered for openarrays

(cherry picked from commit 4aa67ad7fd)
2022-10-24 13:54:05 +02:00
flywind
6f290fa386 [vm]fixes #15974 #12551 #19464 #16020 #16780 #16613 #14553 #19909 #18641 (#19902) [backport]
* revert #12217 since the root problem seems to have been fixed; fix #15974;fix #12551; fix #19464

* fix #16020; fix #16780

* fix tests and #16613

* fix #14553

* fix #19909; skip skipRegisterAddr

* fix #18641

(cherry picked from commit 3cb2d7af05)
2022-06-23 08:34:34 +02:00
flywind
2064fda582 [semfold] fix #19199; properly fold uint to float conversion (#19890) [backport]
fix #19199; properly fold float conversion

(cherry picked from commit ab47707586)
2022-06-20 08:32:41 +02:00
flywind
1368316b7f style usages part one (openarray => openArray) (#19321)
* style usages (openArray)

* revert doc changes

(cherry picked from commit 9df195ef58)
2022-05-25 16:33:37 +02:00
Andreas Rumpf
bfa8188dac fixes #19198 [backport:1.6] (#19209)
* fixes #19198 [backport:1.6]

* added a test case

(cherry picked from commit f90620fb32)
2021-12-06 11:19:17 +01:00
Timothee Cour
5f7db65257 followup #18453 (#18582) 2021-07-25 12:55:33 -07:00
Jason Beetham
5386ae75ba Fixed template const tuple unpacking (#18562) 2021-07-23 08:46:13 +02:00
Timothee Cour
ad70a65e0e fix #18310 system.== in vm for NimNode (#18313)
* fix #18310 == in vm

* fixup

* fixup
2021-06-21 09:46:31 +02:00
Timothee Cour
6ab911accb fix tests/vm/tcastint.nim which used non-sensical when defined nimVM (and contained wrong tests) (#17954) 2021-05-08 00:27:06 +02:00
Timothee Cour
00bb3c779e fix https://github.com/timotheecour/Nim/issues/718: CompileTime is not cached apparently (#17940) 2021-05-05 08:41:53 +02:00
Timothee Cour
938c6ac5df add logging to help investigate why tests/vm/tconst.nim is flaky (#17934) 2021-05-04 00:50:06 -07:00
Timothee Cour
78e2d299df typo: nonexistant => nonexistent (#17918)
* typo: nonexistant => nonexistent

* fix test (ordering differs because of https://github.com/nim-lang/Nim/issues/17910)
2021-05-02 00:26:41 +02:00
Timothee Cour
82996aee3f misc fixes: remove forceConst (obsolete by static), add more runnableExamples to system (#17896)
* misc fixes

* add runnableExamples for compileOption

* add runnableExamples for runnableExamples

* move tconsteval => tconst

* cleanup
2021-05-01 07:26:52 +02:00
flywind
5c12c711f7 follow up #17518 (#17726) 2021-04-15 19:25:35 +02:00
flywind
70a30317f7 fix #16693: testament spec nimout too lax (#16698)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-04-04 13:47:28 -07:00
flywind
a5600e49df close #9622 add testcase (#17557)
* fix nim js cmp fails at CT

* close #9622 add testcase
2021-03-29 01:40:37 +02:00
flywind
42e895feb1 close #15696 (#17518) 2021-03-25 21:20:58 -07:00
Timothee Cour
0cb02fbbee add overload add(a: var string, b: openArray[char]) (#15951)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-03-01 07:51:12 -08:00
Saem Ghani
7c2ac98880 Fixes #17039 - ldObj checks node/nodeAddr access (#17123)
Checked field expressions, such as an object variant field access results in
occasionally broken address analysis crashing the VM. This guard added here
mimics guarded access in ldObjAddr as well. This is to prevent a crash, while a
fix is devised.
2021-02-23 09:02:06 +01:00
Timothee Cour
cde950e1bc make copySign for js consistent with other backends (#16609)
* make copySign work more robustly in js
* improve tests
* improve tests/vm/tcastint.nim
2021-02-22 08:47:00 +01:00
Timothee Cour
4326f743d0 compilesettings: add libpath (#16997)
* compilesettings: add libpath

* add test

* changelog

* fixup

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-02-12 23:50:41 +01:00
Timothee Cour
c17cad0992 close #8015: const array indexing zeroes data in object variants at runtime (#16782) 2021-01-21 11:11:42 +01:00
Timothee Cour
0d0e43469f fix #14340 (#16386) 2021-01-01 22:55:22 +01:00
flywind
6d442a40a6 use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
Timothee Cour
bc84d9c8cb [backport => 1.0] fix #16428 vmops now works for generic procs (#16429)
* fix #16428 vmops now works for generic procs

* remove duplication
2020-12-22 02:05:21 +01:00
Andreas Rumpf
d306a04466 fixes #16069; [backport:1.2] [backport:1.4] (#16115)
* fixes #16069; refs https://github.com/nim-lang/RFCs/issues/257 [backport:1.2] [backport:1.4]

* make tests green again
2020-11-24 16:09:00 +01:00
Timothee Cour
b3c3557c33 fix #16025 repr now consistent: does not insert trailing newline (#16034) 2020-11-19 12:12:51 -08:00
Andrey R (cooldome)
632af8afad Revert "follow #16009 VM supports cast nil to ptr (#16012)"
This reverts commit fec19c980e.
2020-11-17 18:54:33 +00:00
flywind
fec19c980e follow #16009 VM supports cast nil to ptr (#16012)
* follow #16009 VM supports cast nil to ptr

* more testcase
2020-11-17 10:47:01 +00:00
flywind
203bddf307 close #11637(add testcase for #11637) (#15879)
* close #11637(add testcase for #11637)

* Update tests/vm/t11637.nim
2020-11-08 11:02:12 +08:00
flywind
a8af664e8b fix #15463 (#15831) 2020-11-05 14:00:08 +01:00
flywind
5b4c17b5e7 Closure iterators are not supported by VM (#15818) 2020-11-02 10:58:14 +01:00
flywind
558115fa29 fixes #15717 2020-11-02 10:27:48 +01:00
Timothee Cour
3bdc000521 [backport] fix #15595 procvar == works in VM (#15724) 2020-10-26 22:19:05 +02:00