aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 74cf401bf1d..adc9352fb6e 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -433,7 +433,7 @@ If the third argument is incorrect, Emacs may crash. */)
433 433
434Lisp_Object 434Lisp_Object
435exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, 435exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
436 Lisp_Object args_template, int nargs, Lisp_Object *args) 436 Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args)
437{ 437{
438 int count = SPECPDL_INDEX (); 438 int count = SPECPDL_INDEX ();
439#ifdef BYTE_CODE_METER 439#ifdef BYTE_CODE_METER
@@ -464,7 +464,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
464 464
465 CHECK_STRING (bytestr); 465 CHECK_STRING (bytestr);
466 CHECK_VECTOR (vector); 466 CHECK_VECTOR (vector);
467 CHECK_NUMBER (maxdepth); 467 CHECK_NATNUM (maxdepth);
468 468
469#ifdef BYTE_CODE_SAFE 469#ifdef BYTE_CODE_SAFE
470 const_length = ASIZE (vector); 470 const_length = ASIZE (vector);
@@ -486,6 +486,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
486 stack.byte_string = bytestr; 486 stack.byte_string = bytestr;
487 stack.pc = stack.byte_string_start = SDATA (bytestr); 487 stack.pc = stack.byte_string_start = SDATA (bytestr);
488 stack.constants = vector; 488 stack.constants = vector;
489 if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) < XFASTINT (maxdepth))
490 memory_full (SIZE_MAX);
489 top = (Lisp_Object *) alloca (XFASTINT (maxdepth) 491 top = (Lisp_Object *) alloca (XFASTINT (maxdepth)
490 * sizeof (Lisp_Object)); 492 * sizeof (Lisp_Object));
491#if BYTE_MAINTAIN_TOP 493#if BYTE_MAINTAIN_TOP
@@ -502,14 +504,14 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
502 504
503 if (INTEGERP (args_template)) 505 if (INTEGERP (args_template))
504 { 506 {
505 int at = XINT (args_template); 507 ptrdiff_t at = XINT (args_template);
506 int rest = at & 128; 508 int rest = at & 128;
507 int mandatory = at & 127; 509 int mandatory = at & 127;
508 int nonrest = at >> 8; 510 ptrdiff_t nonrest = at >> 8;
509 eassert (mandatory <= nonrest); 511 eassert (mandatory <= nonrest);
510 if (nargs <= nonrest) 512 if (nargs <= nonrest)
511 { 513 {
512 int i; 514 ptrdiff_t i;
513 for (i = 0 ; i < nargs; i++, args++) 515 for (i = 0 ; i < nargs; i++, args++)
514 PUSH (*args); 516 PUSH (*args);
515 if (nargs < mandatory) 517 if (nargs < mandatory)
@@ -528,7 +530,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
528 } 530 }
529 else if (rest) 531 else if (rest)
530 { 532 {
531 int i; 533 ptrdiff_t i;
532 for (i = 0 ; i < nonrest; i++, args++) 534 for (i = 0 ; i < nonrest; i++, args++)
533 PUSH (*args); 535 PUSH (*args);
534 PUSH (Flist (nargs - nonrest, args)); 536 PUSH (Flist (nargs - nonrest, args));