aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-04-19 12:52:57 -0700
committerPaul Eggert2019-04-19 12:57:30 -0700
commitbc4ed68314e51d784c03a06385f294db80f9a3bd (patch)
tree366412b02d402c16d2a384f2965685b951593258 /src
parent7d84056df4b228509b723b11d69bf39e3d1e548a (diff)
downloademacs-bc4ed68314e51d784c03a06385f294db80f9a3bd.tar.gz
emacs-bc4ed68314e51d784c03a06385f294db80f9a3bd.zip
Fix comment and tweak eval_sub
* src/eval.c (eval_sub): Check whether Fassq returns Qnil, not whether it returns a cons, as NILP is faster than CONSP nowadays. Remove incorrect comment “only original_fun and original_args have values that will be used below”; instead, move declarations around so that the set of variables with useful values is obvious.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/eval.c b/src/eval.c
index a2b95172d87..a636f6c50ae 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2153,14 +2153,6 @@ record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs)
2153Lisp_Object 2153Lisp_Object
2154eval_sub (Lisp_Object form) 2154eval_sub (Lisp_Object form)
2155{ 2155{
2156 Lisp_Object fun, val, original_fun, original_args;
2157 Lisp_Object funcar;
2158 ptrdiff_t count;
2159
2160 /* Declare here, as this array may be accessed by call_debugger near
2161 the end of this function. See Bug#21245. */
2162 Lisp_Object argvals[8];
2163
2164 if (SYMBOLP (form)) 2156 if (SYMBOLP (form))
2165 { 2157 {
2166 /* Look up its binding in the lexical environment. 2158 /* Look up its binding in the lexical environment.
@@ -2170,10 +2162,7 @@ eval_sub (Lisp_Object form)
2170 = !NILP (Vinternal_interpreter_environment) /* Mere optimization! */ 2162 = !NILP (Vinternal_interpreter_environment) /* Mere optimization! */
2171 ? Fassq (form, Vinternal_interpreter_environment) 2163 ? Fassq (form, Vinternal_interpreter_environment)
2172 : Qnil; 2164 : Qnil;
2173 if (CONSP (lex_binding)) 2165 return !NILP (lex_binding) ? XCDR (lex_binding) : Fsymbol_value (form);
2174 return XCDR (lex_binding);
2175 else
2176 return Fsymbol_value (form);
2177 } 2166 }
2178 2167
2179 if (!CONSP (form)) 2168 if (!CONSP (form))
@@ -2191,18 +2180,22 @@ eval_sub (Lisp_Object form)
2191 error ("Lisp nesting exceeds `max-lisp-eval-depth'"); 2180 error ("Lisp nesting exceeds `max-lisp-eval-depth'");
2192 } 2181 }
2193 2182
2194 original_fun = XCAR (form); 2183 Lisp_Object original_fun = XCAR (form);
2195 original_args = XCDR (form); 2184 Lisp_Object original_args = XCDR (form);
2196 CHECK_LIST (original_args); 2185 CHECK_LIST (original_args);
2197 2186
2198 /* This also protects them from gc. */ 2187 /* This also protects them from gc. */
2199 count = record_in_backtrace (original_fun, &original_args, UNEVALLED); 2188 ptrdiff_t count
2189 = record_in_backtrace (original_fun, &original_args, UNEVALLED);
2200 2190
2201 if (debug_on_next_call) 2191 if (debug_on_next_call)
2202 do_debug_on_call (Qt, count); 2192 do_debug_on_call (Qt, count);
2203 2193
2204 /* At this point, only original_fun and original_args 2194 Lisp_Object fun, val, funcar;
2205 have values that will be used below. */ 2195 /* Declare here, as this array may be accessed by call_debugger near
2196 the end of this function. See Bug#21245. */
2197 Lisp_Object argvals[8];
2198
2206 retry: 2199 retry:
2207 2200
2208 /* Optimize for no indirection. */ 2201 /* Optimize for no indirection. */