Skip to content

Doubling the call stack when extending it#6310

Merged
matz merged 1 commit into
mruby:masterfrom
dearblue:ci-extend
Jul 31, 2024
Merged

Doubling the call stack when extending it#6310
matz merged 1 commit into
mruby:masterfrom
dearblue:ci-extend

Conversation

@dearblue

Copy link
Copy Markdown
Contributor

Previously it was "approximately double".


Simulating the current behavior and this patch's behavior, the following is shown:

  • before this patch

    % ruby -e 'size = 32; limit = 512; loop { size = (size - 1) * 2; p size; break if size >= limit }'
    62
    122
    242
    482
    962
  • after this patch

    % ruby -e 'size = 32; limit = 512; loop { size = size * 2; p size; break if size >= limit }'
    64
    128
    256
    512

Previously it was "approximately double".
@dearblue dearblue requested a review from matz as a code owner July 21, 2024 13:26
@github-actions github-actions Bot added the core label Jul 21, 2024
@matz

matz commented Jul 30, 2024

Copy link
Copy Markdown
Member

I am not sure about the benefit of this change. Could you explain, please?

@dearblue

Copy link
Copy Markdown
Contributor Author

Thank you for your review.

As presented as a simulation, the current expansion is roughly twice as wide.
If exactly doubled, it would be more predictable when specifying MRB_CALL_LEVEL_MAX.

@matz

matz commented Jul 31, 2024

Copy link
Copy Markdown
Member

Understood. I admit there's no clear benefit from the current behavior. Accepted.

@matz matz merged commit a668e6d into mruby:master Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants