ruby-changes:63085
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 25 Sep 2020 11:38:57 +0900 (JST)
Subject: [ruby-changes:63085] 873fb1aa4c (master): ALLOCA_N: do not use RUBY_ALIGNOF
https://git.ruby-lang.org/ruby.git/commit/?id=873fb1aa4c From 873fb1aa4cab7a14f2b38a05f5888c111ea3bc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Wed, 23 Sep 2020 13:30:56 +0900 Subject: ALLOCA_N: do not use RUBY_ALIGNOF Now that RUBY_ALIGNOF behaves like C11's _Alignof. This is not necessarily the best stack arrangement. We can just give up using __builtin_alloca_with_align(), and let alloca choose what is optimal. diff --git a/include/ruby/internal/memory.h b/include/ruby/internal/memory.h index 0128a7f..974c21e 100644 --- a/include/ruby/internal/memory.h +++ b/include/ruby/internal/memory.h @@ -109,18 +109,8 @@ extern void *alloca(); https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/memory.h#L109 #define RB_REALLOC_N(var,type,n) \ ((var) = RBIMPL_CAST((type *)ruby_xrealloc2((void *)(var), (n), sizeof(type)))) -/* I don't know why but __builtin_alloca_with_align's second argument - takes bits rather than bytes. */ -#if RBIMPL_HAS_BUILTIN(__builtin_alloca_with_align) -# define ALLOCA_N(type, n) \ - RBIMPL_CAST((type *) \ - __builtin_alloca_with_align( \ - rbimpl_size_mul_or_raise(sizeof(type), (n)), \ - RUBY_ALIGNOF(type) * CHAR_BIT)) -#else -# define ALLOCA_N(type,n) \ +#define ALLOCA_N(type,n) \ RBIMPL_CAST((type *)alloca(rbimpl_size_mul_or_raise(sizeof(type), (n)))) -#endif /* allocates _n_ bytes temporary buffer and stores VALUE including it * in _v_. _n_ may be evaluated twice. */ -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/