[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master cb71a11 3/5: Remove arbitrary limit on bytecode max
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master cb71a11 3/5: Remove arbitrary limit on bytecode maxdepth |
Date: |
Tue, 9 Aug 2016 08:31:27 +0000 (UTC) |
branch: master
commit cb71a119f7231984e010cc28ef33854721036a0f
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Remove arbitrary limit on bytecode maxdepth
* src/bytecode.c (exec_byte_code): Remove MAX_ALLOCA-based limit
on bytecode maxdepth, by using SAFE_ALLOCA_LISP instead of alloca.
pipeline is fuller.
---
src/bytecode.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/bytecode.c b/src/bytecode.c
index 52f827f..0c5b849 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -413,7 +413,7 @@ Lisp_Object
exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args)
{
- ptrdiff_t count = SPECPDL_INDEX ();
+ USE_SAFE_ALLOCA;
#ifdef BYTE_CODE_METER
int volatile this_op = 0;
int prev_op;
@@ -447,15 +447,15 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector,
Lisp_Object maxdepth,
stack.byte_string = bytestr;
stack.pc = stack.byte_string_start = SDATA (bytestr);
- if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth))
- memory_full (SIZE_MAX);
unsigned char quitcounter = 0;
- int stack_items = XFASTINT (maxdepth) + 1;
- Lisp_Object *stack_base = alloca (stack_items * sizeof *top);
+ EMACS_INT stack_items = XFASTINT (maxdepth) + 1;
+ Lisp_Object *stack_base;
+ SAFE_ALLOCA_LISP (stack_base, stack_items);
Lisp_Object *stack_lim = stack_base + stack_items;
top = stack_base;
stack.next = byte_stack_list;
byte_stack_list = &stack;
+ ptrdiff_t count = SPECPDL_INDEX ();
if (!NILP (args_template))
{
@@ -1699,6 +1699,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector,
Lisp_Object maxdepth,
error ("binding stack not balanced (serious byte compiler bug)");
}
+ SAFE_FREE ();
return result;
}