From 0cb1df1edd86986d5d7a3ecf607fe78af03d62a0 Mon Sep 17 00:00:00 2001 From: Zach Shaftel Date: Fri, 19 Jun 2020 14:53:20 -0400 Subject: Store the bytecode offset in thread_state * src/lisp.h: * src/eval.c (backtrace_byte_offset): Remove global variable, and put it... * src/thread.h (thread_state): ...in here as m_backtrace_byte_offset, and define backtrace_byte_offset as a macro that points to it. * src/bytecode.c (UPDATE_OFFSET): Move out of #ifdef BYTE_CODE_THREADED. --- src/bytecode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 6b7e9cbc7b9..8e3cddf7851 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -311,6 +311,10 @@ enum byte_code_op #define TOP (*top) +/* Update the thread's bytecode offset, just before NEXT. */ + +#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; @@ -424,14 +428,13 @@ 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 (backtrace_byte_offset = pc - bytestr_data); /* 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 UPDATE_OFFSET 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. */ -- cgit v1.2.1