Repository navigation
Pass an Array given to the first Fiber#resume as one argument - #10216
Open
evaniainbrooks wants to merge 1 commit into
Open
evaniainbrooks wants to merge 1 commit into
evaniainbrooks wants to merge 1 commit into
Conversation
The first resume or transfer packed its arguments into one value and started the block with yield semantics, so a single Array was spread over the block parameters. CRuby keeps the argument count and calls the block like Proc#call (rb_fiber_start in cont.c). Pass the raw arguments to a fiber that has not started and call the block with them. Fixes jruby#10129
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10129.
The first
Fiber#resumeorFiber#transferpacked its arguments into one value, then started the block with yield semantics. Soresume([a, b])spread the Array over the block parameters. CRuby keeps the argument count and calls the block likeProc#call(cont.c, rb_fiber_start).Now a fiber that has not started gets the raw arguments, and the block is called with
Block#call. Values passed to later resumes (returned byFiber.yield) are unchanged.Testing: added two examples to
spec/ruby/core/fiber/shared/resume.rb(runs for#resumeand#transfer).spec/ruby/core/fiberpasses on JRuby in interpreter and JIT mode. The new examples pass on CRuby 4.0.1 and 3.4.8.