[前][次][番号順一覧][スレッド一覧]

ruby-changes:40402

From: ko1 <ko1@a...>
Date: Sun, 8 Nov 2015 08:11:17 +0900 (JST)
Subject: [ruby-changes:40402] ko1:r52483 (trunk): * vm_trace.c (exec_hooks_precheck): check need_clean everytime

ko1	2015-11-08 08:10:55 +0900 (Sun, 08 Nov 2015)

  New Revision: 52483

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52483

  Log:
    * vm_trace.c (exec_hooks_precheck): check need_clean everytime
      to clean-up unused hooks.
    
    * vm_trace.c (list->need_clean): use as boolean value.

  Modified files:
    trunk/ChangeLog
    trunk/vm_trace.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52482)
+++ ChangeLog	(revision 52483)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov  8 08:10:31 2015  Koichi Sasada  <ko1@a...>
+
+	* vm_trace.c (exec_hooks_precheck): check need_clean everytime
+	  to clean-up unused hooks.
+
+	* vm_trace.c (list->need_clean): use as boolean value.
+
 Sun Nov  8 01:31:27 2015  NARUSE, Yui  <naruse@r...>
 
 	* lib/net/http.rb (Net::HTTP#initialize):
Index: vm_trace.c
===================================================================
--- vm_trace.c	(revision 52482)
+++ vm_trace.c	(revision 52483)
@@ -171,7 +171,7 @@ remove_event_hook(rb_hook_list_t *list, https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L171
 	    if (data == Qundef || hook->data == data) {
 		hook->hook_flags |= RUBY_EVENT_HOOK_FLAG_DELETED;
 		ret+=1;
-		list->need_clean++;
+		list->need_clean = TRUE;
 	    }
 	}
 	hook = hook->next;
@@ -230,7 +230,7 @@ clean_hooks(rb_hook_list_t *list) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L230
     rb_event_hook_t *hook, **nextp = &list->hooks;
 
     list->events = 0;
-    list->need_clean = 0;
+    list->need_clean = FALSE;
 
     while ((hook = *nextp) != 0) {
 	if (hook->hook_flags & RUBY_EVENT_HOOK_FLAG_DELETED) {
@@ -265,14 +265,13 @@ exec_hooks_body(rb_thread_t *th, rb_hook https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L265
 static int
 exec_hooks_precheck(rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_arg)
 {
-    if ((list->events & trace_arg->event) == 0) return 0;
-
-    if (UNLIKELY(list->need_clean > 0)) {
+    if (UNLIKELY(list->need_clean != FALSE)) {
 	if (th->vm->trace_running <= 1) { /* only running this hooks */
 	    clean_hooks(list);
 	}
     }
-    return 1;
+
+    return (list->events & trace_arg->event) != 0;
 }
 
 static void

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]