[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b7902a9b48 13/14: Bump specpdl inline, move reallocation out of l
From: |
Mattias Engdegård |
Subject: |
master b7902a9b48 13/14: Bump specpdl inline, move reallocation out of line |
Date: |
Mon, 24 Jan 2022 05:42:37 -0500 (EST) |
branch: master
commit b7902a9b48f8e7f83ab6b90cfd8bc95aab410e6f
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Bump specpdl inline, move reallocation out of line
The common case is just to increment `specpdl_ptr`; do that in-line,
but move the uncommon reallocation to a separate subroutine.
* src/eval.c (grow_specpdl): Now inline, most code moved...
(grow_specpdl_allocation): ...here.
---
src/eval.c | 43 ++++++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/src/eval.c b/src/eval.c
index 7c03006732..744fe82347 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2362,6 +2362,28 @@ alist mapping symbols to their value. */)
return unbind_to (count, eval_sub (form));
}
+static void
+grow_specpdl_allocation (void)
+{
+ eassert (specpdl_ptr == specpdl + specpdl_size);
+
+ ptrdiff_t count = SPECPDL_INDEX ();
+ ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX - 1000);
+ union specbinding *pdlvec = specpdl - 1;
+ ptrdiff_t pdlvecsize = specpdl_size + 1;
+ if (max_size <= specpdl_size)
+ {
+ if (max_specpdl_size < 400)
+ max_size = max_specpdl_size = 400;
+ if (max_size <= specpdl_size)
+ xsignal0 (Qexcessive_variable_binding);
+ }
+ pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl);
+ specpdl = pdlvec + 1;
+ specpdl_size = pdlvecsize - 1;
+ specpdl_ptr = specpdl + count;
+}
+
/* Grow the specpdl stack by one entry.
The caller should have already initialized the entry.
Signal an error on stack overflow.
@@ -2372,29 +2394,12 @@ alist mapping symbols to their value. */)
never-used entry just before the bottom of the stack; sometimes its
address is taken. */
-static void
+INLINE void
grow_specpdl (void)
{
specpdl_ptr++;
-
if (specpdl_ptr == specpdl + specpdl_size)
- {
- ptrdiff_t count = SPECPDL_INDEX ();
- ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX - 1000);
- union specbinding *pdlvec = specpdl - 1;
- ptrdiff_t pdlvecsize = specpdl_size + 1;
- if (max_size <= specpdl_size)
- {
- if (max_specpdl_size < 400)
- max_size = max_specpdl_size = 400;
- if (max_size <= specpdl_size)
- xsignal0 (Qexcessive_variable_binding);
- }
- pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl);
- specpdl = pdlvec + 1;
- specpdl_size = pdlvecsize - 1;
- specpdl_ptr = specpdl + count;
- }
+ grow_specpdl_allocation ();
}
ptrdiff_t
- master 6c000af611 02/14: Inline fixnum operations in bytecode interpreter, (continued)
- master 6c000af611 02/14: Inline fixnum operations in bytecode interpreter, Mattias Engdegård, 2022/01/24
- master 65caf5b205 04/14: Pin bytecode strings to avoid copy at call time, Mattias Engdegård, 2022/01/24
- master 7392f2dc41 05/14: Byte code arity check micro-optimisation, Mattias Engdegård, 2022/01/24
- master 4a0541a5dd 12/14: Implement Ffuncall in terms of funcall_general, Mattias Engdegård, 2022/01/24
- master b3377e67a7 07/14: Remove nil check in exec_byte_code, Mattias Engdegård, 2022/01/24
- master 4ff1fb8eb4 08/14: Move a runtime interpreter check to debug mode, Mattias Engdegård, 2022/01/24
- master 11e1abd5cc 10/14: Open-code aref and aset in bytecode interpreter, Mattias Engdegård, 2022/01/24
- master 721357b868 09/14: Remove the unused unbind-all bytecode, Mattias Engdegård, 2022/01/24
- master d05f387407 06/14: ; * src/bytecode.c (exec_byte_code): Cosmetic improvement, Mattias Engdegård, 2022/01/24
- master 75c6564c92 11/14: ; * lisp/emacs-lisp/byte-opt.el: Remove outdated comments, Mattias Engdegård, 2022/01/24
- master b7902a9b48 13/14: Bump specpdl inline, move reallocation out of line,
Mattias Engdegård <=
- master a8b713d83a 14/14: Inline maybe_quit, Mattias Engdegård, 2022/01/24
- Re: master updated (bcf844b5fc -> a8b713d83a), Lars Ingebrigtsen, 2022/01/24