Skip to content

Need to restore the GC arena after some function calls#6341

Merged
matz merged 1 commit into
mruby:masterfrom
dearblue:restore-arena
Sep 4, 2024
Merged

Need to restore the GC arena after some function calls#6341
matz merged 1 commit into
mruby:masterfrom
dearblue:restore-arena

Conversation

@dearblue

@dearblue dearblue commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

When calling mrb_equal() or mrb_funcall() family functions, the GC arena should be restored if the loop is repeated by a non-immediate return value.

In my opinion, restoring the GC arena is unnecessary when a non-immediate (true) value causes the function to return (e.g. the mrb_ary_index_m() function).

The patch does not take into account the case of recursive calls and may be incomplete.

When calling `mrb_equal()` or `mrb_funcall()` family functions, the GC arena should be restored if the loop is repeated by a non-immediate return value.

In my opinion, restoring the GC arena is unnecessary when a non-immediate (true) value causes the function to return (e.g. the `mrb_ary_index_m()` function).

The patch does not take into account the case of recursive calls and may be incomplete.
@dearblue
dearblue requested a review from matz as a code owner September 3, 2024 13:06
@matz
matz merged commit 6491626 into mruby:master Sep 4, 2024
@matz

matz commented Sep 4, 2024

Copy link
Copy Markdown
Member

As a general principle equal operations should not allocate any object (if possible), and we don't need to restore the arena index in those cases. I merged this PR just to be conservative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants