aboutsummaryrefslogtreecommitdiffstats
path: root/src/comp.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update Fstring_match calls in comp.cLars Ingebrigtsen2021-10-071-2/+3
| | | | | * src/comp.c (Fcomp_el_to_eln_rel_filename, file_in_eln_sys_dir): Update Fstring_match calls.
* Fix build with native compilation but without zlibEli Zaretskii2021-09-221-0/+10
| | | | | | | | * src/comp.c (comp_hash_source_file): Condition code that requires zlib with HAVE_ZLIB. * etc/NEWS: Explain that '--without-compress-install' is necessary when configuring with native compilation but without zlib.
* Doc string fixes in comp.eEli Zaretskii2021-09-221-8/+26
| | | | | * src/comp.c (Fcomp_el_to_eln_filename) (Fcomp_el_to_eln_rel_filename): Doc fix.
* Avoid compiler warnings in comp.c on MS-WindowsEli Zaretskii2021-09-151-4/+16
| | | | | | * src/comp.c (DEF_DLL_FN, init_gccjit_functions): Don't load and don't define functions/macros if libgccjit doesn't have them, to avoid compiler warnings.
* * Clean-up some unnecessary macro usage in comp.cAndrea Corallo2021-09-131-11/+6
| | | | | | | * src/comp.c (emit_static_object) (Fcomp_native_driver_options_effective_p, add_driver_options) (Fcomp__compile_ctxt_to_file, Fcomp_libgccjit_version): Clean-up unenecessary 'defined (WINDOWSNT)' usage.
* Add support for GCC compiler command-line optionsArthur Miller2021-09-101-0/+58
| | | | | | | | | * lisp/emacs-lisp/comp.el ('native-comp-compiler-options): New option. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Add support for new 'native-comp-compiler-options'. * src/comp.c (Fcomp_native_compiler_options_effective_p): New function. (add_compiler_options): New function. (Fcomp__compile_ctxt_to_file): Call 'add_compiler_options'.
* * Add a dll loader entry for gcc_jit_context_new_cast (bug#50315)Kien Nguyen2021-09-011-0/+6
| | | | | * src/comp.c: Add a dll loader entry for 'gcc_jit_context_new_cast' (bug#50315).
* Implement proper type conversion in native compilerAndreas Schwab2021-08-301-108/+102
| | | | | | | | | | | | * src/comp.c (enum cast_kind_of_type): Remove. (comp_t): Add cast_ptr_to_int, cast_int_to_ptr, remove cast_type_sizes, cast_type_kind, cast_type_names, cast_union_fields, cast_union_field_biggest_type. (emit_coerce): Remove check for type size. (struct cast_type): Remove bytes_size. (define_type_punning): New function. (define_cast_from_to): Implement proper type conversion. (define_cast_functions): Adjust. (bug#50230)
* Set a unique ID for eln files on macOS (bug#45934)Andrea Corallo2021-08-221-0/+9
| | | | | * src/comp.c (Fcomp__compile_ctxt_to_file): Set gcc's -install_name parameter to the real filename.
* Fix NS self contained eln location (bug#49271)Alan Third2021-07-011-1/+27
| | | | | | | | | * Makefile.in: * configure.ac: Change eln file install location to Contents/Frameworks. * src/comp.c (hash_native_abi): Replace dots with underscores in the eln install location as the macOS code-signing tool won't sign the files if the parent directories have dots.
* ; * src/comp.c (ADD_IMPORTED): Fix broken macro.Mattias Engdegård2021-06-181-1/+1
|
* Fix resolution of symlinks during dumpingEli Zaretskii2021-05-271-9/+10
| | | | | | | | | | | | | * src/comp.c (Fcomp_el_to_eln_rel_filename): Don't use 'file-truename', as it is only available once files.el is loaded, which doesn't work during dumping, until loadup loads files.el. Instead, use 'realpath'. (Bug#48578) * src/w32.c (realpath): New function. * src/w32.h (realpath): Add prototype. * nt/mingw-cfg.site (ac_cv_func_realpath) (gl_cv_func_realpath_works): Define to "yes", as this function is now implemented in w32.c.
* * Fix ahead-of-time native compilation for out-of-tree builds (bug#48497)Andrea Corallo2021-05-211-1/+2
| | | | | * src/comp.c (Fcomp_el_to_eln_rel_filename): Expand 'PATH_DUMPLOADSEARCH' while computing 'loadsearch_re_list'.
* Rename comp-deferred-compilationAndrea Corallo2021-05-111-3/+4
| | | | | | | | * lisp/progmodes/elisp-mode.el (emacs-lisp-native-compile-and-load): Rename comp-deferred-compilation -> native-comp-deferred-compilation. * src/comp.c (maybe_defer_native_compilation, syms_of_comp): Likewise.
* Rename comp-eln-load-path → native-comp-eln-load-pathAndrea Corallo2021-05-061-7/+7
| | | | | | | | | | | | * src/comp.c (Fcomp_el_to_eln_filename): Rename comp-eln-load-path → native-comp-eln-load-path. * src/lread.c (maybe_swap_for_eln): Likewise. * lisp/startup.el (native-comp-eln-load-path) (normal-top-level): Likewise. * lisp/emacs-lisp/comp.el (comp-spill-lap-function, comp-final) (comp-eln-load-path-eff, comp-trampoline-compile) (comp-clean-up-stale-eln, comp-run-async-workers) (comp-lookup-eln, batch-byte-native-compile-for-bootstrap): Likewise.
* Rename comp-warning-on-missing-sourceAndrea Corallo2021-05-061-1/+2
| | | | | | | | | * src/lread.c (maybe_swap_for_eln): Rename comp-warning-on-missing-source → native-comp-warning-on-missing-source. * src/comp.c (syms_of_comp): Likewise. * lisp/emacs-lisp/comp.el (native-comp-warning-on-missing-source): Likewise.
* Rename comp-native-driver-options → native-comp-driver-optionsAndrea Corallo2021-05-061-2/+2
| | | | | | | | | * src/comp.c (add_driver_options, syms_of_comp): Rename comp-native-driver-options → native-comp-driver-options. * lisp/emacs-lisp/comp.el (native-comp-driver-options) (comp-ctxt, comp-spill-lap-function, comp-final) (comp-run-async-workers): Likewise. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Likewise.
* Rename comp-debug -> native-comp-debugAndrea Corallo2021-05-061-2/+2
| | | | | | | | | * src/comp.c (emit_ctxt_code, syms_of_comp): Rename comp-debug -> native-comp-debug. * lisp/emacs-lisp/comp.el (native-comp-debug, comp-ctxt) (comp-spill-lap-function, comp-run-async-workers): Likewise. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Likewise. * test/src/comp-tests.el (comp-tests-bootstrap): Likewise.
* Rename comp-speed -> native-comp-speedAndrea Corallo2021-05-061-3/+3
| | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Rename comp-speed -> native-comp-speed. * lisp/emacs-lisp/comp.el (native-comp-speed, comp-ctxt, comp-func, comp-spill-lap-function, comp-trampoline-compile, comp-run-async-workers): Likewise. * src/comp.c (emit_ctxt_code, load_comp_unit, syms_of_comp): Likewise. * test/src/comp-tests.el (comp-tests-tco, comp-tests-fw-prop-1) (comp-tests-check-ret-type-spec, comp-tests-pure): Likewise.
* Rename feature `nativecomp' into `native-compile'Andrea Corallo2021-05-051-1/+1
| | | | | | | | | | | | | | | * test/src/comp-tests.el : Rename feature `nativecomp' into `native-compile'. * test/lisp/help-fns-tests.el (help-fns-test-lisp-defun): Likewise. * src/comp.c (syms_of_comp): Likewise. * lisp/startup.el (normal-top-level): Likewise. * lisp/loadup.el: Likewise. * lisp/help.el (help-function-arglist): Likewise. * lisp/emacs-lisp/package.el (package--native-compile-async) (package--delete-directory): Likewise. * lisp/emacs-lisp/nadvice.el (advice--add-function): Likewise. * lisp/emacs-lisp/comp.el (comp-ensure-native-compiler): Likewise. * lisp/emacs-lisp/advice.el (ad-add-advice): Likewise.
* ; * src/comp.c: Fix typos.Eli Zaretskii2021-04-271-2/+2
|
* ; Fix typosStefan Kangas2021-04-271-3/+3
|
* * src/comp.c (fixup_eln_load_path): Simplify code.Eli Zaretskii2021-04-181-7/+5
|
* Fix loading *.eln files when Emacs is installed via symlinksEli Zaretskii2021-04-171-17/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/emacs.c (real_filename, set_invocation_vars) (init_vars_for_load): Functions deleted; callers adjusted. (init_cmdargs): Put back all the code which was extracted into set_invocation_vars. (load_pdump_find_executable): Make sure the return value has any symlinks in it expanded. (load_pdump): Accept only 2 arguments, not 3. Determine both the file name of the Emacs executable and of the dump file in synchronized manner, so that if we decided to look for the dump file in its hardcoded installation directory, the directory of the Emacs executable will also be where we expect it to be installed. Pass only 2 arguments to pdumper_load. (Bug#47800) (Bug#44128) * src/pdumper.c (dump_do_dump_relocation): Use emacs_execdir instead of Vinvocation_directory to produce absolute file names of *.eln files that are recorded in the pdumper file. Pass the full .eln file name to fixup_eln_load_path. (pdumper_set_emacs_execdir) [HAVE_NATIVE_COMP]: New function. (pdumper_load) [HAVE_NATIVE_COMP]: Call pdumper_set_emacs_execdir. * src/comp.c (fixup_eln_load_path): Use Fsubstring_no_properties instead of Fsubstring. No need to cons a file name, as the caller already did that. Use explicit const string to avoid "magic" values. * lisp/startup.el (normal-top-level): Use expand-file-name instead of concat. Decode comp-eln-load-path and expand-file-name its members.
* * Introduce `comp-file-preloaded-p'Andrea Corallo2021-04-051-7/+13
| | | | | * src/comp.c (syms_of_comp): Define `comp-file-preloaded-p'. (Fcomp_el_to_eln_filename): Account for `comp-file-preloaded-p'.
* * src/comp.c (fixup_eln_load_path): Fix parameter name.Andrea Corallo2021-04-041-2/+2
|
* * src/comp.c (Fcomp_el_to_eln_filename): Fix doc.Andrea Corallo2021-04-041-1/+2
|
* Output native compiled preloaded files into the 'preloaded' subfolderAndrea Corallo2021-04-041-7/+22
| | | | | | | | | * src/comp.c (fixup_eln_load_path): Account the fact that the file can be dumped in the 'preloaded' subfolder. * lisp/loadup.el: Likewise. * src/lread.c (maybe_swap_for_eln1): New function. (maybe_swap_for_eln): Handle 'preloaded' subfolder. * src/Makefile.in (LISP_PRELOADED): Export preloaded files.
* Issue a warning when eln look-up fails due to missing .el source file.Andrea Corallo2021-04-011-1/+2
| | | | | | | | | * lisp/emacs-lisp/comp.el (comp-warning-on-missing-source): New customize. * src/lread.c (maybe_swap_for_eln): Issue a warning when eln look-up fails due to missing .el source file. * src/comp.c (syms_of_comp): Define 'Qcomp_warning_on_missing_source'.
* * src/comp.c (Fcomp__compile_ctxt_to_file): Fix debug level 1.Eli Zaretskii2021-03-311-1/+1
|
* Rework native compilation `comp-debug' (bug#46495)Andrea Corallo2021-03-311-2/+2
| | | | | | | * lisp/emacs-lisp/comp.el (comp-debug): Update docstring and move default on Windows systems from 0 to 1. * src/comp.c (Fcomp__compile_ctxt_to_file): Tweak debug levels.
* Do not defer compilation when bytecode is explicitly requested (bug#46617)Andrea Corallo2021-03-311-1/+9
| | | | | | | | | | | * src/comp.c (maybe_defer_native_compilation): Check if the file is registered in 'V_comp_no_native_file_h'. (syms_of_comp): 'V_comp_no_native_file_h' new global. * src/lread.c (maybe_swap_for_eln): Register files in 'V_comp_no_native_file_h'. * lisp/faces.el (tty-run-terminal-initialization): Do not explicitly load .elc file to not exclude .eln being loaded in place.
* Improve two native compiler related docstrings.Andrea Corallo2021-03-241-0/+2
| | | | | * lisp/emacs-lisp/comp.el (comp-eln-load-path-eff): Improve docstring. * src/comp.c (comp-eln-load-path): Likewise.
* ; * src/comp.c (Fcomp_el_to_eln_filename): Improve docstring.Andrea Corallo2021-03-211-1/+2
|
* Prevent unnecessary multiple .el hashing in 'maybe_swap_for_eln'Andrea Corallo2021-03-211-6/+15
| | | | | | | | | * src/comp.c (Fcomp_el_to_eln_rel_filename): New function. (Fcomp_el_to_eln_filename): Make use of. (syms_of_comp): Register 'Scomp_el_to_eln_rel_filename'. * src/lread.c (maybe_swap_for_eln): Make use of 'Fcomp_el_to_eln_rel_filename' to hash prevent unnecessary multiple hashing.
* Prefer expand-file-name to concat in native-compilation codeEli Zaretskii2021-03-151-4/+4
| | | | | | | * lisp/emacs-lisp/comp.el (comp-eln-load-path-eff): * src/comp.c (Fcomp_el_to_eln_filename) (eln_load_path_final_clean_up): Prefer expand-file-name to concat. (Bug#43725)
* Don't call setjmp through a function pointer on Windows (bug#47067)Pip Cet2021-03-141-12/+14
| | | | | | | * src/comp.c (ABI_VERSION): Bump. (emit_setjmp): Call setjmp directly. (declare_runtime_imported_funcs): Remove setjmp. (helper_link_table): Remove entry for setjmp.
* Fix hang due to failure to clean up *.eln.old files at exitEli Zaretskii2021-03-141-1/+1
| | | | | | * src/comp.c (eln_load_path_final_clean_up): Call internal_delete_file, not Fdelete_file, to ignore any errors. (Bug#46972)
* * src/comp.c (ABI_VERSION): Bump following-up 380ba045c4.Andrea Corallo2021-03-091-1/+1
|
* * Fix comp unit type decl in eln files to fix GC crash (bug#46256)Pip Cet2021-03-091-1/+1
| | | | | * src/comp.c (emit_ctxt_code): Allocate comp_unit as a Lisp_Object, not a pointer to pointer to Lisp_Object.
* Zero stale pointer when unloading comp units (bug#46256)Pip Cet2021-03-091-0/+14
| | | | | * src/alloc.c (cleanup_vector): Call unload_comp_unit. * src/comp.c (unload_comp_unit): New function.
* * Handle `comp-native-driver-options' both as file-local both as globalAndrea Corallo2021-03-071-3/+16
| | | | | | | * src/comp.c (add_driver_options): Throw an error if `comp-native-driver-options' is set globally but 'gcc_jit_context_add_driver_option' is not available, ignore for the file-local case.
* ; * src/comp.c (load_comp_unit): Fix a comment.Andrea Corallo2021-03-071-1/+1
|
* Allow for `comp-native-driver-options' to work as a file-local variable.Andrea Corallo2021-03-071-1/+3
|
* * Work around GCC PR99126 on all libgccjit < 11Andrea Corallo2021-03-071-1/+2
| | | | | * src/comp.c (Fcomp__compile_ctxt_to_file): Work around GCC PR99126 on all libgccjit < 11.
* Fix encoding of file names in comp.cEli Zaretskii2021-03-071-1/+6
| | | | | * src/comp.c (Fcomp__compile_ctxt_to_file) [WINDOWSNT]: Fix encoding of file names passed to libgccjit.
* ; * src/comp.c (Fcomp__compile_ctxt_to_file) [WINDOWSNT]: Fix last change.Eli Zaretskii2021-03-071-0/+1
|
* Fix libgccjit PROGNAME on MS-WindowsEli Zaretskii2021-03-071-0/+30
| | | | | | | | * src/comp.c [WINDOWSNT]: Import gcc_jit_context_set_str_option. (init_gccjit_functions): Load gcc_jit_context_set_str_option. (gcc_jit_context_set_str_option) [WINDOWSNT]: New macro. (Fcomp__compile_ctxt_to_file) [WINDOWSNT]: Pass the actual name of the libgccjit DLL to the library, to be used as PROGNAME.
* Fix some unsafe uses of SSDATA in comp.cEli Zaretskii2021-03-051-12/+21
| | | | | | | | | | * src/comp.c (comp_hash_source_file) (Fcomp__compile_ctxt_to_file, Fnative_elisp_load): Encode file names before passing them to library APIs. (Fcomp__compile_ctxt_to_file): use emacs_fopen instead of fopen. (declare_lex_function): Avoid keeping a 'char *' pointer around while calling Lisp, which could trigger GC, which could relocate string data.
* * Harden `comp-abi-hash' computationAndrea Corallo2021-03-051-1/+12
| | | | | | | | | Account for subr arity in `comp-abi-hash' computation as that's part of the ABI exposed to .eln files. * src/comp.c (Fcomp__subr_signature): New support function. (hash_native_abi): Make use of. (syms_of_comp): Register 'Scomp__subr_signature'.