summaryrefslogtreecommitdiff
path: root/cont.c
Commit message (Collapse)AuthorAgeFilesLines
* MJIT: Stop using the VM barrier for jit_contTakashi Kokubun2022-10-191-13/+22
| | | | | | | | | | | | | | | | 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.
* Allow passing a Rust closure to rb_iseq_callback (#6575)Takashi Kokubun2022-10-181-2/+2
|
* Make mjit_cont sharable with YJIT (#6556)Takashi Kokubun2022-10-171-15/+116
| | | | | | | * Make mjit_cont sharable with YJIT * Update dependencies * Update YJIT binding
* Update `Fiber::Scheduler` documentation. (#6562)Samuel Williams2022-10-151-339/+1
|
* Improvements to IO::Buffer implementation and documentation. (#6525)Samuel Williams2022-10-121-8/+29
|
* Introduce `Fiber.blocking{}` for bypassing the fiber scheduler. (#6498)Samuel Williams2022-10-061-0/+32
|
* Try to ignore a noisy ASAN warning for continuationYusuke Endoh2022-09-201-0/+2
|
* Rename rb_ary_tmp_new to rb_ary_hidden_newPeter Zhu2022-07-261-1/+1
| | | | | | 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.
* Prevent the stack from being marked twiceAaron Patterson2022-07-201-0/+6
| | | | | | | 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.
* cont.c: prevent a warning of GCC 12.1Yusuke Endoh2022-06-131-0/+4
| | | | | | | | | | | | | | ... by assigning a dummy value to the allocated stack. http://rubyci.s3.amazonaws.com/arch/ruby-master/log/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.
* Remove unnecessary ignore warnings.Samuel Williams2022-05-261-5/+1
|
* Ensure we retain the main fiber stack bounds.Samuel Williams2022-05-251-3/+14
|
* Tidy up redundant returns.Samuel Williams2022-05-251-3/+1
|
* Add support for address sanitizer for amd64 and arm64.Samuel Williams2022-05-251-2/+40
|
* Add ISEQ_BODY macroPeter Zhu2022-03-241-1/+1
| | | | | | 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.
* Fix potential memory leak at fiber poolNobuyoshi Nakada2022-03-181-2/+2
| | | | | Do not "allocate then wrap". It leaks the allocated memory if failed to create the wrapper.
* Fix compilation error with `RB_EXPERIMENTAL_FIBER_POOL`Nobuyoshi Nakada2022-03-181-1/+4
|
* [DOC]Fix FreeBSD Bugzilla linkS-H-GAMELINKS2022-03-151-1/+1
|
* Fix conversion macro for `size_t`Nobuyoshi Nakada2022-03-131-2/+2
|
* Fix experimental Fiber::Pool definitionNobuyoshi Nakada2022-03-131-1/+1
| | | | | Toplevel `Pool` is too generic, and `struct fiber_pool` does not seem compatible with `rb_fiber_t`.
* `rb_fiber_terminate` must not return [Bug #18497]Nobuyoshi Nakada2022-01-191-1/+2
| | | | | | | | 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.
* Negative RBOOL usageNobuyoshi Nakada2022-01-011-1/+1
|
* Tidy up fiber scheduler interface documentation for `address_resolve` and ↵Samuel Williams2021-12-211-14/+34
| | | | `timeout_after`.
* Update cont.cSamuel Williams2021-12-211-8/+23
|
* Add SchedulerInterface#timeout_after and #address_resolve docszverok2021-12-211-0/+39
|
* Document Fiber::SchedulerInterface#io_read and #io_writezverok2021-12-211-1/+67
|
* Fix conflicting declaration on SolarisNobuyoshi Nakada2021-11-301-2/+1
| | | | | | | | | | | | | | | | | | | | 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); | ^~~~~~~ ```
* Workaround for implicit declaration of function 'madvise' on SolarisNaohisa Goto2021-11-301-0/+8
| | | | | | | | 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.
* rb_fiber_raise(): add doxygen卜部昌平2021-09-301-2/+2
| | | | Must not be a bad idea to improve documents.
* Expose `rb_fiber_raise` and tidy up the internal implementation.Samuel Williams2021-09-201-71/+94
|
* Suppress format-pedantic warningsNobuyoshi Nakada2021-09-021-4/+4
|
* Remove root_jmpbuf in rb_thread_structNobuyoshi Nakada2021-08-101-2/+0
| | | | It has not been used since 1b82c877dfa72e8505ded149fd0e3ba956529d3f.
* Remove unneeded rb_fiber_transfer_kw declarationS-H-GAMELINKS2021-08-071-2/+0
|
* Using RBOOL macroS.H2021-08-021-7/+2
|
* Adjust styles [ci skip]Nobuyoshi Nakada2021-07-181-2/+4
| | | | * --procnames-start-lines
* cont.c: fix formatting of RDoc for Fiber classKazuki Yamaguchi2021-07-171-2/+2
|
* Replace copy coroutine with pthread implementation.Samuel Williams2021-07-011-70/+71
|
* cont.c: Replace "iff" with "if and only if"nagachika2021-06-121-1/+1
|
* Suppress clobbered warnings on Travis-CI ppc64le-linuxNobuyoshi Nakada2021-06-031-1/+1
|
* Expose `rb_fiber_transfer` and `rb_fiber_transfer_kw`.Samuel Williams2021-06-031-3/+3
|
* Fix some typos by spell checkerRyuta Kamizono2021-04-261-2/+2
|
* Fix handling of timeout accessing scheduler outside of non-blocking context.Samuel Williams2021-03-301-0/+15
|
* fiber context update for Mac OS.David CARLIER2021-03-291-1/+11
| | | | | | | it is more about memory accounting sake. At allocation time, we make clear we re possibly reusing regions marked as reusable. Noted also calls might not necessarily succeed at first so we do only when necessary.
* solaris/illumos build fix.David Carlier2021-03-221-0/+2
|
* [DOC] some methods of Fiber do not need to require anymore [Feature #17407]Kazuhiro NISHIYAMA2021-03-221-8/+3
|
* Renamed functions for Fiber singleton methodsNobuyoshi Nakada2021-03-121-9/+8
|
* Constified variables for getenvNobuyoshi Nakada2021-03-121-1/+1
|
* rb_fiber_terminate never returnsNobuyoshi Nakada2021-02-241-2/+3
|
* Send :fiber_switch event for almost every fiber_switch (#4207)nicholas a. evans2021-02-221-18/+18
| | | | | | | | | | | | | | | | | | | With this patch, TracePoint receives a `:fiber_switch` event for _almost_ every fiber switch. Previously, it would not be sent when an exception was going to be raised. Now the event should only be blockable by an interrupt (including `Thread#raise`) or a fatal error. Additionally, interrupts will now be checked on the return fiber _before_ re-raising the terminating unhandled exception. And a fiber that terminates with an unhandled exception no longer creates a pending interrupt on its thread. The exception will be raised in the return fiber the same way as `Fiber#raise`: using `cont.value` with `cont.argc == -1` I moved `rb_exc_raise` from `fiber_store` to the end of `fiber_switch` after _all_ of the other cleanup code: `fiber_stack_release`, `th->blocking` increment, `RUBY_VM_CHECK_INTS`, and `EXEC_EVENT_HOOK`. It seems to me that skipping those other cleanup steps may have also resulted in other bugs.
* Expose scheduler as public interface & bug fixes. (#3945)Samuel Williams2021-02-091-7/+8
| | | | | | | | | * Rename `rb_scheduler` to `rb_fiber_scheduler`. * Use public interface if available. * Use `rb_check_funcall` where possible. * Don't use `unblock` unless the fiber was non-blocking.