[Top][All Lists]

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

Re: Redundant type checking in window.c and w32menu.c

From: Ken Raeburn
Subject: Re: Redundant type checking in window.c and w32menu.c
Date: Tue, 19 Jun 2007 14:46:37 -0400

On Jun 19, 2007, at 10:44, Dmitry Antipov wrote:
If we pass CHECK_CONS(), we don't need CONSP()s in Fcar() and Fcdr () and may use XCAR()
and XCDR() instead.

Makes sense.

P.S. Is code size the only reason to call Fcar(), Fcdr() and their safe versions directly from C code ? Replacing these dumb proxies with an appropriate macros eliminates a lot of function calls at the cost of ~28K increment in code size (for a stripped binary on x86). Note if someone needs smaller emacs executable (what a strange requirement, but why not ?),
just replacing -O2 with -Os saves ~235K.

You could make Fcar a static inline function in lisp.h (conditional on GCC, or maybe C99). If the optimizer's good at its job, it should eliminate the redundant CONSP checks. Using an inline function avoids having to check all Fcar uses for arguments that have function calls or side effects. (A quick grep shows several of those. In fact, if your test used the simple macro version, inline functions may result in less code size expansion because of this.) And personally, I think inline functions are often more readable than macros, if they're not very simple macros.


reply via email to

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