diff options
| author | Paul Eggert | 2016-08-09 00:37:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-08-09 01:31:22 -0700 |
| commit | cb71a119f7231984e010cc28ef33854721036a0f (patch) | |
| tree | c916e1f4ceb7b48a636b55aa8383e19a35d67253 /src/bytecode.c | |
| parent | d896f78973bce33da7b4629089122bb58103d75c (diff) | |
| download | emacs-cb71a119f7231984e010cc28ef33854721036a0f.tar.gz emacs-cb71a119f7231984e010cc28ef33854721036a0f.zip | |
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.
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index 52f827f282a..0c5b8494d0c 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -413,7 +413,7 @@ Lisp_Object | |||
| 413 | exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | 413 | exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, |
| 414 | Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) | 414 | Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) |
| 415 | { | 415 | { |
| 416 | ptrdiff_t count = SPECPDL_INDEX (); | 416 | USE_SAFE_ALLOCA; |
| 417 | #ifdef BYTE_CODE_METER | 417 | #ifdef BYTE_CODE_METER |
| 418 | int volatile this_op = 0; | 418 | int volatile this_op = 0; |
| 419 | int prev_op; | 419 | int prev_op; |
| @@ -447,15 +447,15 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 447 | 447 | ||
| 448 | stack.byte_string = bytestr; | 448 | stack.byte_string = bytestr; |
| 449 | stack.pc = stack.byte_string_start = SDATA (bytestr); | 449 | stack.pc = stack.byte_string_start = SDATA (bytestr); |
| 450 | if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) | ||
| 451 | memory_full (SIZE_MAX); | ||
| 452 | unsigned char quitcounter = 0; | 450 | unsigned char quitcounter = 0; |
| 453 | int stack_items = XFASTINT (maxdepth) + 1; | 451 | EMACS_INT stack_items = XFASTINT (maxdepth) + 1; |
| 454 | Lisp_Object *stack_base = alloca (stack_items * sizeof *top); | 452 | Lisp_Object *stack_base; |
| 453 | SAFE_ALLOCA_LISP (stack_base, stack_items); | ||
| 455 | Lisp_Object *stack_lim = stack_base + stack_items; | 454 | Lisp_Object *stack_lim = stack_base + stack_items; |
| 456 | top = stack_base; | 455 | top = stack_base; |
| 457 | stack.next = byte_stack_list; | 456 | stack.next = byte_stack_list; |
| 458 | byte_stack_list = &stack; | 457 | byte_stack_list = &stack; |
| 458 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 459 | 459 | ||
| 460 | if (!NILP (args_template)) | 460 | if (!NILP (args_template)) |
| 461 | { | 461 | { |
| @@ -1699,6 +1699,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1699 | error ("binding stack not balanced (serious byte compiler bug)"); | 1699 | error ("binding stack not balanced (serious byte compiler bug)"); |
| 1700 | } | 1700 | } |
| 1701 | 1701 | ||
| 1702 | SAFE_FREE (); | ||
| 1702 | return result; | 1703 | return result; |
| 1703 | } | 1704 | } |
| 1704 | 1705 | ||