diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-17 19:59:56 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-17 19:59:56 +0000 |
commit | cad4591086b285fa5c8fb61f19692b9a521dcea7 (patch) | |
tree | d5cced02e3e1a3e9a89ff0862f83ee5bdb35f658 /vm.c | |
parent | 3a55e8a4360fbcd1c8db05eba4d8e7e365dd4547 (diff) |
remove branches in dmark and dfree GC callbacks
dmark and dfree callbacks are never called in gc.c for NULL
DATA_PTR values, not even for zombie objects.
* compile.c (ibf_loader_mark): remove branch for pointer validity
* compile.c (ibf_loader_free): ditto
* cont.c (cont_free): ditto
* cont.c (fiber_free): ditto
* dir.c (dir_free): ditto
* ext/stringio/stringio.c (strio_mark): ditto
* proc.c (binding_free): ditto
* thread_sync.c (mutex_free): ditto
* vm.c (thread_free): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 51 |
1 files changed, 24 insertions, 27 deletions
@@ -2346,41 +2346,38 @@ rb_thread_mark(void *ptr) static void thread_free(void *ptr) { - rb_thread_t *th; + rb_thread_t *th = ptr; RUBY_FREE_ENTER("thread"); - if (ptr) { - th = ptr; - - if (!th->root_fiber) { - RUBY_FREE_UNLESS_NULL(th->stack); - } + if (!th->root_fiber) { + RUBY_FREE_UNLESS_NULL(th->stack); + } - if (th->locking_mutex != Qfalse) { - rb_bug("thread_free: locking_mutex must be NULL (%p:%p)", (void *)th, (void *)th->locking_mutex); - } - if (th->keeping_mutexes != NULL) { - rb_bug("thread_free: keeping_mutexes must be NULL (%p:%p)", (void *)th, (void *)th->keeping_mutexes); - } + if (th->locking_mutex != Qfalse) { + rb_bug("thread_free: locking_mutex must be NULL (%p:%p)", (void *)th, (void *)th->locking_mutex); + } + if (th->keeping_mutexes != NULL) { + rb_bug("thread_free: keeping_mutexes must be NULL (%p:%p)", (void *)th, (void *)th->keeping_mutexes); + } - if (th->local_storage) { - st_free_table(th->local_storage); - } + if (th->local_storage) { + st_free_table(th->local_storage); + } - if (th->vm && th->vm->main_thread == th) { - RUBY_GC_INFO("main thread\n"); - } - else { + if (th->vm && th->vm->main_thread == th) { + RUBY_GC_INFO("main thread\n"); + } + else { #ifdef USE_SIGALTSTACK - if (th->altstack) { - free(th->altstack); - } -#endif - ruby_xfree(ptr); + if (th->altstack) { + free(th->altstack); } - if (ruby_current_thread == th) - ruby_current_thread = NULL; +#endif + ruby_xfree(ptr); } + if (ruby_current_thread == th) + ruby_current_thread = NULL; + RUBY_FREE_LEAVE("thread"); } |