summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-08-09 00:37:39 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-08-09 01:31:22 -0700
commitcb71a119f7231984e010cc28ef33854721036a0f (patch)
treec916e1f4ceb7b48a636b55aa8383e19a35d67253
parentd896f78973bce33da7b4629089122bb58103d75c (diff)
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.
-rw-r--r--src/bytecode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 52f827f282..0c5b8494d0 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;
}