emacs-devel
[Top][All Lists]
Advanced

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

Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_S


From: Dmitry Antipov
Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings]
Date: Fri, 05 Sep 2014 13:16:21 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

On 09/05/2014 11:15 AM, Paul Eggert wrote:

I like the idea of simpler and cleaner, but your patch's implementations of
build_local_vector and build_local_string use alloca expressions as function
arguments

I don't do that - I'm using 1st arg (result) as a temporary variable,
assuming that Lisp_Object is always wide enough to hold an address:

#define build_local_vector(obj, size, init)                             \
  (MAX_ALLOCA < (size) * word_size + header_size                        \
    ? obj = Fmake_vector (make_number (size), (init))                   \
    : (obj = XIL ((uintptr_t) alloca                                    \ here
                 ((size) * word_size + header_size)),                   \
       obj = local_vector_init ((uintptr_t) XLI (obj), (size), (init))))

IIUC the compiler should know about alloca limitations and so should not
try to (mis)optimize the code above to:

#define build_local_vector(obj, size, init)                             \
  (MAX_ALLOCA < (size) * word_size + header_size                        \
    ? obj = Fmake_vector (make_number (size), (init))                   \
      obj = local_vector_init                                           \
       ((uintptr_t) alloca ((size) * word_size + header_size),          \
        (size), (init)))

Dmitry




reply via email to

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