Commit Graph

1616 Commits

Author SHA1 Message Date
Smarcy
b098546da0 added filemode docs (#19346) 2022-01-09 14:02:08 +01:00
Sven Keller
5d2bab7558 suggestion to respect typedarray type (#19257)
* suggestion to respect typedarray

* Update jssys.nim

Co-authored-by: Sven Keller <s.keller@cortona.de>
2021-12-16 08:58:32 +01:00
Ștefan Talpalaru
69aabdab80 nimRawSetjmp: support Windows (#19197)
* nimRawSetjmp: support Windows

Using `_setjmp()` directly is required to avoid some rare (but very
annoying) exception-related stack corruption leading to segfaults on
Windows, with Mingw-w64 and SEH.
More details: https://github.com/status-im/nimbus-eth2/issues/3121

Also add "nimBuiltinSetjmp" - mostly for benchmarking.

* fix for Apple's Clang++
2021-12-10 06:31:29 +01:00
wenghongquan
742e9d65ad Add support for LoongArch (#19223)
* Add support for LoongArch

* Update compiler/installer.ini

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-12-09 14:00:33 +01:00
flywind
0992854941 Atomic inc/dec should use ATOMIC_SEQ_CST (#19212) 2021-12-08 08:40:35 +01:00
rockcavera
7806ec525e Making TCC work again on Windows --cpu:amd64 - fix #16326 (#19221)
* fix #16326

* removing comments
2021-12-08 06:48:34 +01:00
flywind
ebd88725f9 remove sysspawn which is dead code (#19218) 2021-12-06 22:41:42 +01:00
flywind
7e3da693f5 [format minor] remove unnecessary spaces (#19216) 2021-12-06 18:58:01 +01:00
hlaaftana
ff39f6e260 make JS trunc polyfill opt-in, closes #16144 (#19183) 2021-11-24 08:20:15 +01:00
Jaremy Creechley
7772ca303c Implement threads on Zephyr (#19156)
* pthreads setup for zephyr

- enable tweak stack size
- update lib/system/threads.nim
- Fix int/uint in casting pointer.

* add documentation and tweak flag names

* add documentation and tweak flag names

* fix configuration flag names

* fix configuration flag names

* cleanup

Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
2021-11-23 09:13:03 +01:00
Jaremy Creechley
92d6fb86c6 Enable customizing PageShift to set PageSize for embedded targets (#19129)
* Enable customizing PageSize (via PageShift).

This enables adjusting PageSize for embedded targets without abusing
cpu16.

* copy nimPageXYZ settings for mmpaptest

* add docs for Nim manual

* add docs for Nim manual

* docs tweaks

Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
2021-11-16 20:30:07 +01:00
Andreas Rumpf
309ec7167e fixes .raises inference for newSeq builtin under --gc:orc [backport] (#19158) 2021-11-16 15:49:04 +01:00
flywind
bec4900165 wrong spaces (3 => 2) (#19145) 2021-11-14 12:46:21 +01:00
Andreas Rumpf
cde83d90aa refactoring: orc can use getThreadId() (#19123)
* refactoring: orc can use getThreadId()

* progress
2021-11-11 19:07:08 +01:00
Andreas Rumpf
fce89cb60a fixes another effect inference bug [backport:1.6] (#19100)
* fixes another effect inference bug [backport:1.6]
2021-11-07 16:38:02 +01:00
Andreas Rumpf
2bda4a30a6 fixes #19000 (#19032)
* fixes #19000

* progress
2021-10-30 10:14:23 +02:00
Tail Wag Games
cfdac6666f Freeing critical sections via atexit in system/alloc and system/io (#19062)
* adding new system module sysexitprocs and including system exit procedures when registering exit handlers defined in userland

* fixing failing tests and adding initialization guard to handle cases where the module's global init logic isn't invoked first as is the case with some gc implementaions

* js backend shouldn't try to invoke actual system exit procs

* fixing formatting in sysexitprocs.nim

* 256 was too much - my max number of plugins in my engine is 64 and I require two hooks per runtime it looks like with tls emulation turned off, so for my purposes 128 should be sufficient

* so atExit should be enough here, can get rid of all the extra cruft I had added on top since I didn't realize atExit already provided a stack

* done being cute - since newruntime prevents correct cpp codegen for object variants apparently and breaks tests if I try to use std/exitprocs, ddSysExitProc is just going into both modules. Since system doesn't include system/io, polluting system with it doesn't make sense either... at least it is only importc'd when it is required in either module and we don't have to have any weird when defined(nimOwnedEnabled) with a comment explaining why
2021-10-29 13:42:44 +02:00
Tail Wag Games
582468da1c deinitializing locks at program exit (#19043)
* deinitializing locks at program exit

* deinitLock shouldn't be called for js backend I guess...

* I suppose this is the best way to detect the
ewruntime option

* I guess I need these guards here too...

* fixing merge conflict
2021-10-25 10:13:30 +02:00
Jaremy Creechley
141b76e365 Add Zephyr Support (#19003)
* Porting Nim to run on Zephyr.

Includes changes to `std/net`.

Squashed commit of the following:
    tweaking more memory / malloc things
    revert back bitmasks
    tweaking nim to use kernel heap as C malloc doesn't work
    fixing socket polling on zephyr
    cleanup getting maximum sockets for process or for rtos'es
    reorganizing and fixing net for async / system
    merge netlite changes back into nativesockets
    merge netlite changes back into nativesockets
    reverting native sockets back
    tweaking nim / zephyr network
    adding option to run 'net-lite' from linux
    bridging zephyr's max connections
    fixing net errors
    fixing compilation with getAddrString
    fixing compilation with getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ...
    add note regarding incorrect FreeRTOS Sockadd_in fields
    changing to NIM_STATIC_ASSERT
    cleaning up the static_assert error messages
    cleaning up the static_assert error messages
    setting up static assert ftw!
    testing compile time asserts
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    finding missing items (issue  #18684)
    fixup posix constants (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* Porting Nim to run on Zephyr.

Includes changes to `std/net`.

Squashed commit of the following:
    tweaking more memory / malloc things
    revert back bitmasks
    tweaking nim to use kernel heap as C malloc doesn't work
    fixing socket polling on zephyr
    cleanup getting maximum sockets for process or for rtos'es
    reorganizing and fixing net for async / system
    merge netlite changes back into nativesockets
    merge netlite changes back into nativesockets
    reverting native sockets back
    tweaking nim / zephyr network
    adding option to run 'net-lite' from linux
    bridging zephyr's max connections
    fixing net errors
    fixing compilation with getAddrString
    fixing compilation with getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ...
    add note regarding incorrect FreeRTOS Sockadd_in fields
    changing to NIM_STATIC_ASSERT
    cleaning up the static_assert error messages
    cleaning up the static_assert error messages
    setting up static assert ftw!
    testing compile time asserts
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    finding missing items (issue  #18684)
    fixup posix constants (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* fixing PR issues

* Porting Nim to run on Zephyr.

Includes changes to `std/net`.

Squashed commit of the following:
    tweaking more memory / malloc things
    revert back bitmasks
    tweaking nim to use kernel heap as C malloc doesn't work
    fixing socket polling on zephyr
    cleanup getting maximum sockets for process or for rtos'es
    reorganizing and fixing net for async / system
    merge netlite changes back into nativesockets
    merge netlite changes back into nativesockets
    reverting native sockets back
    tweaking nim / zephyr network
    adding option to run 'net-lite' from linux
    bridging zephyr's max connections
    fixing net errors
    fixing compilation with getAddrString
    fixing compilation with getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ...
    add note regarding incorrect FreeRTOS Sockadd_in fields
    changing to NIM_STATIC_ASSERT
    cleaning up the static_assert error messages
    cleaning up the static_assert error messages
    setting up static assert ftw!
    testing compile time asserts
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    finding missing items (issue  #18684)
    fixup posix constants (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* Remerge

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* fixing PR issues

* fix maxDescriptors on zephyr/freertos

* move maxDescriptors to selector.nim -- fixes compile issue

* change realloc impl on zephyr to match ansi c behavior

* change realloc impl on zephyr to match ansi c behavior

* force compileOnly mode for tlwip

Co-authored-by: Jaremy J. Creechley <jaremy.creechley@wavebaselabs.com>
Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
2021-10-24 11:51:57 +02:00
Danil Yarantsev
5e2b9341f3 Add Elbrus 2000 architecture (#19024)
* Add Elbrus 2000 architecture

* Add e2k to niminst

* Update compiler/installer.ini

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-10-21 17:01:48 +02:00
Dominik Picheta
2aa97a228a Removes deprecated {.injectStmt.}. Fixes #18666 (#18984) 2021-10-13 11:09:45 +02:00
flywind
6c2f041368 fix code-block which causes missing docs 2021-09-11 09:25:48 +08:00
Sven Keller
3c2edd142b fix for js strict mode (#18799)
* Assignments, which would accidentally create global
variables, instead throw an error in strict mode

* Assignment to a getter-only property

Co-authored-by: Sven Keller <s.keller@cortona.de>
2021-09-04 12:53:02 +02:00
Andreas Rumpf
f46569bafd fixes #18494 (#18783) 2021-09-02 17:16:03 +02:00
Andreas Rumpf
e0ef859130 strict effects (#18777)
* fixes #17369
* megatest is green for --cpu:arm64
* docgen output includes more tags/raises
* implemented 'effectsOf' 
* algorithm.nim: uses new effectsOf annotation
* closes #18376
* closes #17475
* closes #13905
* allow effectsOf: [a, b]
* added a test case
* parameters that are not ours cannot be declared as .effectsOf
* documentation
* manual: added the 'sort' example
* bootstrap with the new better options
2021-09-02 12:10:14 +02:00
Timothee Cour
394f4ac7bb improvements to addInt and $ for integer types (#18592)
* improvements to $(SomeInteger) and addInt
* remove mIntToStr, mInt64ToStr
* improvements
* fix tests/pragmas/tinjectstmt.nim; the diff is harmless, cgen code is identical with -d:danger or debug mode
* rm tests/system/tstrmantle.nim
* revert compiler/jsgen.nim for -d:nimVersion140
2021-08-19 11:33:52 +02:00
flywind
901c5ded52 fix #18702(fix parseutils.parseFloat) (#18703) [backport:1.0]
* fix #18702
* Apply suggestions from code review
2021-08-16 15:14:35 +02:00
Timothee Cour
b24812df5f properly fix #10053 ; FieldDefect msg now shows discriminant value + lineinfo, in all backends (c,vm,js) (#11955)
* fix #10053 FieldError for vm

* fixup

* FieldError now also shows runtime value of discriminant

* fix field error reporting in vm

* also report culprit line info in err msg

* fix errors for newruntime 2

* fix for js

* fixup

* PRTEMP4

* works

* works

* works perfect

* refactor

* std/private/repr_impl

* suppport --gc:arc

* cleanup

* refactor

* simplify

* simplify

* simplify

* fixup

* move out compiler.vmgen.genCustom

* fixup

* fixup

* add tests

* revert compiler/debugutils.nim

* simplify reprDiscriminant

* fixup

* lib/std/private/repr_impl.nim -> lib/system/repr_impl.nim

* try to fix D20210812T165220

* honor --declaredlocs

* control toFileLineCol via --declaredlocs
2021-08-13 09:35:48 +02:00
RSDuck
d0dd923acf Switch maintanance (#18668)
* Fix and improve Nintendo Switch support

* Document the necessity for nimAllocPagesViaMalloc

* update changelog

* Use --gc:orc in examples
2021-08-11 08:54:49 +02:00
Timothee Cour
8ce782d463 Add optional recursive arg to distinctBase (v2) (#18659)
* Add optional recursive arg to distinctBase
* Add docs and examples

Co-authored-by: ALANVF <alan.invents@gmail.com>
2021-08-09 08:51:39 +02:00
Timothee Cour
988c02b7cb renamed: lib/std/private/vmutils.nim -> lib/std/private/bitops_utils.nim to avoid confusion with unrelated std/vmutils (#18660) 2021-08-08 19:24:45 -07:00
flywind
a7e622267e use lent (#18638) 2021-08-08 20:44:14 +02:00
flywind
916d0c21af fix #18620 (#18624)
* fix #18620

* add testcase
2021-08-01 11:19:43 +02:00
Miran
e616675c41 various small documentation improvements (#18602) 2021-07-28 14:31:13 +02:00
Andreas Rumpf
6dc34757b6 fixes #18579 (#18600) 2021-07-27 14:32:56 +02:00
Timothee Cour
cc0f02d57d rename nimFpRoundtrips => nimPreviewFloatRoundtrip (#18566) 2021-07-23 14:57:47 -07:00
Andreas Rumpf
01fc9e58ca fixes #18550 (#18553)
* fixes #18550

* update the manual to reflect reality
2021-07-21 16:55:50 +02:00
Timothee Cour
cf0cf32d27 make -d:nimFpRoundtrips work consistently in vm vs rt, fix #18400, etc (#18531)
* compiler/vmhooks: add getVar to allow vmops with var params
* addFloat vmops with var param
* cgen now renders float32 literals in c backend using roundtrip float to string
2021-07-20 22:13:52 +02:00
Araq
e38388eb4e use .} instead of } for code highlighters 2021-07-20 08:36:02 +02:00
Andreas Rumpf
25efb53862 make dragonbox opt-in via -d:nimFpRoundtrips (#18504)
* make dragonbox opt-in via -d:nimFpRoundtrips

* make tests green again

* make tests green again
2021-07-16 18:29:49 +02:00
Andreas Rumpf
af3d2d8ad9 added nimAllocPagesViaMalloc switch (#18490)
* added  switch

* alloc.nim needs page aligned memory blocks
2021-07-15 17:58:47 +02:00
Miran
0d74f60742 Revert "Make 'echo' raise IOErrors when appropriate (#16367)" (#18460)
This reverts commit 23d23ecb08.
2021-07-08 16:09:56 +02:00
Andreas Rumpf
3eb3e6b9a3 ORC: use =destroy instead of =dispose (#18440)
* ORC refactoring in preparation for further changes (=dispose must die)
* ORC: embrace =destroy, avoid =dispose
* ORC: no need for =dispose
* closes #18421
2021-07-07 09:39:01 +02:00
Andreas Rumpf
1bed777314 fixes #18411 (#18432) [backport:1.4] 2021-07-05 18:04:07 +02:00
Timothee Cour
779b4e307b don't use {.rtl.} for generics, otherwise -d:useNimRtl gives ambiguous identifier nimrtl error (#18406) 2021-07-01 11:14:01 +02:00
Andreas Rumpf
19263f2775 fixes #18400 (#18402) 2021-06-30 12:36:24 +02:00
Clyybber
808db3b284 Fix unused warning for $ on empty object (#18381) 2021-06-28 22:01:06 +02:00
Clyybber
6e74fecb42 Simplify addInt, remove digits10 (#18356)
* Simplify addInt, remove digits10

Co-authored-by: Charles Blake <charlechaud@gmail.com>

* Fix bootstrapping

* Add noInit to tmp array

* noInit -> noinit

Co-authored-by: Charles Blake <charlechaud@gmail.com>
2021-06-28 15:00:14 +02:00
Timothee Cour
b8f761b7e2 even lighter version of #17938: fix most issues with UnusedImport, XDeclaredButNotUsed, etc; fix #17511, #17510, #14246 (without realModule) (#18362)
* {.used: symbol}

* add tests

* fix tests with --import

* --import works without giving spurious unused warnings

* new warning warnDuplicateModuleImport for `import foo; import foo`

* fix test, add resolveModuleAlias, use proper line info for module aliases

* fix spurious warnings

* fix deprecation msg for deprecated modules even with `import foo as bar`

* disable a test for i386 pending sorting XDeclaredButNotUsed errors

* UnusedImport now works with re-exported symbols

* fix typo [skip ci]

* ic support

* add genPNode to allow writing PNode-based compiler code similarly to `genAst`

* fix DuplicateModuleImport warning

* adjust test

* fixup

* fixup

* fixup

* fix after rebase

* fix for IC

* keep the proc inline, move the const out

* [skip ci] fix changelog

* experiment: remove calls to resolveModuleAlias

* followup

* fixup

* fix tests/modules/tselfimport.nim

* workaround tests/deprecated/tmodule1.nim

* fix properly

* simplify
2021-06-26 15:21:46 +02:00
Timothee Cour
5badeea170 followup #18318: simplify dollarImpl and add a test (#18330) 2021-06-22 21:42:39 -07:00