aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-02-16 16:52:07 +0100
committerMattias EngdegÄrd2022-03-12 17:32:31 +0100
commit213483124b4381663efd0dd001037363223ce188 (patch)
treef7b355d3c0c56d6cd417e043a842e2ae91c8f113 /src/eval.c
parent6ef9dc7797729a547dace431f57a73fe278172cc (diff)
downloademacs-213483124b4381663efd0dd001037363223ce188.tar.gz
emacs-213483124b4381663efd0dd001037363223ce188.zip
Inline record_in_backtrace
It's critical in several function call paths. * src/eval.c (grow_specpdl_allocation): Make non-static. (grow_specpdl, record_in_backtrace): Move from here... * src/lisp.h (grow_specpdl, record_in_backtrace): ... to here, and declare inline.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/eval.c b/src/eval.c
index 294d79e67a0..0fc492fbe0e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2320,7 +2320,7 @@ alist mapping symbols to their value. */)
2320 return unbind_to (count, eval_sub (form)); 2320 return unbind_to (count, eval_sub (form));
2321} 2321}
2322 2322
2323static void 2323void
2324grow_specpdl_allocation (void) 2324grow_specpdl_allocation (void)
2325{ 2325{
2326 eassert (specpdl_ptr == specpdl + specpdl_size); 2326 eassert (specpdl_ptr == specpdl + specpdl_size);
@@ -2342,40 +2342,6 @@ grow_specpdl_allocation (void)
2342 specpdl_ptr = specpdl_ref_to_ptr (count); 2342 specpdl_ptr = specpdl_ref_to_ptr (count);
2343} 2343}
2344 2344
2345/* Grow the specpdl stack by one entry.
2346 The caller should have already initialized the entry.
2347 Signal an error on stack overflow.
2348
2349 Make sure that there is always one unused entry past the top of the
2350 stack, so that the just-initialized entry is safely unwound if
2351 memory exhausted and an error is signaled here. Also, allocate a
2352 never-used entry just before the bottom of the stack; sometimes its
2353 address is taken. */
2354
2355INLINE void
2356grow_specpdl (void)
2357{
2358 specpdl_ptr++;
2359 if (specpdl_ptr == specpdl + specpdl_size)
2360 grow_specpdl_allocation ();
2361}
2362
2363specpdl_ref
2364record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs)
2365{
2366 specpdl_ref count = SPECPDL_INDEX ();
2367
2368 eassert (nargs >= UNEVALLED);
2369 specpdl_ptr->bt.kind = SPECPDL_BACKTRACE;
2370 specpdl_ptr->bt.debug_on_exit = false;
2371 specpdl_ptr->bt.function = function;
2372 current_thread->stack_top = specpdl_ptr->bt.args = args;
2373 specpdl_ptr->bt.nargs = nargs;
2374 grow_specpdl ();
2375
2376 return count;
2377}
2378
2379/* Eval a sub-expression of the current expression (i.e. in the same 2345/* Eval a sub-expression of the current expression (i.e. in the same
2380 lexical scope). */ 2346 lexical scope). */
2381Lisp_Object 2347Lisp_Object