зеркало из https://github.com/github/ruby.git
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f5f328d497
Коммит
719531dba5
11
gc.c
11
gc.c
|
@ -4532,10 +4532,14 @@ gc_mark_imemo(rb_objspace_t *objspace, VALUE obj)
|
|||
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 buff_size, VALUE obj)
|
|||
IMEMO_NAME(iseq);
|
||||
IMEMO_NAME(alloc);
|
||||
#undef IMEMO_NAME
|
||||
case imemo_mask: break;
|
||||
}
|
||||
snprintf(buff, buff_size, "%s %s", buff, imemo_name);
|
||||
|
||||
|
|
|
@ -934,7 +934,7 @@ typedef struct rb_imemo_alloc_struct {
|
|||
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;
|
||||
|
||||
|
|
2
parse.y
2
parse.y
|
@ -11517,7 +11517,7 @@ rb_parser_set_yydebug(VALUE self, VALUE flag)
|
|||
#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))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче