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

ruby-changes:61416

From: Koichi <ko1@a...>
Date: Fri, 29 May 2020 13:57:55 +0900 (JST)
Subject: [ruby-changes:61416] d300a73441 (master): RUBY_ASSERT_NOASSUME

https://git.ruby-lang.org/ruby.git/commit/?id=d300a73441

From d300a734414ef6de7e8eb563b7cc4389c455ed08 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Fri, 29 May 2020 13:50:58 +0900
Subject: 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().

diff --git a/include/ruby/assert.h b/include/ruby/assert.h
index 5b435da..8967973 100644
--- a/include/ruby/assert.h
+++ b/include/ruby/assert.h
@@ -101,7 +101,7 @@ RBIMPL_SYMBOL_EXPORT_END() https://github.com/ruby/ruby/blob/trunk/include/ruby/assert.h#L101
 # 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 */
-- 
cgit v0.10.2


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

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