summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2025-06-18 13:18:22 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2026-05-05 13:27:43 -0700
commit4d2a5af522c105e4f2f5b2e8eb9f4865b0374da5 (patch)
tree58eabcc860e5ecb2c8cb92e238041ceadca209aa
parent0d29d548e44a82855d6eb71b02bcccbd82ec5355 (diff)
Use write barrier version for rb_proc_call_kw
-rw-r--r--proc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index ea36f3253e..b1417a4729 100644
--- a/proc.c
+++ b/proc.c
@@ -1127,7 +1127,12 @@ rb_proc_call_kw(VALUE self, VALUE args, int kw_splat)
VALUE vret;
rb_proc_t *proc;
int argc = check_argc(RARRAY_LEN(args));
- const VALUE *argv = RARRAY_CONST_PTR(args);
+
+ // rb_vm_invoke_proc may end up modifying argv as part of calling and so we
+ // must use RARRAY_PTR, which marks the array as WB_UNPROTECTED instead of
+ // RARRAY_CONST_PTR. Unfortunately this is worse for GC.
+ // See invoke_block_from_c_proc
+ VALUE *argv = RARRAY_PTR(args);
GetProcPtr(self, proc);
vret = rb_vm_invoke_proc(GET_EC(), proc, argc, argv,
kw_splat, VM_BLOCK_HANDLER_NONE);