summary refs log tree commit diff stats
path: root/lib/system/gc.nim
Commit message (Collapse)AuthorAgeFilesLines
* complete std prefixes for stdlib (#22887)ringabout2023-10-301-1/+1
| | | | follow up https://github.com/nim-lang/Nim/pull/22851 follow up https://github.com/nim-lang/Nim/pull/22873
* Markdown code blocks migration part 8 (#22478)Andrey Makarov2023-08-151-2/+4
|
* fix #12122 (#21096)Bung2022-12-161-12/+12
|
* ref #20694; quit value gets saturated to ranges (#20753)ringabout2022-11-051-2/+2
| | | | | | | | | | | | | | | | | | | | | * quit value gets saturated to ranges * add documentation * minimal changes * refactor * small fix * add documentation * fixes * Update lib/system.nim Co-authored-by: Juan Carlos <juancarlospaco@gmail.com> Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
* turn nimIncrSeqV3 into deadcode (#20388)ringabout2022-09-201-29/+2
|
* Remove the use of usrToCell in gcMark [backport:1.2] (#17709)zah2021-04-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* fixes #17647 (#17667)Andreas Rumpf2021-04-071-10/+10
|
* [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.
* cleaned up the internal documentation (#17524)Andreas Rumpf2021-03-261-0/+47
|
* fix deprecated messages regarding high (#15832)flywind2020-11-031-1/+1
|
* fixes #13881Andreas Rumpf2020-05-121-3/+4
| | | | | | * fixes #13881 * documented changed requirements for system.onThreadDestruction * destructors.rst: update the documentation
* Error -> Defect for defects (#13908)Jacek Sieka2020-04-281-1/+1
| | | | | | | | | | | | | | * Error -> Defect for defects The distinction between Error and Defect is subjective, context-dependent and somewhat arbitrary, so when looking at an exception, it's hard to guess what it is - this happens often when looking at a `raises` list _without_ opening the corresponding definition and digging through layers of inheritance. With the help of a little consistency in naming, it's at least possible to start disentangling the two error types and the standard lib can set a good example here.
* forward type alignment information to seqs (#12430)Arne Döring2020-04-191-7/+8
|
* catchable defects (#13626)Andreas Rumpf2020-03-121-2/+6
| | | | | | | | | | * allow defects to be caught even for --exceptions:goto (WIP) * implemented the new --panics:on|off switch; refs https://github.com/nim-lang/RFCs/issues/180 * new implementation for integer overflow checking * produce a warning if a user-defined exception type inherits from Exception directly * applied Timothee's suggestions; improved the documentation and replace the term 'checked runtime check' by 'panic' * fixes #13627 * don't inherit from Exception directly
* Unexport even more symbols (#13214)alaviss2020-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * system/gc: don't export markStackAndRegisters * compiler/cgen: unexport internal symbols As these functions are Nim-specific walkaround against C's optimization schemes, they don't serve any purpose being exported. * compiler/cgen: don't export global var unless marked * compiler/ccgthreadvars: don't export threadvar unless marked * tests/dll/visibility: also check for exports This ensure that these changes don't break manual exports. * compiler/cgen: hide all variables created for constants * compiler/ccgtypes: don't export RTTI variables * compiler/ccgexprs: make all complex const static * nimbase.h: fix export for windows * compiler/cgen, ccgthreadvars: export variables correctly For C/C++ variables, `extern` means that the variable is defined in an another unit. Added a new N_LIB_EXPORT_VAR to correctly export variables.
* proof that refcounting can handle Nim's async (#12533)Andreas Rumpf2019-10-281-1/+8
|
* minor improvementsAndreas Rumpf2019-10-271-1/+2
|
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* Fix -d:logGC compile cerror: 'stdout not defined' (#12237)treeform2019-09-241-5/+5
|
* styleCheck: make the compiler and large parts of the stdlib compatible with ↵Araq2019-07-101-6/+6
| | | | --styleCheck:error
* right shift is now by default sign preserving (#11322)Arne Döring2019-05-291-1/+1
| | | | | | | | | | | * right shift is now by default sign preserving * fix hashString and semfold * enable arithmetic shift right globally for CI * fix typo * remove xxx * use oldShiftRight as flag * apply feedback * add changelog entry
* code cleanup: there is no tyOptRefAndreas Rumpf2019-02-221-6/+6
|
* system refactorings (#10559)Andreas Rumpf2019-02-061-2/+4
| | | | | | | | * move IO subsystem into its own module; refs #10385 * make standalone test compile again * make C++ examples compile again * make more tests green * make sysAssert and gcAssert work again
* fix #10488 GC memory leak regression (#10498)Timothee Cour2019-01-301-1/+4
| | | | | | * fix #10488 GC memory leak regression * re-enable gch.stack.bottom.repr but only inside when defined(logGC)
* Increase verbosity of logGC (#10449)Matt Haggard2019-01-261-9/+16
| | | | | | * Increase verbosity of logGC * Remove & c.repr to avoid re-entering the GC
* GC: avoid pathological behaviour; fixes #10040 [backport] (#10052)Andreas Rumpf2018-12-201-9/+9
|
* Remove dead code (#9777)Jacek Sieka2018-11-261-80/+12
| | | | | | | | | * gc/gc2: remove unused ref counting stuff * also removes some false threading support - hasSharedHeap is always false in gc/gc2 * gc: remove some threading cruft * remove asgnRefNoCycle * compiler: remove TLoc.dup (unused)
* fixes #7833; still to-do: fix setLenAraq2018-07-301-1/+4
|
* warn about inconsistent spacing around binary operators; fixes #7582Andreas Rumpf2018-05-051-1/+1
|
* GC: enable precise global/thread local storage tracingAraq2018-01-151-19/+14
|
* GC improvements; distinguish between thread local and globals in the marking ↵Araq2018-01-141-72/+49
| | | | step
* gc.nim: Add a gcAssert to enforce the no heap sharing restrictionsAraq2018-01-121-0/+1
|
* Fixed mutex usage in SharedList and SharedTable. Closes #6988 (#6990)Yuriy Glukhov2017-12-311-1/+1
|
* more replacements for the deprecated '<'Andreas Rumpf2017-10-291-3/+3
|
* fixes #3558Araq2017-10-161-8/+9
|
* GCs: use add instead of &Andreas Rumpf2017-09-291-3/+3
|
* first steps of making 'opt' a first class type for NimAndreas Rumpf2017-09-251-6/+6
|
* fixes #6234Andreas Rumpf2017-08-111-0/+3
|
* added system.deallocHeap feature for Nim's native GCsAndreas Rumpf2017-07-221-15/+0
|
* make the GCs more robustAndreas Rumpf2017-07-201-9/+9
|
* decTypeSize on growObj (#5465)Yuriy Glukhov2017-03-151-0/+1
|
* adding support for using llvm ASAN (#5536)Samantha Marshall2017-03-141-1/+7
|
* Use constant nimCoroutines instead of defined(nimCoroutines)Rokas Kupstys2017-02-201-5/+5
| | | | Variable
* Cleanup of gc codeRokas Kupstys2017-02-201-87/+27
| | | | Cleanups
* Coroutines realtime supportRokas Kupstys2017-02-201-13/+36
|
* Reworked gc support for coroutines. Nim now bootstraps with -d:nimCoroutinesRokas Kupstys2017-02-201-15/+57
| | | | | Added gc test to coro.nim Lots of misc improvements and comments in coro.nim
* Delete fiber context when it exits (memleak fix)Rokas Kupstys2017-02-201-2/+5
| | | | Few correctness changes to gc stack management.
* Coroutine rework.Rokas Kupstys2017-02-201-3/+0
| | | | | | | | | | | | | | | * ucontext backend (default on unix) * setjmp backend * fibers backend (default and required on windows) * Fixed coroutine loop timing issues * Fixed saving of xmm registers on x64 windows * Fixed alignment issues * Updated coroutine sample with cooperative fibonacci calculation. * Disable glibc security features only when platform jump functions are used * Removed dependency on fasm. * Using fiber api on windows. * Other platforms and compilers will use built in assembler and .S files or API provided by platform libc. * Replaced stack switching procs with `coroExecWithStack()` which never returns. This makes compiler always generate proper code.
* system.nim: don't use deprecated symbols/constructsAraq2017-02-081-7/+7
|
* added test case; threadex example crashes nowAraq2017-01-301-1/+1
|