Commit Graph

828 Commits

Author SHA1 Message Date
Andreas Rumpf
895e2aea15 Merge pull request #5317 from rokups/feature/coroutines
Coroutine improvements
2017-02-26 23:24:29 +01:00
Araq
4f062c3be0 removed onThreadCreation; onThreadDestruction is now thread local 2017-02-26 20:42:19 +01:00
Rokas Kupstys
f80ddbbcc6 Use constant nimCoroutines instead of defined(nimCoroutines)
Variable
2017-02-20 17:24:19 +02:00
Rokas Kupstys
9f8863169a Cleanup of gc code
Cleanups
2017-02-20 17:24:19 +02:00
Rokas Kupstys
d69b701dde Coroutines realtime support 2017-02-20 17:24:19 +02:00
Rokas Kupstys
c3d1b732d6 Reworked gc support for coroutines. Nim now bootstraps with -d:nimCoroutines
Added gc test to coro.nim
Lots of misc improvements and comments in coro.nim
2017-02-20 17:24:19 +02:00
Rokas Kupstys
ff1bf74554 Delete fiber context when it exits (memleak fix)
Few correctness changes to gc stack management.
2017-02-20 17:24:19 +02:00
Rokas Kupstys
9a754156d7 Added support for exceptions in coroutines and added exception test
Fix bug where first coroutine ending would terminate main loop
2017-02-20 17:24:19 +02:00
Rokas Kupstys
373e667dbc Coroutine rework.
* 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.
2017-02-20 17:24:19 +02:00
Andreas Rumpf
ba29ca0c63 Merge branch 'devel' into faster-nimsuggest 2017-02-17 10:48:01 +01:00
araq
1811e51ff5 fixes #5392 2017-02-15 22:09:16 +01:00
Anatoly Galiulin
6fa1dba515 Add `tearDownForeignThreadGc` function (#5369) 2017-02-13 13:37:20 +01:00
Araq
9b8150aef1 sysio: check for IO errors for write operations 2017-02-11 00:23:22 +01:00
Andreas Rumpf
0bb18d1821 introduce nimMaxHeap define to fight memory overcommit 2017-02-10 09:22:28 +01:00
Araq
a20b4c674e sysio: minor improvements 2017-02-09 20:11:54 +01:00
Andreas Rumpf
52c38f8535 make tests green again 2017-02-08 22:42:48 +01:00
Andreas Rumpf
d23eb79849 make tests green again 2017-02-08 22:21:01 +01:00
Araq
3caf108425 system/unicode: check for buffer overflows; refs #5284 2017-02-08 15:22:36 +01:00
Araq
346ea6d171 system.nim: don't use deprecated symbols/constructs 2017-02-08 14:55:30 +01:00
Araq
794d36cf31 fixes #5349 2017-02-08 14:33:05 +01:00
Anatoly Galiulin
61b4bb5af5 Mark setupForeignThreadGc and initGC as gcsafe (#5353) 2017-02-08 10:26:15 +01:00
Yuriy Glukhov
3978845266 Use __NR_gettid instead of SYS_gettid (#5338) 2017-02-04 21:18:54 +01:00
Andreas Rumpf
04c4d3d77f critical realloc bugfix; refs #4818 2017-02-03 09:48:52 +01:00
Andreas Rumpf
f04d21f279 refactoring: explict config state instead of globals 2017-02-01 23:39:40 +01:00
Araq
b3e55e532b allocator: fixes regression: get alignment right for small objects 2017-01-31 21:21:08 +01:00
Andreas Rumpf
d12a5a6525 make getThreadId() work on OSX 2017-01-31 16:06:37 +01:00
araq
bd580e9d6e another attempt to getThreadId work on Linux 2017-01-31 15:44:11 +01:00
araq
eaa0eda72d make getThreadId() work on Linux 2017-01-31 13:49:32 +01:00
Araq
c32c39f1de make AVL tree node part of the memory regions; fixes hard to reproduce channel crashes 2017-01-31 13:08:47 +01:00
Araq
d59dd577f8 make AVL tree node part of the memory regions; fixes hard to reproduce channel crashes 2017-01-31 13:08:23 +01:00
Araq
b173499543 added system.getThreadId for various OSes (untested) 2017-01-31 13:06:19 +01:00
Araq
082f6f15e7 dirty changes to Nim's memory tracker; requires cleanups 2017-01-31 12:59:12 +01:00
Andreas Rumpf
51c764e048 fix the racy allocator properly 2017-01-31 08:55:18 +01:00
Araq
79f4b37d3b added test case; threadex example crashes now 2017-01-30 21:11:37 +01:00
Araq
b26e6e3589 fixes #5301 2017-01-30 19:01:03 +01:00
Andreas Rumpf
cb6c975d3a fixes repr regression 2017-01-27 07:06:22 +01:00
Andreas Rumpf
8d3d9ce5cc repr.nim: minor improvement when outputting addresses of cstrings 2017-01-26 23:50:19 +01:00
Andreas Rumpf
f7e3addb89 bugfix: onThreadDestruction callbacks should be run in reverse order 2017-01-26 11:28:25 +01:00
Andreas Rumpf
05a3c1b10a improvements to memtracking 2017-01-26 11:26:02 +01:00
Andreas Rumpf
303c49b9f3 memory tracker is aware of threads (still not threadsafe though) 2017-01-26 11:26:02 +01:00
Jeff Ciesielski
7f30d04d6a Fix compilation for 16 bit targets (#5286) 2017-01-26 07:05:03 +01:00
Andreas Rumpf
eb96eaa5c2 onThreadDestruction feature added to Nim's threading model 2017-01-24 12:07:44 +01:00
Araq
572fd067cf added system.runOnThreadCreationHandlers for initialization of thread local storage for the main thread 2017-01-20 20:32:41 +01:00
Araq
cdebcf23d9 new segfaults.nim stdlib module works on Windows 2017-01-20 17:08:11 +01:00
Araq
64a7d2fd08 ansi_c.nim: avoid deprecated 'expr' type 2017-01-20 13:17:45 +01:00
Andreas Rumpf
61937974e2 added system.onThreadCreation feature for safe thread local storage initializations 2017-01-18 13:41:55 +01:00
Andreas Rumpf
915cc86f5d docs for the heap dump feature 2017-01-16 23:04:53 +01:00
Andreas Rumpf
03916fa3b1 M&S GC gets the heap dump feature 2017-01-15 10:12:28 +01:00
Andreas Rumpf
823fbd4e40 default GC can do a sort of heap dump via -d:nimTypeNames and dumpNumberOfInstances() 2017-01-14 04:00:06 +01:00
Andreas Rumpf
9753782f96 memory allocator hotfix: do not allocate tremendous amounts of memory 2017-01-13 12:07:37 +01:00