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
This commit is contained in:
normal 2015-07-15 08:29:22 +00:00
parent 28c42b4c25
commit a0908cb413
5 changed files with 80 additions and 78 deletions

View File

@ -1,3 +1,10 @@
Wed Jul 15 17:27:40 2015 Eric Wong <e@80x24.org>
* 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
Wed Jul 15 16:55:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Jul 15 16:55:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_autoload): drop dummy encoding flag from * encoding.c (enc_autoload): drop dummy encoding flag from

7
iseq.c
View File

@ -102,11 +102,10 @@ iseq_free(void *ptr)
static void static void
iseq_mark(void *ptr) iseq_mark(void *ptr)
{ {
RUBY_MARK_ENTER("iseq");
if (ptr) {
rb_iseq_t *iseq = 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->mark_ary);
@ -122,7 +121,7 @@ iseq_mark(void *ptr)
RUBY_MARK_UNLESS_NULL(compile_data->err_info); RUBY_MARK_UNLESS_NULL(compile_data->err_info);
RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary); RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary);
} }
}
RUBY_MARK_LEAVE("iseq"); RUBY_MARK_LEAVE("iseq");
} }

8
proc.c
View File

@ -243,13 +243,13 @@ binding_free(void *ptr)
static void static void
binding_mark(void *ptr) binding_mark(void *ptr)
{ {
rb_binding_t *bind; rb_binding_t *bind = ptr;
RUBY_MARK_ENTER("binding"); RUBY_MARK_ENTER("binding");
if (ptr) {
bind = ptr;
RUBY_MARK_UNLESS_NULL(bind->env); RUBY_MARK_UNLESS_NULL(bind->env);
RUBY_MARK_UNLESS_NULL(bind->path); RUBY_MARK_UNLESS_NULL(bind->path);
}
RUBY_MARK_LEAVE("binding"); RUBY_MARK_LEAVE("binding");
} }

6
vm.c
View File

@ -2053,10 +2053,9 @@ void rb_fiber_mark_self(rb_fiber_t *fib);
void void
rb_thread_mark(void *ptr) rb_thread_mark(void *ptr)
{ {
rb_thread_t *th = NULL; rb_thread_t *th = ptr;
RUBY_MARK_ENTER("thread"); RUBY_MARK_ENTER("thread");
if (ptr) {
th = ptr;
if (th->stack) { if (th->stack) {
VALUE *p = th->stack; VALUE *p = th->stack;
VALUE *sp = th->cfp->sp; VALUE *sp = th->cfp->sp;
@ -2109,7 +2108,6 @@ rb_thread_mark(void *ptr)
RUBY_MARK_UNLESS_NULL(th->name); RUBY_MARK_UNLESS_NULL(th->name);
rb_vm_trace_mark_event_hooks(&th->event_hooks); rb_vm_trace_mark_event_hooks(&th->event_hooks);
}
RUBY_MARK_LEAVE("thread"); RUBY_MARK_LEAVE("thread");
} }

View File

@ -653,12 +653,10 @@ typedef struct rb_tp_struct {
static void static void
tp_mark(void *ptr) tp_mark(void *ptr)
{ {
if (ptr) { rb_tp_t *tp = ptr;
rb_tp_t *tp = (rb_tp_t *)ptr;
rb_gc_mark(tp->proc); rb_gc_mark(tp->proc);
if (tp->target_th) rb_gc_mark(tp->target_th->self); if (tp->target_th) rb_gc_mark(tp->target_th->self);
} }
}
static size_t static size_t
tp_memsize(const void *ptr) tp_memsize(const void *ptr)