aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode.c
diff options
context:
space:
mode:
authorPaul Eggert2013-10-03 23:51:50 -0700
committerPaul Eggert2013-10-03 23:51:50 -0700
commit157fec2e190a84345138a0cc69e35f177c4d4a56 (patch)
treedc33f2ec3a79ddfb218d54642fbd909d6746e0e1 /src/bytecode.c
parent6cad7ba3b95684866a6dbcd56bb4d7cdde91bce4 (diff)
downloademacs-157fec2e190a84345138a0cc69e35f177c4d4a56.tar.gz
emacs-157fec2e190a84345138a0cc69e35f177c4d4a56.zip
* bytecode.c (exec_byte_code): Use some more volatile variables
to work around local variables getting clobbered by longjmp. Port to pre-C99, which doesn't allow decls after stmts.
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index f7ccd35cbba..b9cb36c871f 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -332,7 +332,7 @@ struct byte_stack
332 332
333/* A list of currently active byte-code execution value stacks. 333/* A list of currently active byte-code execution value stacks.
334 Fbyte_code adds an entry to the head of this list before it starts 334 Fbyte_code adds an entry to the head of this list before it starts
335 processing byte-code, and it removed the entry again when it is 335 processing byte-code, and it removes the entry again when it is
336 done. Signaling an error truncates the list analogous to 336 done. Signaling an error truncates the list analogous to
337 gcprolist. */ 337 gcprolist. */
338 338
@@ -501,19 +501,22 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
501 Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) 501 Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args)
502{ 502{
503 ptrdiff_t count = SPECPDL_INDEX (); 503 ptrdiff_t count = SPECPDL_INDEX ();
504 ptrdiff_t volatile count_volatile;
504#ifdef BYTE_CODE_METER 505#ifdef BYTE_CODE_METER
505 int this_op = 0; 506 int volatile this_op = 0;
506 int prev_op; 507 int prev_op;
507#endif 508#endif
508 int op; 509 int op;
509 /* Lisp_Object v1, v2; */ 510 /* Lisp_Object v1, v2; */
510 Lisp_Object *vectorp; 511 Lisp_Object *vectorp;
512 Lisp_Object *volatile vectorp_volatile;
511#ifdef BYTE_CODE_SAFE 513#ifdef BYTE_CODE_SAFE
512 ptrdiff_t const_length; 514 ptrdiff_t volatile const_length;
513 Lisp_Object *stacke; 515 Lisp_Object *volatile stacke;
514 ptrdiff_t bytestr_length; 516 ptrdiff_t volatile bytestr_length;
515#endif 517#endif
516 struct byte_stack stack; 518 struct byte_stack stack;
519 struct byte_stack volatile stack_volatile;
517 Lisp_Object *top; 520 Lisp_Object *top;
518 Lisp_Object result; 521 Lisp_Object result;
519 enum handlertype type; 522 enum handlertype type;
@@ -1119,16 +1122,25 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1119 PUSH_HANDLER (c, tag, type); 1122 PUSH_HANDLER (c, tag, type);
1120 c->bytecode_dest = dest; 1123 c->bytecode_dest = dest;
1121 c->bytecode_top = top; 1124 c->bytecode_top = top;
1125 count_volatile = count;
1126 stack_volatile = stack;
1127 vectorp_volatile = vectorp;
1128
1122 if (sys_setjmp (c->jmp)) 1129 if (sys_setjmp (c->jmp))
1123 { 1130 {
1124 struct handler *c = handlerlist; 1131 struct handler *c = handlerlist;
1132 int dest;
1125 top = c->bytecode_top; 1133 top = c->bytecode_top;
1126 int dest = c->bytecode_dest; 1134 dest = c->bytecode_dest;
1127 handlerlist = c->next; 1135 handlerlist = c->next;
1128 PUSH (c->val); 1136 PUSH (c->val);
1129 CHECK_RANGE (dest); 1137 CHECK_RANGE (dest);
1138 stack = stack_volatile;
1130 stack.pc = stack.byte_string_start + dest; 1139 stack.pc = stack.byte_string_start + dest;
1131 } 1140 }
1141
1142 count = count_volatile;
1143 vectorp = vectorp_volatile;
1132 NEXT; 1144 NEXT;
1133 } 1145 }
1134 1146