1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

RUBY_ASSERT_NOASSUME

If __builtin_assume() is enables and RUBY_DEBUG=0, RUBY_ASSERT(expr)
will be compiled to __builtin_assume(expr) and compiler can assume
expr is true and apply aggressive optimizations. However we observed
doubtful behavior because of compiler optimizations, we introduce
new macro RUBY_ASSERT_NOASSUME to disable __builtin_assume().
With this macro, we can try without __builtin_assume().
This commit is contained in:
Koichi Sasada 2020-05-29 13:50:58 +09:00
parent 03d7f3cdb2
commit d300a73441

View file

@ -101,7 +101,7 @@ RBIMPL_SYMBOL_EXPORT_END()
# define RBIMPL_ASSERT_OR_ASSUME(_) RUBY_ASSERT(_)
#elif defined(RBIMPL_HAVE___ASSUME)
# define RBIMPL_ASSERT_OR_ASSUME(_) RBIMPL_ASSUME(_)
#elif RBIMPL_HAS_BUILTIN(__builtin_assume) && RBIMPL_COMPILER_SINCE(Clang, 7, 0, 0)
#elif !RUBY_ASSERT_NOASSUME && RBIMPL_HAS_BUILTIN(__builtin_assume) && RBIMPL_COMPILER_SINCE(Clang, 7, 0, 0)
# define RBIMPL_ASSERT_OR_ASSUME(_) RBIMPL_ASSUME(_)
#else
# define RBIMPL_ASSERT_OR_ASSUME(_) /* void */