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: Stefan Monnier
Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings]
Date: Mon, 08 Sep 2014 08:44:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> Surely such an errors are possible.  But if we use alloca in general,
> there is always a possibility for someone to misuse pointer returned
> from it, no matter whether that pointer is used for Lisp_Objects or not.

There's an important difference: an object that is accessible from the
Elisp world should never have such "stack-allocation" constraint,
because that is a kind of semantic constraint that is common in C but
which doesn't exist in C.

So as long as your Lips_Objects stay within the C world, it's indeed
acceptable, since the C programmer presumably knows that memory
management is a big dangerous mess; but as soon as your alloca'd object
gets to the Elisp world this is not acceptable any more since it
introduces a new kind of problem to this Elisp world.

> Any developer good enough in C should be able to find, track and fix
> this class of errors, so I don't see a problem here.

Agreed, as long as the object doesn't get to Elisp.  The tricky part
here is that Elisp can be invoked at many different points, and we tend
to keep adding new such points via new hooks.  So the places where
alloca can be used are probably somewhat rare.

> Of course, no one should detect charsets by scanning buffer in such a way,

IOW, this is not a good argument in favor of using alloca there.


        Stefan



reply via email to

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