From 3d5ac37d36ecae90a634515b78608062fc9729be Mon Sep 17 00:00:00 2001 From: Zach Shaftel Date: Sun, 14 Jun 2020 17:20:48 -0400 Subject: 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. --- src/bytecode.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/bytecode.c') 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 #define TOP (*top) +#define UPDATE_OFFSET (backtrace_byte_offset = pc - bytestr_data); + DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0, doc: /* Function used internally in byte-compiled code. The 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, memcpy (bytestr_data, SDATA (bytestr), bytestr_length); unsigned char const *pc = bytestr_data; ptrdiff_t count = SPECPDL_INDEX (); - union specbinding *bt_frame = specpdl_ptr; - bt_frame = backtrace_next (bt_frame); if (!NILP (args_template)) { @@ -426,16 +426,14 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, Threading provides a performance boost. These macros are how we allow the code to be compiled both ways. */ #ifdef BYTE_CODE_THREADED -#define UPDATE_OFFSET(to) \ - if (bt_frame->kind == SPECPDL_BACKTRACE) \ - bt_frame->bt.bytecode_offset = (to); + /* The CASE macro introduces an instruction's body. It is either a label or a case label. */ #define CASE(OP) insn_ ## OP /* NEXT is invoked at the end of an instruction to go to the next instruction. It is either a computed goto, or a plain break. */ -#define NEXT goto *(targets[op = FETCH]) +#define NEXT UPDATE_OFFSET goto *(targets[op = FETCH]) /* FIRST is like NEXT, but is only used at the start of the interpreter body. In the switch-based interpreter it is the 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, } } #endif - UPDATE_OFFSET(pc - bytestr_data); TOP = Ffuncall (op + 1, &TOP); NEXT; } @@ -1454,7 +1451,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, unbind_to (count, Qnil); error ("binding stack not balanced (serious byte compiler bug)"); } - UPDATE_OFFSET(-1); + backtrace_byte_offset = -1; Lisp_Object result = TOP; SAFE_FREE (); return result; -- cgit v1.2.1