diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-25 13:19:45 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-25 13:19:45 +0000 |
commit | fdb771d82db5c258757d3e2f18102eca680ecfd5 (patch) | |
tree | d844d16e6f337254d83927ec61e063cf5307007d /parse.y | |
parent | 872b9ec89665e5d4fb557ae6ed50eab1a3303fbc (diff) | |
download | ruby-fdb771d82db5c258757d3e2f18102eca680ecfd5.tar.gz |
Make imemo_alloc writebarrier-unprotected
imemo_alloc provides a memory buffer whose contents are marked by GC.
C code can access imemo_alloc buffer freely, so imemo_alloc must be
considered writebarrier-unprotected. But T_IMEMO is writebarrier-
protected by default, which caused a GC bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -11538,6 +11538,7 @@ rb_parser_malloc(struct parser_params *parser, size_t size) size_t cnt = HEAPCNT(1, size); rb_imemo_alloc_t *n = NEWHEAP(); void *ptr = xmalloc(size); + rb_gc_writebarrier_unprotect((VALUE)n); return ADD2HEAP(n, cnt, ptr); } @@ -11548,6 +11549,7 @@ rb_parser_calloc(struct parser_params *parser, size_t nelem, size_t size) size_t cnt = HEAPCNT(nelem, size); rb_imemo_alloc_t *n = NEWHEAP(); void *ptr = xcalloc(nelem, size); + rb_gc_writebarrier_unprotect((VALUE)n); return ADD2HEAP(n, cnt, ptr); } @@ -11569,6 +11571,7 @@ rb_parser_realloc(struct parser_params *parser, void *ptr, size_t size) } n = NEWHEAP(); ptr = xrealloc(ptr, size); + rb_gc_writebarrier_unprotect((VALUE)n); return ADD2HEAP(n, cnt, ptr); } |