From ca2e32dcc4ed8bba25a700cd7c8fa8aba6c94ae5 Mon Sep 17 00:00:00 2001 From: Nickolas Lloyd Date: Thu, 22 Dec 2016 20:05:16 -0500 Subject: ; Minor reorg of bytecode interpreter/JIT compiler ; * src/bytecode.c (exec_byte_code, exec_byte_code__): Use exec_byte_code as the single entrypoint for both the interpreter and JIT compiler. ; * src/bytecode-jit.c (jit_byte_code): Remove jit_byte_code to be replaced by exec_byte_code. ; * src/bytecode.h: Add function prototypes. ; * src/eval.c (funcall_lambda): Use exec_byte_code instead of jit_byte_code. ; * src/lisp.h: Update function prototypes. --- src/bytecode.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index c88ca509119..76ec066c637 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -137,7 +137,7 @@ the third, MAXDEPTH, the maximum stack depth used in this function. If the third argument is incorrect, Emacs may crash. */) (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth) { - return exec_byte_code (bytestr, vector, maxdepth, Qnil, 0, NULL); + return exec_byte_code__ (bytestr, vector, maxdepth, Qnil, 0, NULL); } void @@ -155,8 +155,8 @@ bcall0 (Lisp_Object f) executing BYTESTR. */ Lisp_Object -exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, - Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) +exec_byte_code__ (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, + Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) { #ifdef BYTE_CODE_METER int volatile this_op = 0; @@ -1283,6 +1283,24 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, return result; } +Lisp_Object +exec_byte_code (Lisp_Object byte_code, Lisp_Object args_template, + ptrdiff_t nargs, Lisp_Object *args) +{ + if (AREF (byte_code, COMPILED_JIT_ID)) + return jit_exec (byte_code, args_template, nargs, args); + else if (!byte_code_jit_on) + return exec_byte_code__ (AREF (byte_code, COMPILED_BYTECODE), + AREF (byte_code, COMPILED_CONSTANTS), + AREF (byte_code, COMPILED_STACK_DEPTH), + args_template, nargs, args); + else + { + jit_byte_code__ (byte_code); + return jit_exec (byte_code, args_template, nargs, args); + } +} + /* `args_template' has the same meaning as in exec_byte_code() above. */ Lisp_Object get_byte_code_arity (Lisp_Object args_template) -- cgit v1.2.1