• Eli Zaretskii's avatar
    Fix MS-Windows build with libjit · 39c6bef8
    Eli Zaretskii authored
    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.
    39c6bef8