~ubuntu-elisp/emacs/+git/master:feature/libjit

Last commit made on 2018-09-09
Get this branch:
git clone -b feature/libjit https://git.launchpad.net/~ubuntu-elisp/emacs/+git/master

Branch merges

Branch information

Name:
feature/libjit
Repository:
lp:~ubuntu-elisp/emacs/+git/master

Recent commits

a25a989... by Eli Zaretskii

Minor type and signature fixes in jit.c

* src/jit.c (get_type) [!USE_LSB_TAG]: Use jit_type_void_ptr
for 'shift'.
(compile_wrong_type_argument): Use the correct signature for
wrong_type_argument native calls.

9efa35e... by Eli Zaretskii

Fix types of Lisp objects in values and function calls

* src/jit.c (car_or_cdr, compile): Use lisp_object_type for
Lisp objects.
(init_jit): Define internal_catch_signature.
(compile): Use internal_catch_signature for 'internal_catch',
as ternary_signature doesn't fit.

f6c33b4... by Ken Brown <email address hidden>

Fix 32-bit Cygwin builds with libjit

* src/lisp.h (USE_STACK_LISP_OBJECTS): Define to false for
32-bit Cygwin builds with libjit.

39c6bef... by Eli Zaretskii

Fix MS-Windows build with libjit

This fixes 32-bit MS-Windows build and hopefully also 64-bit
MS-Windows build (not tested). 32-bit MS-Windows build with wide ints
still doesn't work: I get invalid Lisp objects after JIT compiled code
is invoked.
* configure.ac (HAVE_LIBJIT) [mingw32]: Remove -ljit from
LIBJIT_LIBS, to avoid linking against libjit at build time and
allow loading libjit dynamically at run time.

* src/jit.c [WINDOWSNT]: Include w32.h and w32common.h.
[WINDOWSNT] (DEF_DLL_VAR, LOAD_DLL_VAR): New macros.
(init_libjit_functions) [WINDOWSNT]: New function.
(CONSTANT): A separate version for builds where EMACS_INT_MAX
is equal to INT_MAX (32-bit builds without wide ints). Use
XLI when assigning Lisp objects to integer values.
(untag, compile_make_natnum, compile_make_number)
(unary_intmath): Handle the case of EMACS_INT_MAX > LONG_MAX.
(compile_current_thread, compile): Don't use CONSTANT for
anything that is not a Lisp object.
(emacs_jit_compile): Do nothing if jit-disable is non-nil.
Use XLP to assign and compare Lisp objects to pointers.
(syms_of_jit): New boolean variable jit-disable, by default nil.
(init_jit) [WINDOWSNT]: Call init_libjit_functions.
Define lisp_object_type separately for 64-bit Windows builds
and 32-bit builds with wide ints. Fix some signatures to use
lisp_object_type and correct some that deviated from the
actual functions.
* src/lisp.h (USE_STACK_LISP_OBJECTS): Define to false for
32-bit MinGW builds with libjit.
* src/w32fns.c (syms_of_w32fns) <libjit>: New symbol.
* src/eval.c (Ffuncall, funcall_lambda): Use XLP to compare
Lisp_Object vs a pointer.
* src/emacs.c (main): Move the call to init_jit to before
init_buffer, as the latter calls Lisp and could use JIT.
* src/alloc.c (Fmake_byte_code): Use XPL to assign pointer to
a Lisp_Object field.

* lisp/term/w32-win.el (dynamic-library-alist): Add libjit-0.dll.

7fbcc5b... by Eli Zaretskii

Improve jit-disassemble-to-string

* src/jit.c (Fjit_disassemble_to_string) [!HAVE_OPEN_MEMSTREAM]:
Provide working code for systems that don't have 'open_memstream'.

9c0ed03... by Eli Zaretskii

Fix 32-bit compilation on MS-Windows

* src/jit.c (CONSTANT): Avoid compilation warning on 32-bit
systems about casting a pointer to an integer of a different
size.
(compile) [HAVE__SETJMP]: Use _setjmp instead of setjmp, when
the latter is a macro. Fixes a compilation error on system
that use _setjmp.
(Fjit_disassemble_to_string): Rearrange declaration to avoid
compilation warnings on systems that don't have open_memstream.

a166e8f... by Tom Tromey <email address hidden>

JIT compiler

* lisp/emacs-lisp/jit-support.el: New file.
* src/alloc.c (make_byte_code): Remove.
(Fmake_byte_code): Rewrite.
* src/data.c (Fsubr_arity, notify_variable_watchers): Update.
* src/emacs.c (main): Call syms_of_jit, init_jit.
* src/eval.c (eval_sub, Fapply, FUNCTIONP, Ffuncall, funcall_subr)
(funcall_lambda): Update.
* src/jit.c: New file.
* src/lisp.h (struct subr_function): New struct, extracted from
Lisp_Subr.
(SUBR_MAX_ARGS): New define.
(struct Lisp_Subr): Use struct subr_function.
(COMPILED_JIT_CODE): New constant.
(DEFUN): Update.
(make_byte_code): Don't declare.
(funcall_subr): Add error_obj argument.
(syms_of_jit, init_jit, emacs_jit_compile): Declare.
* src/lread.c (read1): Use Fmake_byte_code.
* test/src/jit-tests.el: New file.

62d9c0c... by Tom Tromey <email address hidden>

Remove obsolete comment

* lisp/emacs-lisp/bytecomp.el (byte-compile-out-tag): Remove comment.

1bdba1a... by Tom Tromey <email address hidden>

Add configury for JIT

* configure.ac: Add --with-libjit. Check for open_memstream.
* src/Makefile.in (LIBJIT, LIBJIT_CFLAGS): New variables.
(EMACS_CFLAGS): Use LIBJIT_CFLAGS.
(base_obj): Add jit.o.
(LIBES): Use LIBJIT.

864fd8f... by Tom Tromey <email address hidden>

Create bytecode.h

* src/bytecode.h: New file.
* src/bytecode.c: Move bytecode definitions to bytecode.h.