summary refs log tree commit diff stats
path: root/lib/system
Commit message (Collapse)AuthorAgeFilesLines
* Fix unused warning for $ on empty object (#18381)Clyybber2021-06-281-1/+1
|
* Simplify addInt, remove digits10 (#18356)Clyybber2021-06-282-10/+4
| | | | | | | | | | | | | * 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>
* even lighter version of #17938: fix most issues with UnusedImport, ↵Timothee Cour2021-06-261-29/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* followup #18318: simplify `dollarImpl` and add a test (#18330)Timothee Cour2021-06-221-7/+0
|
* merge similar procs regarding digits (#18318)flywind2021-06-224-135/+19
|
* convert code-blocks to runnableExamples in io (#18315)xioren2021-06-211-16/+15
| | | Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* move {.injectStmt.} to experimental; add a test (#18300)Timothee Cour2021-06-201-0/+1
| | | | | * move {.injectStmt.} to experimental; add a test * undocument and deprecat `.injectStmt` but keep its implementation until we have a replacement
* Revert "system/excpt: check if the exception is not nil before pop (#18247)" ↵Andreas Rumpf2021-06-171-3/+2
| | | | | (#18265) This reverts commit 0adb47aa15e242983c8251d85367c0fe45fc5f12.
* system/excpt: check if the exception is not nil before pop (#18247)alaviss2021-06-141-2/+3
| | | | | | | | | | In CPS we would consume an exception in the except branch by stashing it into a local then remove the exception from Nim environment so as not to leak it to other code that would be running before the continuation continues However since popCurrentException() assumes that the exception always exist, removing the exception from an except branch will cause a SIGSEGV to happen. This commit fixes that.
* fix #7717 roundtrip float to string; fix `parseFloat` for js (#18248)Timothee Cour2021-06-131-48/+41
| | | | | | | * refs #7717 roundtrip float to string * make parseFloat more correct * improve float tests * improve float tests * cleanup
* use more meaningful name than "workaround14447" (#18237)Miran2021-06-111-1/+1
|
* fix 18186 with adding importc _umul128 (#18200)slangmgh2021-06-072-1/+3
|
* added float32 schubfach algorithm; wip (#18155)Andreas Rumpf2021-06-033-0/+468
| | | | | * added float32 schubfach algorithm; wip * fixes #18418
* fix #16993, #18054, #17835 runnableExamples now works with templates and ↵Timothee Cour2021-06-021-29/+18
| | | | nested templates (#18082)
* use dragonbox algorithm; alternative to #18008 (#18139)Andreas Rumpf2021-06-012-46/+1398
| | | | | * use dragonbox algorithm; alternative to #18008 * removed unsafe code
* close #18129 Add setCurrentException for JS backend (#18145)flywind2021-06-011-0/+3
| | | | | | | | | | | * [std/re] make interface consistent * tiny * revert * close #18129 add setCurrentException * changelog entry
* asyncdispatch+stackTraceOverride: fix premature collection (#18039) ↵Ștefan Talpalaru2021-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | [backport:1.2] Copying StackTraceEntry instances when nimStackTraceOverride is defined breaks the link between a cstring field that's supposed to point at another string field in the same object. Sometimes, the original object is garbage collected, that memory region reused for storing other strings, so when the StackTraceEntry copy tries to use its cstring pointer to construct a traceback message, it accesses unrelated strings. This only happens for async tracebacks and this patch prevents that by making sure we only use the string fields when nimStackTraceOverride is defined. Async tracebacks also beautified slightly by getting rid of an extra line that was supposed to be commented out, along with the corresponding debugging output. There's also a micro-optimisation to avoid concatenating two strings just to get their combined length.
* ARC: fixes memory leaks with newSeq used in a loop [backport:1.4] (#18040)Andreas Rumpf2021-05-181-0/+4
| | | | * ARC: fixes memory leaks with newSeq used in a loop [backport:1.4] * Update tests/arc/tnewseq_legacy.nim
* Revert "fix #14873 properly by skipping `abi` field in importc type ↵Andreas Rumpf2021-05-151-0/+8
| | | | | (#17944)" (#17992) This reverts commit 98c29c01eb91a0c6ce7da09380a272eebe6bca6f.
* ORC: progress (#18000)Andreas Rumpf2021-05-121-9/+22
| | | | | | | | | * ORC: progress * ORC: bugfix; don't follow acyclic data even if only at runtime the subtype is marked as acyclic * progress * minor style changes
* fix #17941: UnusedImport works for var/let/const/type invoked inside a ↵Timothee Cour2021-05-081-2/+1
| | | | | | | generic (#17942) * fix #17941: UnusedImport works for var/let/const/type invoked inside a generic * fixup
* fix #14873 properly by skipping `abi` field in importc type (#17944)Timothee Cour2021-05-071-8/+0
| | | | | | | * fix #14873 properly by skipping `abi` field in importc type * add test * fix test for windows
* remove unsused OsPlatform.nimVM (#17953)Timothee Cour2021-05-071-2/+1
|
* Fix C++ compilation error in excpt.nim (#17951)Danil Yarantsev2021-05-061-1/+1
|
* minor cleanups (#17948)Andreas Rumpf2021-05-061-1/+1
|
* system.nim cleanup some exported constants which should never have be… ↵Andreas Rumpf2021-05-014-3/+23
| | | | | | (#17909) * system.nim cleanup some exported constants which should never have been exported
* Ref #17831(synchapi.h: No such file or directory) (#17832)flywind2021-04-251-2/+1
| | | | | | | | | * Ref #17831 use windows.h * use header: "windows.h" * Update syslocks.nim * Update lib/system/syslocks.nim
* fix #17812 (repr fails to compile with ARC/ORC) (#17816)flywind2021-04-221-1/+1
|
* Rename `=` to `=copy` in stdlib (#17781)Clyybber2021-04-191-1/+1
|
* [std/locks]close #7998(complete condition variables) (#17711)flywind2021-04-193-43/+48
| | | | | | * close #7998 * workaround genode * Update lib/system/syslocks.nim
* fix #17749 ignore SIGPIPE signals, fix nim CI #17748 (#17752)Timothee Cour2021-04-181-3/+13
| | | | | * fix #17749 SIGPIPE * fix for windows
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-174-4/+4
| | | | cstring, not cString (#17744)
* make the copy operation of Thread an error (#17734)flywind2021-04-161-0/+2
|
* Remove the use of usrToCell in gcMark [backport:1.2] (#17709)zah2021-04-142-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: https://github.com/status-im/Nim/commit/af69b3ceae16281efd45cbee4ce1bedd14282304 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.
* Genode platform fixes (#17521)Emery Hemingway2021-04-091-6/+6
| | | | | | | | | | | | | | | | | | | * 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
* further progress on rst roles & directives (fix #17646) (#17659)Andrey Makarov2021-04-081-1/+1
| | | | | | | * further progress on rst roles & dir-s (fix #17646) * fix documents according to the messages * fix bug 17 from #17340
* fixes #17647 (#17667)Andreas Rumpf2021-04-073-17/+17
|
* ensure the avr example keeps compiling (#17663)Andreas Rumpf2021-04-071-0/+4
| | | | | | | * ensure the avr example keeps compiling * Update tests/avr/thello.nim * now compiles properly
* items(array)+friends: remove a RT comparison (#17650)Timothee Cour2021-04-061-8/+8
|
* implement RFCs/294 ; disallow enum <=> enum conversion (#16351)Timothee Cour2021-04-031-1/+1
| | | | | | | | | | | * 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
* fix #15617(fix compilation failure on -d:useMalloc --gc:none) (#17555)flywind2021-03-301-0/+10
| | | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* [backport:1.2] Avoid inlining of newObj and newObjRC1 calls (#17582)Miran2021-03-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | This is taken from: https://github.com/status-im/Nim/commit/af69b3ceae16281efd45cbee4ce1bedd14282304 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.
* Fix #17299, fix setAffinity for android (#17574)Clyybber2021-03-301-2/+17
| | | | | | | * Fix #17299 * Comment * Fix typo
* [os:standalone]fix #14011 (#17564)flywind2021-03-291-2/+8
|
* [docs]close #12580 (#17549)flywind2021-03-281-2/+2
|
* follow up #17539 (#17548)flywind2021-03-291-1/+1
| | | | | * fix nim js cmp fails at CT * follow up #17539
* set const arch64 to fix compiling with vcc/icc (#17539)rockcavera2021-03-281-0/+1
|
* cleaned up the internal documentation (#17524)Andreas Rumpf2021-03-262-1/+81
|
* close #11330 sets uses optimized countSetBits (#17334)flywind2021-03-222-5/+73
| | | | | | | * Update lib/pure/bitops.nim * Update lib/system/sets.nim * Apply suggestions from code review Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* prevent bitmasks double included in mmdist if -d:nimArcDebug added (#17436)Derek 呆2021-03-211-1/+2
|