diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-12 05:30:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-12 05:30:43 +0000 |
commit | f9f73f2520be55bd8902acbfbe6d0ac50dea6c78 (patch) | |
tree | 141350064bca3d69545635ecc64d3ff92f12f02a /gc.c | |
parent | da3c50694a471c8c9f9155b0cd77c4474898764e (diff) | |
download | ruby-f9f73f2520be55bd8902acbfbe6d0ac50dea6c78.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -228,8 +228,9 @@ static ruby_gc_params_t gc_params = { #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(rb_objspace_t *); #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); |