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

ruby-changes:47199

From: nobu <ko1@a...>
Date: Wed, 12 Jul 2017 14:30:51 +0900 (JST)
Subject: [ruby-changes:47199] nobu:r59314 (trunk): gc.c: restrict RGENGC_DEBUG

nobu	2017-07-12 14:30:43 +0900 (Wed, 12 Jul 2017)

  New Revision: 59314

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

  Log:
    gc.c: restrict RGENGC_DEBUG
    
    * gc.c (RGENGC_DEBUG_ENABLED): restrict runtime ruby_rgengc_debug
      level up to -RGENGC_DEBUG, to reduce runtime branches in inner
      loops.

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 59313)
+++ gc.c	(revision 59314)
@@ -228,8 +228,9 @@ static ruby_gc_params_t gc_params = { https://github.com/ruby/ruby/blob/trunk/gc.c#L228
 #endif
 #endif
 #if RGENGC_DEBUG < 0
-#undef RGENGC_DEBUG
-#define RGENGC_DEBUG ruby_rgengc_debug
+# define RGENGC_DEBUG_ENABLED(level) (-(RGENGC_DEBUG) >= (level) && ruby_rgengc_debug >= (level))
+#else
+# define RGENGC_DEBUG_ENABLED(level) ((RGENGC_DEBUG) >= (level))
 #endif
 int ruby_rgengc_debug;
 
@@ -910,9 +911,9 @@ static inline void gc_prof_set_heap_info https://github.com/ruby/ruby/blob/trunk/gc.c#L911
 
 #ifdef HAVE_VA_ARGS_MACRO
 # define gc_report(level, objspace, ...) \
-    if ((level) > RGENGC_DEBUG) {} else gc_report_body(level, objspace, __VA_ARGS__)
+    if (!RGENGC_DEBUG_ENABLED(level)) {} else gc_report_body(level, objspace, __VA_ARGS__)
 #else
-# define gc_report if (!(RGENGC_DEBUG)) {} else gc_report_body
+# define gc_report if (!RGENGC_DEBUG_ENABLED(0)) {} else gc_report_body
 #endif
 PRINTF_ARGS(static void gc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...), 3, 4);
 static const char *obj_info(VALUE obj);

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

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