Commit graph

488 commits

Author SHA1 Message Date
Matt Valentine-House
72aba64fff Merge gc.h and internal/gc.h
[Feature #19425]
2023-02-09 10:32:29 -05:00
zverok
c621c6140a Docs: Fix problems with Fiber's docs
* References to Scheduler (was outdated to SchedulerInterface)
* References between new methods (storage, [], []=)
* Storage's call-sequence (rendered confusingly)
2022-12-23 18:09:49 +02:00
Nobuyoshi Nakada
9f42ee3e52
[DOC] Fix formatting 2022-12-21 14:34:40 +09:00
Benoit Daloze
33debffdd3 Use "Fiber storage variables" consistently 2022-12-20 23:05:56 +01:00
Benoit Daloze
4495dea153 Improve documentation for fiber-scoped variables
* Especially around Enumerator.
2022-12-20 23:05:56 +01:00
Benoit Daloze
0efa36ac06 Ensure Fiber storage is only accessed from the Fiber it belongs to 2022-12-20 19:32:23 +01:00
Benoit Daloze
d557f17974 Use an experimental warning for Fiber#storage= 2022-12-20 19:32:23 +01:00
Benoit Daloze
45175962a6 Never use the storage of another Fiber, that violates the whole design
* See https://bugs.ruby-lang.org/issues/19078#note-30
2022-12-20 19:32:23 +01:00
Samuel Williams
6073782627
Disable SEH workaround on __MINGW64__ only. (#6957) 2022-12-19 13:45:50 +13:00
Samuel Williams
22d391dc63
Add spec for fiber storage. (#6896) 2022-12-10 13:54:53 +13:00
Samuel Williams
0436f1e15a
Introduce Fiber#storage for inheritable fiber-scoped variables. (#6612) 2022-12-01 23:00:33 +13:00
S-H-GAMELINKS
1f4f6c9832 Using UNDEF_P macro 2022-11-16 18:58:33 +09:00
Samuel Williams
2bb89b7f11
Lower priority of POSIX_MADV_DONTNEED. (#6671) 2022-11-04 20:13:48 +13:00
S-H-GAMELINKS
c3de08cb24 Reuse FIBER_RESUMED_P macro 2022-10-31 19:57:46 +13:00
Takashi Kokubun
b7644a2311
YJIT: GC and recompile all code pages (#6406)
when it fails to allocate a new page.

Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2022-10-25 09:07:10 -07:00
Takashi Kokubun
d9d9005a3a
MJIT: Stop using the VM barrier for jit_cont
This solves multiple problems.

First, RB_VM_LOCK_ENTER/LEAVE is a barrier. We could at least use the
_NO_BARRIER variant.

Second, this doesn't need to interfere with GC or other GVL users when
multiple Ractors are used. This needs to be used in very few places, so
the benefit of fine-grained locking would outweigh its small maintenance
cost.

Third, it fixes a crash for YJIT. Because YJIT is never disabled until a
process exits unlike MJIT that finishes earlier, we could call jit_cont_free
when EC no longer exists, which crashes RB_VM_LOCK_ENTER.
2022-10-19 17:20:48 -07:00
Takashi Kokubun
e7166c9bb7
Allow passing a Rust closure to rb_iseq_callback (#6575) 2022-10-18 09:07:11 -07:00
Takashi Kokubun
e7c71c6c92
Make mjit_cont sharable with YJIT (#6556)
* Make mjit_cont sharable with YJIT

* Update dependencies

* Update YJIT binding
2022-10-17 09:27:59 -07:00
Samuel Williams
7fcad1fa03
Update Fiber::Scheduler documentation. (#6562) 2022-10-15 21:43:45 +13:00
Samuel Williams
ced1d17280
Improvements to IO::Buffer implementation and documentation. (#6525) 2022-10-12 12:59:05 +13:00
Samuel Williams
e696ec67ac
Introduce Fiber.blocking{} for bypassing the fiber scheduler. (#6498) 2022-10-06 23:00:49 +13:00
Yusuke Endoh
b3d8dddee7 Try to ignore a noisy ASAN warning for continuation 2022-09-20 22:25:05 +09:00
Peter Zhu
efb91ff19b Rename rb_ary_tmp_new to rb_ary_hidden_new
rb_ary_tmp_new suggests that the array is temporary in some way, but
that's not true, it just creates an array that's hidden and not on the
transient heap. This commit renames it to rb_ary_hidden_new.
2022-07-26 09:12:09 -04:00
Aaron Patterson
1341dea771 Prevent the stack from being marked twice
This commit prevents the stack from being marked twice: once via the
Fiber, and once via the Thread.  It introduces an assertion to assert
that the ec on the thread is the same as the ec on the Fiber being
marked via the thread.
2022-07-20 13:45:55 -07:00
Yusuke Endoh
5060c9d852 cont.c: prevent a warning of GCC 12.1
... by assigning a dummy value to the allocated stack.

20220613T000004Z.log.html.gz
```
cont.c: In function ‘cont_restore_0.constprop’:
cont.c:1489:28: warning: ‘*sp’ may be used uninitialized [-Wmaybe-uninitialized]
 1489 |                 space[0] = *sp;
      |                            ^~~
```

Also it adds some comments about the hack of dummy stack allocation.
2022-06-13 15:18:28 +09:00
Samuel Williams
2556e15d75 Remove unnecessary ignore warnings. 2022-05-26 16:51:53 +12:00
Samuel Williams
86602484a2 Ensure we retain the main fiber stack bounds. 2022-05-25 21:50:53 +12:00
Samuel Williams
9a8fc4e04c Tidy up redundant returns. 2022-05-25 15:24:24 +12:00
Samuel Williams
901525b107 Add support for address sanitizer for amd64 and arm64. 2022-05-25 15:24:24 +12:00
Peter Zhu
5f10bd634f Add ISEQ_BODY macro
Use ISEQ_BODY macro to get the rb_iseq_constant_body of the ISeq. Using
this macro will make it easier for us to change the allocation strategy
of rb_iseq_constant_body when using Variable Width Allocation.
2022-03-24 10:03:51 -04:00
Nobuyoshi Nakada
f69a969544 Fix potential memory leak at fiber pool
Do not "allocate then wrap".  It leaks the allocated memory if
failed to create the wrapper.
2022-03-18 00:42:15 +09:00
Nobuyoshi Nakada
cdf25cad6b Fix compilation error with RB_EXPERIMENTAL_FIBER_POOL 2022-03-18 00:42:15 +09:00
S-H-GAMELINKS
f27770679f [DOC]Fix FreeBSD Bugzilla link 2022-03-15 09:23:57 +09:00
Nobuyoshi Nakada
2af8b04eca
Fix conversion macro for size_t 2022-03-13 21:10:33 +09:00
Nobuyoshi Nakada
e081f333fe
Fix experimental Fiber::Pool definition
Toplevel `Pool` is too generic, and `struct fiber_pool` does not
seem compatible with `rb_fiber_t`.
2022-03-13 21:09:17 +09:00
Nobuyoshi Nakada
d650b17686
rb_fiber_terminate must not return [Bug #18497]
In a forked process from a fiber, the fiber becomes the only
fiber, `fiber_switch` does nothing as there is no other fibers,
`rb_fiber_terminate` does not terminate the fiber.  In that case,
reaches the end of `fiber_entry` finaly, which is declared as
"COROUTINE" and should never return.
2022-01-19 19:57:16 +09:00
Nobuyoshi Nakada
069cca6f74
Negative RBOOL usage 2022-01-01 17:02:04 +09:00
Samuel Williams
02a9a72f43 Tidy up fiber scheduler interface documentation for address_resolve and timeout_after. 2021-12-21 17:22:55 +13:00
Samuel Williams
711342d935 Update cont.c 2021-12-21 12:32:54 +13:00
zverok
eae5a34be3 Add SchedulerInterface#timeout_after and #address_resolve docs 2021-12-21 12:32:54 +13:00
zverok
224dfb2d6e Document Fiber::SchedulerInterface#io_read and #io_write 2021-12-21 12:32:54 +13:00
Nobuyoshi Nakada
12fbdf4d4e
Fix conflicting declaration on Solaris
SunC
```
"cont.c", line 24: identifier redeclared: madvise
	current : function(pointer to char, unsigned int, int) returning int
	previous: function(pointer to void, unsigned int, int) returning int : "/usr/include/sys/mman.h", line 232
```

GCC
```
cont.c:24:12: error: conflicting types for 'madvise'
   24 | extern int madvise(caddr_t, size_t, int);
      |            ^~~~~~~
In file included from cont.c:16:
/usr/include/sys/mman.h:232:12: note: previous declaration of 'madvise' was here
  232 | extern int madvise(void *, size_t, int);
      |            ^~~~~~~
```
2021-11-30 09:10:58 +09:00
Naohisa Goto
8287d2f23c Workaround for implicit declaration of function 'madvise' on Solaris
On Solaris, madvise(3C) is NOT defined for SUS (XPG4v2) or later,
but MADV_* macros are defined when __EXTENSIONS__ is defined.
This may cause compile error on Solaris 10 with GCC when
"-Werror=implicit-function-declaration" and "-D_XOPEN_SOURCE=600"
are added by configure.
2021-11-30 00:03:04 +09:00
卜部昌平
90f2ab9d62 rb_fiber_raise(): add doxygen
Must not be a bad idea to improve documents.
2021-09-30 20:55:23 +13:00
Samuel Williams
88ba5fe547 Expose rb_fiber_raise and tidy up the internal implementation. 2021-09-20 18:30:51 +12:00
Nobuyoshi Nakada
9c5ad5d42d
Suppress format-pedantic warnings 2021-09-02 08:47:47 +09:00
Nobuyoshi Nakada
28d03ee776 Remove root_jmpbuf in rb_thread_struct
It has not been used since 1b82c877df.
2021-08-10 19:08:38 +09:00
S-H-GAMELINKS
ac7986f46a Remove unneeded rb_fiber_transfer_kw declaration 2021-08-07 17:18:20 +12:00
S.H
378e8cdad6
Using RBOOL macro 2021-08-02 12:06:44 +09:00
Nobuyoshi Nakada
ab37e6ee7e
Adjust styles [ci skip]
* --procnames-start-lines
2021-07-18 19:55:07 +09:00