emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enlarge MAX_ALLOCA?


From: David Kastrup
Subject: Re: Enlarge MAX_ALLOCA?
Date: Thu, 19 Jun 2014 18:23:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> -#define SAFE_ALLOCA(size) ((size) < MAX_ALLOCA       \
> +#define SAFE_ALLOCA(size) ((size) <= MAX_ALLOCA      \
>                          ? alloca (size)      \
>                          : (sa_must_free = true, record_xmalloc (size)))
>  
> @@ -4469,7 +4469,7 @@ extern void *record_xmalloc (size_t) ATT
>  
>  #define SAFE_ALLOCA_LISP(buf, nelt)                         \
>    do {                                                              \
> -    if ((nelt) < MAX_ALLOCA / word_size)                    \
> +    if ((nelt) <= MAX_ALLOCA / word_size)                   \
>        (buf) = alloca ((nelt) * word_size);                  \
>      else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / word_size) \
>        {                                                             \

Bad idea to change < to <= here.  If there is a hard limit due to short
offsets or similar (and if there weren't, why bother at all?), then
allocating a full 64kB might be a bad idea.

With regard to short addressing modes, 32kB might be more appropriate,
and if the normal stack frame is included in that address range, 30kB
might be more cautious.

64kB feels arbitrary.  I cannot really think of an architecture where
64kB would be feasible and 128kB not.  ±32kB is a plausible offset for
some architectures.

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]