ruby-changes:48130
From: nobu <ko1@a...>
Date: Sat, 21 Oct 2017 18:10:48 +0900 (JST)
Subject: [ruby-changes:48130] nobu:r60244 (trunk): fix up imemo_alloc
nobu 2017-10-21 18:10:42 +0900 (Sat, 21 Oct 2017) New Revision: 60244 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60244 Log: fix up imemo_alloc * internal.h (rb_imemo_alloc_struct), gc.c (gc_mark_imemo): turned next into the pointer to chain. * parse.y (NEWHEAP): needs a cast. Modified files: trunk/gc.c trunk/internal.h trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 60243) +++ parse.y (revision 60244) @@ -11517,7 +11517,7 @@ rb_parser_set_yydebug(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/parse.y#L11517 #ifndef RIPPER #ifdef YYMALLOC #define HEAPCNT(n, size) ((n) * (size) / sizeof(YYSTYPE)) -#define NEWHEAP() rb_imemo_new(imemo_alloc, 0, (VALUE)parser->heap, 0, 0) +#define NEWHEAP() (rb_imemo_alloc_t *)rb_imemo_new(imemo_alloc, 0, (VALUE)parser->heap, 0, 0) #define ADD2HEAP(n, c, p) ((parser->heap = (n))->ptr = (p), \ (n)->cnt = (c), (p)) Index: gc.c =================================================================== --- gc.c (revision 60243) +++ gc.c (revision 60244) @@ -4532,10 +4532,14 @@ gc_mark_imemo(rb_objspace_t *objspace, V https://github.com/ruby/ruby/blob/trunk/gc.c#L4532 rb_iseq_mark((rb_iseq_t *)obj); return; case imemo_alloc: - rb_gc_mark_locations(RANY(obj)->as.imemo.alloc.ptr, - RANY(obj)->as.imemo.alloc.ptr + RANY(obj)->as.imemo.alloc.cnt); - rb_gc_mark(RANY(obj)->as.imemo.alloc.next); + { + const rb_imemo_alloc_t *m = &RANY(obj)->as.imemo.alloc; + do { + rb_gc_mark_locations(m->ptr, m->ptr + m->cnt); + } while ((m = m->next) != NULL); + } return; + case imemo_mask: break; #if VM_CHECK_MODE > 0 default: VM_UNREACHABLE(gc_mark_imemo); @@ -9376,6 +9380,7 @@ rb_raw_obj_info(char *buff, const int bu https://github.com/ruby/ruby/blob/trunk/gc.c#L9380 IMEMO_NAME(iseq); IMEMO_NAME(alloc); #undef IMEMO_NAME + case imemo_mask: break; } snprintf(buff, buff_size, "%s %s", buff, imemo_name); Index: internal.h =================================================================== --- internal.h (revision 60243) +++ internal.h (revision 60244) @@ -934,7 +934,7 @@ typedef struct rb_imemo_alloc_struct { https://github.com/ruby/ruby/blob/trunk/internal.h#L934 VALUE flags; VALUE reserved; VALUE *ptr; /* malloc'ed buffer */ - VALUE next; /* next imemo */ + struct rb_imemo_alloc_struct *next; /* next imemo */ size_t cnt; /* buffer size in VALUE */ } rb_imemo_alloc_t; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/