summaryrefslogtreecommitdiff
path: root/cont.c
AgeCommit message (Collapse)Author
2024-05-29merge revision(s) 6ade36c06b7cef948099b8f5f483763498705d12: [Backport #20414]Takashi Kokubun
`Fiber#raise` recursively raises on nested resuming_fiber. (#10482) * Improve consistency of `Fiber.current.raise`.
2024-05-29merge revision(s) 5d1702e01a36e11b183fe29ce10780a9b1a41cf0: [Backport #20413]Takashi Kokubun
Enumerator should use a non-blocking fiber, change `rb_fiber_new` to be non-blocking by default. (#10481)
2023-12-22FREE_AT_EXIT: Don't free main stack post-forkJohn Hawthorn
When a forked process was started in a thread, this would result in a double-free during the child process exit. RUBY_FREE_AT_EXIT=1 ./miniruby -e 'Thread.new { fork { } }.join; Process.waitpid' This is because the main thread in the forked process was not the initial VM thread, and the new thread's stack was freed as part of objectspace iteration. This change also allows rb_threadptr_root_fiber_release to run without EC being available.
2023-12-09[DOC] Small fixes for documentation renderingVictor Shepelev
Mostly just fixing RDoc's incorrect treatment of `+`
2023-12-08Improve Fiber#kill docs and simplify the NEWS entry to let the documentation ↵Benoit Daloze
explain
2023-12-07Free everything at shutdownAdam Hess
when the RUBY_FREE_ON_SHUTDOWN environment variable is set, manually free memory at shutdown. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-11-30YJIT: Cancel on-stack jit_return on invalidation (#9086)Takashi Kokubun
* YJIT: Cancel on-stack jit_return on invalidation Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> * Use RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P --------- Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2023-10-19Call rb_jit_cont_init() even earlierTakashi Kokubun
To fix https://github.com/ruby/ruby/actions/runs/6581593578/job/17881779994
2023-10-19Avoid initializing jit_cont_lock multiple timesTakashi Kokubun
Contrary to my initial assumption, rb_threadptr_root_fiber_setup() is called for each Ractor, not just once at boot. I changed the place to call rb_jit_cont_init() to avoid calling it multiple times.
2023-10-19YJIT: Add RubyVM::YJIT.enable (#8705)Takashi Kokubun
2023-08-24Fix support for dynamic keys. (#8273)Samuel Williams
* Skip RBS test. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-08-03Move a local variable declaration after the protected regionNobuyoshi Nakada
2023-06-10Add VM_ASSERT on `fiber->blocking == 0`. (#7926)Samuel Williams
I have not seen any problems with this code, but this ensures the invariant. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-25Allow environment variable to control madvise advice. (#7855)Samuel Williams
Introduce experimental support for explicitly specifying the `advice` value provided to `madvise` when releasing the fiber stack. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-18Add Fiber#kill, similar to Thread#kill. (#7823)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-03-09RJIT: Do nothing on jit_cont_freeTakashi Kokubun
if cont is NULL.
2023-03-08RJIT: Stop allowing leaked globals rjit_*Takashi Kokubun
2023-03-06s/mjit/rjit/Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7462
2023-02-26Adjust `else` style to be consistent in each files [ci skip]Nobuyoshi Nakada
2023-02-25Assigning `nil` to fiber storage deletes the association. (#7378)Samuel Williams
Also avoid allocations when looking up `Fiber#storage` if not needed. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-02-09Merge gc.h and internal/gc.hMatt Valentine-House
[Feature #19425] Notes: Merged: https://github.com/ruby/ruby/pull/7273
2022-12-23Docs: Fix problems with Fiber's docszverok
* References to Scheduler (was outdated to SchedulerInterface) * References between new methods (storage, [], []=) * Storage's call-sequence (rendered confusingly) Notes: Merged: https://github.com/ruby/ruby/pull/6985
2022-12-21[DOC] Fix formattingNobuyoshi Nakada
2022-12-20Use "Fiber storage variables" consistentlyBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/6974
2022-12-20Improve documentation for fiber-scoped variablesBenoit Daloze
* Especially around Enumerator. Notes: Merged: https://github.com/ruby/ruby/pull/6974
2022-12-20Ensure Fiber storage is only accessed from the Fiber it belongs toBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/6972
2022-12-20Use an experimental warning for Fiber#storage=Benoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/6972
2022-12-20Never use the storage of another Fiber, that violates the whole designBenoit Daloze
* See https://bugs.ruby-lang.org/issues/19078#note-30 Notes: Merged: https://github.com/ruby/ruby/pull/6972
2022-12-19Disable SEH workaround on __MINGW64__ only. (#6957)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-12-10Add spec for fiber storage. (#6896)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-12-01Introduce `Fiber#storage` for inheritable fiber-scoped variables. (#6612)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-11-16Using UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6721
2022-11-04Lower priority of `POSIX_MADV_DONTNEED`. (#6671)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-31Reuse FIBER_RESUMED_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6635
2022-10-25YJIT: GC and recompile all code pages (#6406)Takashi Kokubun
when it fails to allocate a new page. Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-10-19MJIT: Stop using the VM barrier for jit_contTakashi Kokubun
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-18Allow passing a Rust closure to rb_iseq_callback (#6575)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-10-17Make mjit_cont sharable with YJIT (#6556)Takashi Kokubun
* Make mjit_cont sharable with YJIT * Update dependencies * Update YJIT binding Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-10-15Update `Fiber::Scheduler` documentation. (#6562)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-12Improvements to IO::Buffer implementation and documentation. (#6525)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-06Introduce `Fiber.blocking{}` for bypassing the fiber scheduler. (#6498)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-09-20Try to ignore a noisy ASAN warning for continuationYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/6405
2022-07-26Rename rb_ary_tmp_new to rb_ary_hidden_newPeter Zhu
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. Notes: Merged: https://github.com/ruby/ruby/pull/6180
2022-07-20Prevent the stack from being marked twiceAaron Patterson
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. Notes: Merged: https://github.com/ruby/ruby/pull/6123
2022-06-13cont.c: prevent a warning of GCC 12.1Yusuke Endoh
... 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. Notes: Merged: https://github.com/ruby/ruby/pull/6010
2022-05-26Remove unnecessary ignore warnings.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5947
2022-05-25Ensure we retain the main fiber stack bounds.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5940
2022-05-25Tidy up redundant returns.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5926
2022-05-25Add support for address sanitizer for amd64 and arm64.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5926
2022-03-24Add ISEQ_BODY macroPeter Zhu
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. Notes: Merged: https://github.com/ruby/ruby/pull/5698