Граф коммитов

63 Коммитов

Автор SHA1 Сообщение Дата
Samuel Williams 1862d961a9 Ignore dead threads in `coroutine_join`. 2021-07-02 12:36:14 +12:00
Samuel Williams 42130a64f0
Replace copy coroutine with pthread implementation. 2021-07-01 11:23:03 +12:00
Benoit Daloze 229cbeba8c Fix -Wundef warnings in coroutine/*/Context.h
* See [Feature #17752]

Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
2021-05-04 14:56:55 +02:00
David CARLIER 68a8f611e0 coroutine: Darwin on ARM64 needs alignment of 2^2 2021-04-01 23:51:06 +13:00
Samuel Williams b507f65d44 Support for native riscv64 coroutines. 2021-03-30 19:23:17 +13:00
David CARLIER 816a1d97fd coroutine mac m1 update.
using proper link register and frame pointer which equal x30/x29.
2021-03-22 23:32:07 +09:00
David Carlier 0ead818d81 Generating note.GNU-stack section for FreeBSD on x86.
Not enabling for ELF in general as not all platform support it
 (e.g. NetBSD, implictly stack never executable).
2021-03-05 14:33:52 +13:00
David Carlier c230ccdba6 coroutine arm64 generating note.GNU-stack section for linux. 2021-03-05 14:26:00 +13:00
Yusuke Endoh 62283f7a7a coroutine/emscripten/: Experimentally support emscripten fiber API 2021-01-23 18:56:06 +09:00
Nobuyoshi Nakada 07b4b1b1cb
Support coroutine on universal binary 2021-01-22 23:41:52 +09:00
Nobuyoshi Nakada f1c36f2e6b
Added include guards to coroutine headers 2021-01-22 23:21:25 +09:00
Samuel Williams 09229c71bc Fix "Ruby is not properly fortified on armv7hl".
See <https://bugs.ruby-lang.org/issues/16762> for more details.
2020-12-08 23:37:42 +13:00
Nobuyoshi Nakada d2b7e1e4b2
Protoized old pre-ANSI K&R style definitions 2020-12-05 14:57:31 +09:00
Samuel Williams 3b5b309b7b Proposed method for dealing with stack locals which have non-local lifetime. 2020-12-05 11:38:56 +13:00
Samuel Williams 15e23312f6 Rework the order of operations to avoid stack smashing. 2020-12-05 11:38:56 +13:00
Nobuyoshi Nakada 41168f69fb
Prefix export symbol prefix to coroutine_transfer 2020-07-05 17:27:12 +09:00
Nobuyoshi Nakada 04c704c5c9
Removed trailing spaces [ci skip] 2020-07-05 17:12:20 +09:00
Paul Jordan 0091fac1d8 Patch assembly so that it aligns properly 2020-04-01 15:49:02 +13:00
卜部昌平 ce4ea956d2 function pointers are not void*
The same as 8427fca49b.
2020-02-06 11:46:51 +09:00
Samuel Williams bf04fe086b
Remove "All Rights Reserved." from Copyright statement. 2019-12-28 12:45:37 +13:00
Samuel Williams f96216df8d
Remove "All Rights Reserved." from Copyright statement. 2019-12-28 12:41:47 +13:00
Jeremy Evans f05416c91f Fix coroutine copy implementation on OpenBSD
OpenBSD is the only platform that uses this support by default,
and it did not work because while OpenBSD supports alloca, it does
not include alloca.h.

This should be backported to Ruby 2.7.

From George Koehler
2019-12-27 15:01:01 -08:00
卜部昌平 5e22f873ed decouple internal.h headers
Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead.  This would significantly
speed up incremental builds.

We take the following inclusion order in this changeset:

1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
    first thing among everything).
2.  RUBY_EXTCONF_H if any.
3.  Standard C headers, sorted alphabetically.
4.  Other system headers, maybe guarded by #ifdef
5.  Everything else, sorted alphabetically.

Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
2019-12-26 20:45:12 +09:00
Yusuke Endoh f4d9daf2b6 coroutine/ucontext/Context.c: define __EXTENSIONS__ explicitly
instead of ruby/config.h, per samuel's request.

dbfd4b780e (diff-7fd78c3cc8a19b7e0637502983ec26ff)
2019-12-05 22:24:58 +09:00
Yusuke Endoh dbfd4b780e coroutine/ucontext/Context.c: Include "ruby/config.h" for Solaris
getcontext, makecontext, and swapcontext seem to be available only when
`__EXTENSION__` is defined on Solaris.
2019-12-04 20:59:39 +09:00
Lars Kanis 853d91a04a Fix coroutine support on win32
Ruby master branch currently fails on win32 MINGW at this spec:
https://github.com/ruby/spec/blob/master/core/thread/element_set_spec.rb

MINGW makes use of setjmp3() implemented in MSVCRT.DLL.
This function traverses the SEH list up to a terminating pointer 0xFFFFFFFF.
It therefore currently segfaults on NULL.
The SEH linked list must be terminated by 0xFFFFFFFF instead of NULL.

This fixes the issue mentioned here:
  https://github.com/ruby/ruby/pull/2279#issuecomment-509508810
2019-11-05 15:31:21 +09:00
Samuel Williams e14f5762c5
Add assertions to `coroutine_initialize_main`. 2019-07-19 15:55:34 +12:00
Samuel Williams dd0e33f083
Split assertions to check which one fails. 2019-07-19 15:53:47 +12:00
Samuel Williams 001f187ed6
Make fiber_pool more conservative on platforms with limited address space.
We use COROUTINE_LIMITED_ADDRESS_SPACE to select platforms where address
space is 32-bits or less. Fiber pool implementation enables more book
keeping, and reduces upper limits, in order to minimise address space
utilisation.
2019-07-18 20:54:55 +12:00
Samuel Williams 91aae651bf
Stack copying implementation of coroutines. 2019-07-18 20:54:54 +12:00
Lars Kanis 68e5804022
Add coroutine context switch for i386-mingw32
It's essentially a translation of Context.asm from Intel
to AT&T syntax.
2019-07-07 21:33:47 +12:00
Samuel Williams acb67472c7 Restore updated implementation of arm32 coroutine code, but prefer ucontext. 2019-06-26 22:02:28 +12:00
Yusuke Endoh 28eeaed8a9 Revert "coroutine/arm32/Context.S: save/restore the registers via stack"
This reverts commit 6df1814c08.

It caused a SEGV again:
https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20190626T051707Z.fail.html.gz
2019-06-26 17:23:00 +09:00
Samuel Williams 6c6bf9ffcb Add `ucontext` coroutine implementation for generic fallback. 2019-06-26 20:19:53 +12:00
Yusuke Endoh 6df1814c08 coroutine/arm32/Context.S: save/restore the registers via stack
Retry of 518adcca0a and dbe232e24e
2019-06-26 14:08:10 +09:00
Yusuke Endoh 730aeb2523 Revert 518adcca0a and dbe232e24e
518adcca0a: "Try using arm32 implementation for fibers."
dbe232e24e: "Order of arguments might be incorrect in arm32 coroutine implementation."

It seems to cause SEGV consistently on Ubuntu armv7l eabihf:

https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20190625T081710Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20190625T111708Z.fail.html.gz
2019-06-25 23:32:26 +09:00
Samuel Williams dbe232e24e Order of arguments might be incorrect in arm32 coroutine implementation. 2019-06-25 17:04:04 +12:00
Nobuyoshi Nakada e29a85a96c
Make COROUTINE_XMM_REGISTERS compile-time only too 2019-05-17 13:16:39 +09:00
Nobuyoshi Nakada e0f0ab959e
Remove unused symbols 2019-05-16 21:58:42 +09:00
Nobuyoshi Nakada a160b2f567
Make COROUTINE_REGISTERS compile-time only not to be a global symbol 2019-05-16 15:52:09 +09:00
samuel dc6908ab44 Ensure x86 stack is fortified, fixed #15335.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-11 23:49:33 +00:00
odaira 3a5cc345f8 Native coroutine implementation for ppc64le Linux
* configure.ac: enable fiber coroutine for powerpc64le-linux

* coroutine/ppc64le/Context.S: coroutine_transfer implementation

* coroutine/ppc64le/Context.h: coroutine implementation

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-10 23:22:56 +00:00
nobu c5fe904f6e Fix for coroutine/win32/Context.obj
* coroutine/win32/Context.asm: old ml version 9 needs CPU
  directive before `.model` directive.

* win32/Makefile.sub: specify object directories to separate Win32
  and Win64 targets.  Win32 rule was overridden by Win64 rule and
  just ignored.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-28 01:04:39 +00:00
samuel f33adbc11e Ensure stack is correctly protected
See https://bugs.ruby-lang.org/issues/15335 for more details.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24 11:35:34 +00:00
samuel e64f71f812 Change Makefile rule for assembly to use .S rather than .s
It is more conventional to use compiler to pre-process and
assemble the `.S` file rather than forcing Makefile to use `.s`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24 11:35:29 +00:00
samuel 6459112852 Fix argument order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24 02:31:11 +00:00
samuel 26adef94fa Fix indentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 20:09:38 +00:00
samuel 495dffba43 GAS style assembly for win64 (mingw).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:18:16 +00:00
samuel 0ba0ad8b41 Fix struct usage.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:18:01 +00:00
samuel 49e920855a Fix line endings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:17:49 +00:00