mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
e9fb2bc873
commit
873fb1aa4c
Notes:
git
2020-09-25 11:39:05 +09:00
1 changed files with 1 additions and 11 deletions
|
@ -109,18 +109,8 @@ extern void *alloca();
|
||||||
#define RB_REALLOC_N(var,type,n) \
|
#define RB_REALLOC_N(var,type,n) \
|
||||||
((var) = RBIMPL_CAST((type *)ruby_xrealloc2((void *)(var), (n), sizeof(type))))
|
((var) = RBIMPL_CAST((type *)ruby_xrealloc2((void *)(var), (n), sizeof(type))))
|
||||||
|
|
||||||
/* I don't know why but __builtin_alloca_with_align's second argument
|
#define ALLOCA_N(type,n) \
|
||||||
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) \
|
|
||||||
RBIMPL_CAST((type *)alloca(rbimpl_size_mul_or_raise(sizeof(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
|
/* allocates _n_ bytes temporary buffer and stores VALUE including it
|
||||||
* in _v_. _n_ may be evaluated twice. */
|
* in _v_. _n_ may be evaluated twice. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue