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

ruby-changes:48533

From: mame <ko1@a...>
Date: Sat, 4 Nov 2017 22:31:52 +0900 (JST)
Subject: [ruby-changes:48533] mame:r60648 (trunk): gc.c (rb_free_tmp_buffer): stop accessing imemo_alloc as NODE

mame	2017-11-04 22:31:47 +0900 (Sat, 04 Nov 2017)

  New Revision: 60648

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60648

  Log:
    gc.c (rb_free_tmp_buffer): stop accessing imemo_alloc as NODE
    
    The fields of imemo_alloc were accessed via RNODE() cast, since the
    imemo was NODE_ALLOCA traditionally.  This was refactored at r60239,
    so now the fields should be accessed as imemo_alloc.  This prevented
    change of NODE structure.
    
    Yuichiro Kaneko pointed out this inconsistency.  Thanks!

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 60647)
+++ gc.c	(revision 60648)
@@ -8143,10 +8143,10 @@ rb_alloc_tmp_buffer(volatile VALUE *stor https://github.com/ruby/ruby/blob/trunk/gc.c#L8143
 void
 rb_free_tmp_buffer(volatile VALUE *store)
 {
-    VALUE s = ATOMIC_VALUE_EXCHANGE(*store, 0);
+    rb_imemo_alloc_t *s = (rb_imemo_alloc_t*)ATOMIC_VALUE_EXCHANGE(*store, 0);
     if (s) {
-	void *ptr = ATOMIC_PTR_EXCHANGE(RNODE(s)->u1.node, 0);
-	RNODE(s)->u3.cnt = 0;
+	void *ptr = ATOMIC_PTR_EXCHANGE(s->ptr, 0);
+	s->cnt = 0;
 	ruby_xfree(ptr);
     }
 }

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

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