diff --git a/vm_core.h b/vm_core.h index e1e3fb1e59..55ed676afe 100644 --- a/vm_core.h +++ b/vm_core.h @@ -21,11 +21,11 @@ #endif #if VM_CHECK_MODE > 0 -#define VM_ASSERT(expr) do { \ - if(!(expr)) rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr); \ -} while (0) +#define VM_ASSERT(expr) ( \ + LIKELY(expr) ? (void)0 : \ + rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr)) #else -#define VM_ASSERT(expr) +#define VM_ASSERT(expr) ((void)0) #endif #define RUBY_VM_THREAD_MODEL 2