aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode.c
diff options
context:
space:
mode:
authorZach Shaftel2020-06-14 17:20:48 -0400
committerZach Shaftel2020-06-14 17:20:48 -0400
commit3d5ac37d36ecae90a634515b78608062fc9729be (patch)
treebe44540774a9242f8990eb3f1ed46d17ed7b51c1 /src/bytecode.c
parentf6ec28d7974785b625e395d57cb18d1f2110fe4c (diff)
downloademacs-3d5ac37d36ecae90a634515b78608062fc9729be.tar.gz
emacs-3d5ac37d36ecae90a634515b78608062fc9729be.zip
Revert "Store bytecode offset within exec_byte_code"
This reverts commit f6ec28d7974785b625e395d57cb18d1f2110fe4c. This commit was just a terrible idea. Caused segfaults, violated the comment in lisp.h that only eval.c should access `union specbinding`, and didn't even improve performance.
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index f4900fc588f..29b76f88ef7 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -311,6 +311,8 @@ enum byte_code_op
311 311
312#define TOP (*top) 312#define TOP (*top)
313 313
314#define UPDATE_OFFSET (backtrace_byte_offset = pc - bytestr_data);
315
314DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0, 316DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0,
315 doc: /* Function used internally in byte-compiled code. 317 doc: /* Function used internally in byte-compiled code.
316The first argument, BYTESTR, is a string of byte code; 318The first argument, BYTESTR, is a string of byte code;
@@ -378,8 +380,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
378 memcpy (bytestr_data, SDATA (bytestr), bytestr_length); 380 memcpy (bytestr_data, SDATA (bytestr), bytestr_length);
379 unsigned char const *pc = bytestr_data; 381 unsigned char const *pc = bytestr_data;
380 ptrdiff_t count = SPECPDL_INDEX (); 382 ptrdiff_t count = SPECPDL_INDEX ();
381 union specbinding *bt_frame = specpdl_ptr;
382 bt_frame = backtrace_next (bt_frame);
383 383
384 if (!NILP (args_template)) 384 if (!NILP (args_template))
385 { 385 {
@@ -426,16 +426,14 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
426 Threading provides a performance boost. These macros are how 426 Threading provides a performance boost. These macros are how
427 we allow the code to be compiled both ways. */ 427 we allow the code to be compiled both ways. */
428#ifdef BYTE_CODE_THREADED 428#ifdef BYTE_CODE_THREADED
429#define UPDATE_OFFSET(to) \ 429
430 if (bt_frame->kind == SPECPDL_BACKTRACE) \
431 bt_frame->bt.bytecode_offset = (to);
432 /* The CASE macro introduces an instruction's body. It is 430 /* The CASE macro introduces an instruction's body. It is
433 either a label or a case label. */ 431 either a label or a case label. */
434#define CASE(OP) insn_ ## OP 432#define CASE(OP) insn_ ## OP
435 /* NEXT is invoked at the end of an instruction to go to the 433 /* NEXT is invoked at the end of an instruction to go to the
436 next instruction. It is either a computed goto, or a 434 next instruction. It is either a computed goto, or a
437 plain break. */ 435 plain break. */
438#define NEXT goto *(targets[op = FETCH]) 436#define NEXT UPDATE_OFFSET goto *(targets[op = FETCH])
439 /* FIRST is like NEXT, but is only used at the start of the 437 /* FIRST is like NEXT, but is only used at the start of the
440 interpreter body. In the switch-based interpreter it is the 438 interpreter body. In the switch-based interpreter it is the
441 switch, so the threaded definition must include a semicolon. */ 439 switch, so the threaded definition must include a semicolon. */
@@ -637,7 +635,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
637 } 635 }
638 } 636 }
639#endif 637#endif
640 UPDATE_OFFSET(pc - bytestr_data);
641 TOP = Ffuncall (op + 1, &TOP); 638 TOP = Ffuncall (op + 1, &TOP);
642 NEXT; 639 NEXT;
643 } 640 }
@@ -1454,7 +1451,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1454 unbind_to (count, Qnil); 1451 unbind_to (count, Qnil);
1455 error ("binding stack not balanced (serious byte compiler bug)"); 1452 error ("binding stack not balanced (serious byte compiler bug)");
1456 } 1453 }
1457 UPDATE_OFFSET(-1); 1454 backtrace_byte_offset = -1;
1458 Lisp_Object result = TOP; 1455 Lisp_Object result = TOP;
1459 SAFE_FREE (); 1456 SAFE_FREE ();
1460 return result; 1457 return result;