Commit Graph

1545 Commits

Author SHA1 Message Date
Andreas Rumpf
fb86271556 system.nim cleanup some exported constants which should never have be… (#17909)
* system.nim cleanup some exported constants which should never have been exported
2021-05-01 11:10:40 +02:00
flywind
22e06ee95a Ref #17831(synchapi.h: No such file or directory) (#17832)
* Ref #17831 use windows.h

* use header: "windows.h"

* Update syslocks.nim

* Update lib/system/syslocks.nim
2021-04-25 10:34:53 +02:00
flywind
53c898de41 fix #17812 (repr fails to compile with ARC/ORC) (#17816) 2021-04-22 08:08:56 +02:00
Clyybber
6de5aa1971 Rename = to =copy in stdlib (#17781) 2021-04-19 13:16:10 +02:00
flywind
dc89b21257 [std/locks]close #7998(complete condition variables) (#17711)
* close #7998
* workaround genode

* Update lib/system/syslocks.nim
2021-04-19 10:51:13 +02:00
Timothee Cour
42c6eec4ef fix #17749 ignore SIGPIPE signals, fix nim CI #17748 (#17752)
* fix #17749 SIGPIPE

* fix for windows
2021-04-18 15:34:29 +02:00
Timothee Cour
7e94420847 cString => cSourceString; tyCString => tyCstring so that error msgs show cstring, not cString (#17744) 2021-04-17 11:14:09 +02:00
flywind
12783dbcf0 make the copy operation of Thread an error (#17734) 2021-04-16 08:50:44 +02:00
zah
3b47a689cf Remove the use of usrToCell in gcMark [backport:1.2] (#17709)
* Remove the use of usrToCell in gcMark [backport:1.2]

Recently, we've discovered a GC crash resulting from inlining of
the memory allocation procs that allowed the compiler to avoid
maintaining any references to the "user pointer" on the stack.
Instead, a "cell pointer" appeared there and all field accesses
were performed with adjusted offsets. This interfered with the
ability of the GC to mark the correct cell in the conservative
stack scans which lead to premature collection of objects.

More details here:
af69b3ceae

This commit closes another theoretical loophole that may lead to
the same problem. If a short proc is accessing both the object and
its reference count in a short sequence of instructions, the compiler
may be enticed to reduce the number of registers being used by storing
only a single pointer to the object and using offsets when reading
and writing fields. A perfectly good strategy would be to store only
the cell pointer, so the reference count updates can be performed
without applying offsets. Accessing the fields of the object requires
offsets anyway, but these can be adjusted at compile-time without any
loss. Following this strategy will lead to the same problem of marking
a wrong cell during the conservative stack scan, leading to premature
collection.

The problem is avoided by not using `usrToCell` in `gcMark`. Since
the cell discovery logic can already handle interior pointers, the
user pointers don't need to be adjusted for the GC to function correctly.
2021-04-14 12:10:01 +02:00
Emery Hemingway
8aa5991bea Genode platform fixes (#17521)
* Genode: move dyncall failures to runtime

Do not use the "error" pragma to warn that dynamic library loading is
not implemented, print a message at runtime and exit.

* Genode: use stricter dataspace type in page allocator

* Genode: remove compiler configuration from nim.cfg

Self-hosting Nim is not supported on Genode and defining the
cross-compilation environment can be done externally.

* Genode: use new mutex API

* Genode: call nim_component_construct as a C procedure

* Genode: implement echo for NimStringV2
2021-04-09 16:29:10 +02:00
Andrey Makarov
42687457b0 further progress on rst roles & directives (fix #17646) (#17659)
* further progress on rst roles & dir-s (fix #17646)

* fix documents according to the messages

* fix bug 17 from #17340
2021-04-08 19:00:14 +02:00
Andreas Rumpf
bd7807de4c fixes #17647 (#17667) 2021-04-07 23:26:53 +02:00
Andreas Rumpf
939df8cbda ensure the avr example keeps compiling (#17663)
* ensure the avr example keeps compiling

* Update tests/avr/thello.nim

* now compiles properly
2021-04-07 13:40:57 +02:00
Timothee Cour
aa4f18eff0 items(array)+friends: remove a RT comparison (#17650) 2021-04-06 11:11:30 +02:00
Timothee Cour
270964c487 implement RFCs/294 ; disallow enum <=> enum conversion (#16351)
* fix https://github.com/nim-lang/RFCs/issues/294 ; disallow enum <=> enum conversion
* fix the runnableExamples that was the instigator of this RFC
* legacy -d:nimLegacyConvEnumEnum
* use -d:nimLegacyConvEnumEnum in important_package nimgame2
* add test for enum cast
* improve changelog
* add changelog: Changes affecting backward compatibility
* cleanup changelog
* fix changelog
2021-04-03 07:15:21 +02:00
flywind
7c09e0c757 fix #15617(fix compilation failure on -d:useMalloc --gc:none) (#17555)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-03-30 20:15:14 +02:00
Miran
40093b4a93 [backport:1.2] Avoid inlining of newObj and newObjRC1 calls (#17582)
This is taken from:
af69b3ceae

Full original comment:

This is to avoid heavy inlining happening when two allocation calls
would occur shortly after each other.

This inlining would sometimes be accompanied with an optimisation
as the compiler is able to see that cellToUsr ending the first
allocation call is shortly followed by an usrToCell call. The
pointer arithmetic is redundant and the compiler can eliminate it,
leaving only the cell address in a register (and later the stack)
instead of the actual pointer to the user data, as one would expect.

This combined with a GC collect cycle will cause the stack scan to
only notice the cell address, which is of no good due to a usrToCell
in the gcMark call which shifts that address to an adjacent cell.
This means that the actual cell of importance will not get marked
and thus cause a premature collection of that cell. BOOM.
2021-03-30 10:20:58 +02:00
Clyybber
a672ec3c9e Fix #17299, fix setAffinity for android (#17574)
* Fix #17299

* Comment

* Fix typo
2021-03-30 08:05:37 +02:00
flywind
7ad49950bd [os:standalone]fix #14011 (#17564) 2021-03-29 17:54:28 +02:00
flywind
e5be216ccb [docs]close #12580 (#17549) 2021-03-28 20:21:27 -07:00
flywind
a36816fc04 follow up #17539 (#17548)
* fix nim js cmp fails at CT

* follow up #17539
2021-03-29 09:11:07 +08:00
rockcavera
b77a420d3e set const arch64 to fix compiling with vcc/icc (#17539) 2021-03-28 13:11:51 +08:00
Andreas Rumpf
3e03f67335 cleaned up the internal documentation (#17524) 2021-03-26 16:27:55 +01:00
flywind
c8dda867f2 close #11330 sets uses optimized countSetBits (#17334)
* Update lib/pure/bitops.nim
* Update lib/system/sets.nim
* Apply suggestions from code review

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-03-22 00:36:48 +01:00
Derek 呆
fd09ace557 prevent bitmasks double included in mmdist if -d:nimArcDebug added (#17436) 2021-03-21 14:29:39 +01:00
Andreas Rumpf
6c1c8f51b3 IC: green tests (#17311)
* IC: renamed to_packed_ast module to ic module

* IC: don't store the --forceBuild flag, makes it easier to test

* IC: enable hello world test

* Codegen: refactorings for IC; changed the name mangling algorithm

* fixed the HCR regressions

* life is too short for HCR

* tconvexhull is now allowed to use deepCopy

* IC exposed a stdlib bug, required a refactoring

* codegen: code cleanups

* IC: even if a module is outdated, its dependencies might come from disk

* IC: progress

* IC: better name mangling, module IDs are not stable

* IC: another refactoring helping with --ic:on --gc:arc

* disable arraymancer on Windows for the time being

* disable arraymancer altogether

* IC: make basic test work with 'nim cpp'

* IC: progress on --ic:on --gc:arc

* wip; name mangling for type info
2021-03-19 16:53:38 +01:00
flywind
2e730f1452 rename channels to channels_builtin (#17330)
* improve test coverage for isolation

* a bit better

* rename channels to channels_builtin
2021-03-12 13:04:32 +01:00
konsumlamm
9819fb21d8 Use .. warning:: (#17320) 2021-03-10 10:39:23 -08:00
flywind
0e3ea16554 use lowercase --define switches (#17283) 2021-03-07 12:08:41 +01:00
Andreas Rumpf
8f1fa3e5b0 IC: further progress (#17150)
* IC: respect the -f switch

* IC: better rod file inspection

* progress
2021-03-05 09:58:55 +01:00
Jason Beetham
f28dc2c61e Added assertion to clamp (#17248)
Co-authored-by: flywind <xzsflywind@gmail.com>
2021-03-04 17:27:02 -08:00
Timothee Cour
f561afae41 followup #17225: simplify code after removing gc2, generational (#17242) 2021-03-03 13:37:42 +01:00
Clyybber
507873be25 Use readable escape sequences (#17241) 2021-03-03 07:15:07 +01:00
flywind
a04c9d1f62 rename prepareStrMutation to prepareMutation (#17235)
* remove unnecessary when statement

* remove outdated codes

* rename prepareStrMutation to prepareMutation
2021-03-03 08:08:52 +08:00
flywind
dfa0a6b4a6 add runnableExamples for prepareStrMutation (#17227)
* Update lib/system.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-03-02 12:52:07 +01:00
Andreas Rumpf
bb0c19f42c fixes #17173 (#17213)
* fixes #17173

* add testcase (#17214)

* Apply suggestions from code review

* fix for newruntime

* Apply suggestions from code review

* Update lib/system.nim

* Update lib/system.nim

* Update lib/system.nim

Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>

Co-authored-by: flywind <xzsflywind@gmail.com>
Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>
2021-03-01 20:58:12 +01:00
Danil Yarantsev
82d8e9bff3 Replace double backticks with single backticks - Part 2 out of ~6 (#17206) 2021-02-28 23:15:26 -08:00
Danil Yarantsev
ac8166ab3d Replace double backticks with single backticks - Part 1 out of ~6 (#17205) 2021-02-28 23:08:12 -08:00
Danil Yarantsev
56461c280f Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
Timothee Cour
11a7fa68f6 fix #17159 items(cstring) works in VM (#17160)
* fix #17159 items(cstring) works in VM

* improve test coverage tests/stdlib/tcstring.nim; add helpers: whenRuntimeJs, whenVMorJs

* document items(cstring)

* address comments
2021-02-24 14:01:06 +01:00
Timothee Cour
c274e67198 add enumutils.items for sparse enums, typetraits.SomeSparseEnum (#17080)
* add enumutils.items for enum with holes
* changelog
* ref in lib.rst
* use `type SomeSparseEnum* = (not Ordinal) and enum` instead of concept
* address comment: rename back to enum with holes
2021-02-23 20:25:35 +01:00
Danil Yarantsev
4e619a6bea A few rst doc fixes (#17151)
* Fix a couple of rst formatting issues

* no need for the extra space
2021-02-23 08:59:13 +01:00
Timothee Cour
ce7caec4b3 add io.readChars overload (simpler, less error prone) (#16044)
* add simpler to use readChars overload

* use new readChars overload

* Update lib/wrappers/openssl.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2021-02-22 20:13:08 +01:00
flywind
70ec17eede use single backtick (#17133) 2021-02-21 00:27:39 -08:00
Andrey Makarov
d1fec552d0 stricter checks for RST headlines (#17089) 2021-02-20 18:01:45 +01:00
alaviss
ccc0667c29 system/excpt: let the OS handle termination on signal (#16712) 2021-02-19 00:29:21 -08:00
flywind
cd274a5ac9 fix stringify unsigned integer in JS and JS VM (#17086)
* fix js unsigned integer

* better
2021-02-18 20:13:52 +01:00
Timothee Cour
31bb67a309 add -d:nimStrictMode in CI to keep code from regressing; fixes ConvFromXtoItselfNotNeeded, UnusedImport notes (#16764) 2021-02-17 19:30:09 +01:00
Andreas Rumpf
f32ffb6ed8 fixes #17033 [backport:1.4] (#17061)
* fixes #17033 [backport:1.4]

* make test robust against stdlib gensym things

* cleanup assertions.nim to make topt_no_cursor easier to get right
2021-02-17 11:00:03 +01:00
Timothee Cour
b9994925f5 remove all uses of condsyms symbols defined prior to bootstrap nim 0.20.0 (#16918)
* nimNoArrayToCstringConversion deadcode
* nimbabel deadcode
* nimHasalignOf deadcode
* nimvarargstyped deadcode
* nimhygiene deadcode
* nimNewTypedesc deadcode
* nimlocks deadcode
* nimHasCppDefine deadcode
* nimHasRunnableExamples deadcode
* nimHasNilChecks deadcode
* nimSymKind deadcode
* minor macros refactoring
* nimVmEqIdent deadcode
* nimNoNil deadcode
* nimNoZeroTerminator deadcode
* nimHasSymOwnerInMacro deadcode
* nimVmExportFixed deadcode
* nimNewRuntime deadcode
* nimAshr deadcode
* nimUncheckedArrayTyp deadcode
* nimHasTypeof deadcode
* nimErrorProcCanHaveBody deadcode
* nimHasHotCodeReloading deadcode
* nimHasSignatureHashInMacro deadcode
* nimHasDefault deadcode
* nimMacrosSizealignof deadcode
2021-02-17 09:32:36 +01:00