From a0908cb41356f4384a3e9a199c14490a452080ef Mon Sep 17 00:00:00 2001 From: normal Date: Wed, 15 Jul 2015 08:29:22 +0000 Subject: remove redundant NULL check in mark functions gc.c (gc_mark_children)only calls mark_func if the T_DATA ptr is non-NULL, so avoid redundantly checking for that in each mark function. * iseq.c (iseq_mark): remove check for data pointer * proc.c (binding_mark): ditto * vm.c (rb_thread_mark): ditto * vm_trace.c (tp_mark): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'iseq.c') diff --git a/iseq.c b/iseq.c index e8318b9233..a42eae8e3c 100644 --- a/iseq.c +++ b/iseq.c @@ -102,27 +102,26 @@ iseq_free(void *ptr) static void iseq_mark(void *ptr) { - RUBY_MARK_ENTER("iseq"); + rb_iseq_t *iseq = ptr; - if (ptr) { - rb_iseq_t *iseq = ptr; + RUBY_MARK_ENTER("iseq"); - RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path)); + RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path)); - RUBY_MARK_UNLESS_NULL(iseq->mark_ary); - RUBY_MARK_UNLESS_NULL(iseq->location.label); - RUBY_MARK_UNLESS_NULL(iseq->location.base_label); - RUBY_MARK_UNLESS_NULL(iseq->location.path); - RUBY_MARK_UNLESS_NULL(iseq->location.absolute_path); - RUBY_MARK_UNLESS_NULL(iseq->coverage); + RUBY_MARK_UNLESS_NULL(iseq->mark_ary); + RUBY_MARK_UNLESS_NULL(iseq->location.label); + RUBY_MARK_UNLESS_NULL(iseq->location.base_label); + RUBY_MARK_UNLESS_NULL(iseq->location.path); + RUBY_MARK_UNLESS_NULL(iseq->location.absolute_path); + RUBY_MARK_UNLESS_NULL(iseq->coverage); - if (iseq->compile_data != 0) { - struct iseq_compile_data *const compile_data = iseq->compile_data; - RUBY_MARK_UNLESS_NULL(compile_data->mark_ary); - RUBY_MARK_UNLESS_NULL(compile_data->err_info); - RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary); - } + if (iseq->compile_data != 0) { + struct iseq_compile_data *const compile_data = iseq->compile_data; + RUBY_MARK_UNLESS_NULL(compile_data->mark_ary); + RUBY_MARK_UNLESS_NULL(compile_data->err_info); + RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary); } + RUBY_MARK_LEAVE("iseq"); } -- cgit v1.2.3