[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 213483124b 1/5: Inline record_in_backtrace
From: |
Mattias Engdegård |
Subject: |
master 213483124b 1/5: Inline record_in_backtrace |
Date: |
Sat, 12 Mar 2022 11:38:55 -0500 (EST) |
branch: master
commit 213483124b4381663efd0dd001037363223ce188
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
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.
---
src/eval.c | 36 +-----------------------------------
src/lisp.h | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 35 deletions(-)
diff --git a/src/eval.c b/src/eval.c
index 294d79e67a..0fc492fbe0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2320,7 +2320,7 @@ alist mapping symbols to their value. */)
return unbind_to (count, eval_sub (form));
}
-static void
+void
grow_specpdl_allocation (void)
{
eassert (specpdl_ptr == specpdl + specpdl_size);
@@ -2342,40 +2342,6 @@ grow_specpdl_allocation (void)
specpdl_ptr = specpdl_ref_to_ptr (count);
}
-/* Grow the specpdl stack by one entry.
- The caller should have already initialized the entry.
- Signal an error on stack overflow.
-
- Make sure that there is always one unused entry past the top of the
- stack, so that the just-initialized entry is safely unwound if
- memory exhausted and an error is signaled here. Also, allocate a
- never-used entry just before the bottom of the stack; sometimes its
- address is taken. */
-
-INLINE void
-grow_specpdl (void)
-{
- specpdl_ptr++;
- if (specpdl_ptr == specpdl + specpdl_size)
- grow_specpdl_allocation ();
-}
-
-specpdl_ref
-record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs)
-{
- specpdl_ref count = SPECPDL_INDEX ();
-
- eassert (nargs >= UNEVALLED);
- specpdl_ptr->bt.kind = SPECPDL_BACKTRACE;
- specpdl_ptr->bt.debug_on_exit = false;
- specpdl_ptr->bt.function = function;
- current_thread->stack_top = specpdl_ptr->bt.args = args;
- specpdl_ptr->bt.nargs = nargs;
- grow_specpdl ();
-
- return count;
-}
-
/* Eval a sub-expression of the current expression (i.e. in the same
lexical scope). */
Lisp_Object
diff --git a/src/lisp.h b/src/lisp.h
index 778bd1bfa5..b99441fa6c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3454,6 +3454,41 @@ backtrace_debug_on_exit (union specbinding *pdl)
return pdl->bt.debug_on_exit;
}
+void grow_specpdl_allocation (void);
+
+/* Grow the specpdl stack by one entry.
+ The caller should have already initialized the entry.
+ Signal an error on stack overflow.
+
+ Make sure that there is always one unused entry past the top of the
+ stack, so that the just-initialized entry is safely unwound if
+ memory exhausted and an error is signaled here. Also, allocate a
+ never-used entry just before the bottom of the stack; sometimes its
+ address is taken. */
+INLINE void
+grow_specpdl (void)
+{
+ specpdl_ptr++;
+ if (specpdl_ptr == specpdl + specpdl_size)
+ grow_specpdl_allocation ();
+}
+
+INLINE specpdl_ref
+record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs)
+{
+ specpdl_ref count = SPECPDL_INDEX ();
+
+ eassert (nargs >= UNEVALLED);
+ specpdl_ptr->bt.kind = SPECPDL_BACKTRACE;
+ specpdl_ptr->bt.debug_on_exit = false;
+ specpdl_ptr->bt.function = function;
+ current_thread->stack_top = specpdl_ptr->bt.args = args;
+ specpdl_ptr->bt.nargs = nargs;
+ grow_specpdl ();
+
+ return count;
+}
+
/* This structure helps implement the `catch/throw' and `condition-case/signal'
control structures. A struct handler contains all the information needed to
restore the state of the interpreter after a non-local jump.
- master updated (6ef9dc7797 -> 2c54e9a1dd), Mattias Engdegård, 2022/03/12
- master 2c54e9a1dd 5/5: Remove never-used relative jump opcodes, Mattias Engdegård, 2022/03/12
- master 2fb98486e1 3/5: Faster bytecode immediate argument fetching, Mattias Engdegård, 2022/03/12
- master fe65db05f4 2/5: Maintain end of specpdl instead of size, Mattias Engdegård, 2022/03/12
- master 213483124b 1/5: Inline record_in_backtrace,
Mattias Engdegård <=
- master 88889212c7 4/5: Remove debug code for opcodes long gone, Mattias Engdegård, 2022/03/12
- Re: master updated (6ef9dc7797 -> 2c54e9a1dd), Lars Ingebrigtsen, 2022/03/12