[前][次][番号順一覧][スレッド一覧]

ruby-changes:61652

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Wed, 10 Jun 2020 10:22:55 +0900 (JST)
Subject: [ruby-changes:61652] 5648976c3c (master): vm_call_method: avoid marking on-stack object

https://git.ruby-lang.org/ruby.git/commit/?id=5648976c3c

From 5648976c3c207b0f750a5ce26ba4862c63f6a626 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Wed, 10 Jun 2020 10:19:48 +0900
Subject: vm_call_method: avoid marking on-stack object

This callcache is on stack, must not be GCed.  However its contents are
copied from other materials, which can be an ordinal object.  Should
set a flag to make sure it is properly skipped by the GC.

diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 65bebd3..611739e 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3183,7 +3183,8 @@ vm_call_method(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_ca https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3183
 		else {
 		    /* caching method info to dummy cc */
 		    VM_ASSERT(vm_cc_cme(cc) != NULL);
-                    const struct rb_callcache cc_on_stack = *cc;
+                    struct rb_callcache cc_on_stack = *cc;
+                    FL_SET_RAW((VALUE)&cc_on_stack, VM_CALLCACHE_UNMARKABLE);
                     struct rb_call_data dummy = {
                         .ci = ci,
                         .cc = &cc_on_stack,
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]