diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-19 09:48:47 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-19 09:48:47 +0000 |
commit | 301223df95b523ad355ccfe24da74028f4a77f5d (patch) | |
tree | 562f5ee2f35b2db39279cd5d67adc7e03962aeaf /gc.c | |
parent | 1d2fbdcf250e0231816094883cf49fe3ab30bd7d (diff) | |
download | ruby-301223df95b523ad355ccfe24da74028f4a77f5d.tar.gz |
* gc.c (rb_gc_resurrect): added.
rb_fstring() used rb_gc_mark() to avoid freeing used string.
However, rb_gc_mark() set mark bit *and* pushes mark_stack.
rb_gc_resurrect() does only set mark bit if it is before sweeping.
* string.c (rb_fstring): use rb_gc_resurrect.
* internal.h: add decl.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -3571,6 +3571,20 @@ rb_gc_mark(VALUE ptr) gc_mark(&rb_objspace, ptr); } +/* resurrect non-marked `obj' if obj is before swept */ + +void +rb_gc_resurrect(VALUE obj) +{ + rb_objspace_t *objspace = &rb_objspace; + + if (is_lazy_sweeping(heap_eden) && + !gc_marked(objspace, obj) && + !is_swept_object(objspace, obj)) { + gc_mark_ptr(objspace, obj); + } +} + static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr) { |