summaryrefslogtreecommitdiff
path: root/src/comp.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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'.
* * src/comp.c (hash_native_abi): Account for `system-configuraton-options'.Andrea Corallo2021-03-041-1/+2
|
* Don't call _setjmp through a function pointer (Bug#46824)Pip Cet2021-03-031-7/+17
| | | | | | | | | * src/comp.c (helper_link_table): Don't include SETJMP except on Windows. (emit_setjmp): Don't use function pointers except on Windows. (declare_runtime_imported_funcs): Don't import SETJMP at runtime. (ABI_VERSION): Bump. * test/src/comp-tests.el (46824-1): New test. * test/src/comp-test-funcs.el (comp-test-46824-1-f): New function.
* * src/comp.c (return_nil): Make it not a nested function.Andrea Corallo2021-03-031-2/+8
|
* Fix compilation warnings in --with-wide-int build on WindowsEli Zaretskii2021-03-031-3/+9
| | | | | | | | | | * src/comp.c (emit_rvalue_from_emacs_uint) (emit_rvalue_from_lisp_word_tag): Fix comparison of unsigned values. (gcc_jit_context_new_rvalue_from_ptr): Define only if LISP_WORDS_ARE_POINTERS, to avoid compilation warning. (init_gccjit_functions): Load gcc_jit_context_new_rvalue_from_ptr only if LISP_WORDS_ARE_POINTERS.
* Migrate and rename a bunch of functions from comp.el to comp-cstr.elAndrea Corallo2021-02-281-2/+2
| | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-imm-vld-p) (comp-cstr-imm, comp-cstr-fixnum-p, comp-cstr-symbol-p) (comp-cstr-cons-p): Move and rename from 'comp.el'. * lisp/emacs-lisp/comp.el (comp-mvar-type-hint-match-p) (make-comp-mvar, comp-emit-assume, comp-fwprop-prologue) (comp-function-foldable-p, comp-function-call-maybe-fold) (comp-fwprop-call, comp-fwprop-insn, comp-call-optim-func) (comp-compute-function-type): Update for renamed functions. * src/comp.c (emit_mvar_rval): Likewise. * test/src/comp-tests.el (comp-tests-mentioned-p-1) (comp-tests-cond-rw-checker-val): Likewise.
* * Canonicalize filenames on Windows before hashing (bug#46256)Andrea Corallo2021-02-261-2/+9
| | | | | * src/comp.c (Fcomp_el_to_eln_filename): On Windowns canonicalize filenames before hashing.
* * Work around bug#46495 (GCC PR99126)Andrea Corallo2021-02-191-0/+15
| | | | | | | * src/comp.c (gcc_jit_context_add_command_line_option): Import for dynamic load. (Fcomp__compile_ctxt_to_file): Disable GCC "isolate-paths" on GCC 10.
* * Remove unnecessary function 'emit_rvalue_from_unsigned_long_long'Andrea Corallo2021-02-191-47/+3
| | | | | | | | * src/comp.c (emit_rvalue_from_unsigned_long_long): Remove function. (emit_rvalue_from_emacs_uint, emit_rvalue_from_lisp_word_tag) (emit_rvalue_from_lisp_word): Make use of 'emit_rvalue_from_long_long'.
* * Pacify GCC warning on non wide-int configurationsAndrea Corallo2021-02-191-8/+12
| | | | | | | * src/comp.c (emit_rvalue_from_emacs_uint) (emit_rvalue_from_lisp_word_tag): Pacify GCC warning. (emit_rvalue_from_unsigned_long_long): Define it only when necessary.
* * Add a bunch of assertions for fixnums coming from Lisp later used as intAndrea Corallo2021-02-181-0/+7
| | | | | | * src/comp.c (emit_limple_insn, declare_lex_function) (compile_function, Fcomp__compile_ctxt_to_file): Add some assertion.
* * Add assertion guarding against emitting a relocation array overflowAndrea Corallo2021-02-181-11/+19
| | | | | | | | | * src/comp.c (reloc_array_t): New type. (comp_t, imm_reloc_t): Make use of 'reloc_array_t'. (obj_to_reloc): Add an assertion not to overflow relocation arrays. (emit_lisp_obj_reloc_lval, emit_limple_insn) (declare_imported_data_relocs): Make use of 'reloc_array_t'.
* * src/comp.c (Fcomp__compile_ctxt_to_file): Clean-up unused variable.Andrea Corallo2021-02-171-2/+0
|
* * Clean-up some signal related dead-codeAndrea Corallo2021-02-161-25/+0
| | | | | * src/comp.c (restore_sigmask): Remove function. (Fcomp__compile_ctxt_to_file): Remove some dead-code.
* * src/comp.c (check_comp_unit_relocs): Prefer ptrdiff_t to EMACS_INT.Andrea Corallo2021-02-161-2/+2
|
* * Better long range checkAndrea Corallo2021-02-161-4/+4
| | | | | | * src/comp.c (emit_rvalue_from_emacs_uint) (emit_rvalue_from_emacs_int, emit_rvalue_from_lisp_word_tag) (emit_rvalue_from_lisp_word): Better long range check.
* * Sanitize frame slot access in finalAndrea Corallo2021-02-161-6/+9
| | | | | | | * src/comp.c (comp_t): Add 'frame_size' field. (emit_mvar_lval): Add sanity check on frame element access. (compile_function): Initialize 'comp.frame_size' and 'comp.frame_size'.
* Revert "* src/comp.c (define_jmp_buf): Use 'jmp_buf' instead of 'sys_jmp_buf'."Andrea Corallo2021-02-141-1/+1
| | | | | | | This reverts commit bebec46bcbf0e52460b08234c067d7a2cb0f2246. Looking at the git history I realize now the use of 'sys_jmp_buf' was intentional.
* * src/comp.c (define_jmp_buf): Use 'jmp_buf' instead of 'sys_jmp_buf'.Andrea Corallo2021-02-141-1/+1
|
* * src/comp.c (load_comp_unit): Fix 'data_ephemeral_vec' shadowing decl.Andrea Corallo2021-02-141-1/+1
|
* * Remove `system-configuration' from eln filenameAndrea Corallo2021-02-031-7/+3
| | | | | | * src/comp.c (hash_native_abi): Remove `system-configuration' from eln filename. Add `system-configuration' and `emacs-version' into `comp-abi-hash'.
* * Short eln filename hashesAndrea Corallo2021-02-031-2/+5
| | | | | | * src/comp.c (HASH_LENGTH): New macro. (comp_hash_string, comp_hash_source_file): Trim the hash before returning.
* Make `comp-enable-subr-trampolines' effective for advices (bug#45854)Andrea Corallo2021-01-171-3/+3
| | | | | | | * src/comp.c: Copyright update. (syms_of_comp): Update `comp-enable-subr-trampolines' doc. * lisp/emacs-lisp/comp.el (comp-subr-trampoline-install): Check for `comp-enable-subr-trampolines'.
* Improve `comp-libgccjit-reproducer'Andrea Corallo2021-01-091-1/+1
| | | | | | | | * src/comp.c (Fcomp__compile_ctxt_to_file): Better libgccjit reproducer file name. * lisp/emacs-lisp/comp.el (comp-libgccjit-reproducer): Doc update. (comp-final, comp-run-async-workers): Pass `comp-libgccjit-reproducer' setting to child workers.
* Add new customize `comp-libgccjit-reproducer'Andrea Corallo2021-01-091-2/+5
| | | | | | | * lisp/emacs-lisp/comp.el (comp-libgccjit-reproducer): New customize. * src/comp.c (Fcomp__compile_ctxt_to_file): Use `comp-libgccjit-reproducer' for dumping repoducer. (syms_of_comp): Define 'Qcomp_libgccjit_reproducer'.
* * src/comp.c (Fcomp__compile_ctxt_to_file): Fix hash table iteration.Andrea Corallo2021-01-011-4/+6
|
* Introduce 'unreachable' LIMPLE operatorAndrea Corallo2021-01-011-18/+29
| | | | | | | | | | | | | | | | | | | | | | | | Introduce 'unreachable' as LIMPLE operater so we can handle correctly in the CFG functions throwing values or signaling errors. * src/comp.c (retrive_block): Better error diagnostic. (emit_limple_insn): Add `unreachable'. (compile_function): Fix block iteration. (syms_of_comp): Define 'Qunreachable'. * lisp/emacs-lisp/comp.el (comp-block): New variable. (comp-block-lap): Add `non-ret-insn' slot. (comp-branch-op-p): New predicate. (comp-limple-lock-keywords): Color `unreachable' as red. (comp-compute-edges): Add `unreachable'. (comp-fwprop-call): Store non returning function call. (comp-fwprop*): Update. (comp-clean-orphan-blocks, comp-rewrite-non-locals): New functions. (comp-fwprop): Call `comp-rewrite-non-locals'. * test/src/comp-tests.el (comp-tests-type-spec-tests): Add two tests. * test/src/comp-test-funcs.el (comp-test-non-local-1) (comp-test-non-local-2, comp-test-non-local-3) (comp-test-non-local-4): New functions.
* Store function type and expose it with `subr-type'Andrea Corallo2020-12-281-12/+16
| | | | | | | | | | | | | | | | | | | | * src/lisp.h (struct Lisp_Subr): Add 'type' field. (SUBR_TYPE): New inline accessor. * src/pdumper.c (dump_subr): Update for 'type' field. * src/data.c (Fsubr_type): New primitive. (syms_of_data): Update. * src/comp.c (ABI_VERSION): Bump new ABI version. (make_subr): Set type. (Fcomp__register_lambda, Fcomp__register_subr) (Fcomp__late_register_subr): Receive and pass subr type to 'make_subr'. * src/alloc.c (mark_object): Mark subr type. * lisp/emacs-lisp/comp.el (comp-func): Change slot type into mvar. (comp-emit-for-top-level, comp-emit-lambda-for-top-level): Pass type mvar to subr register functions. (comp-compute-function-type): Fix-up subr type mvars. * test/src/comp-tests.el (comp-tests-check-ret-type-spec): Use `subr-type'.
* Reorder subr register function arguments to make some roomAndrea Corallo2020-12-281-13/+14
| | | | | | | | * src/comp.c (Fcomp__register_lambda, Fcomp__register_subr) (Fcomp__late_register_subr): Use a rest arg to pass 'doc_idx' and 'intspec' parameters. * lisp/emacs-lisp/comp.el (comp-emit-for-top-level) (comp-emit-lambda-for-top-level): Update.
* * Don't require trailing backslashes in `comp-eln-load-path' (bug#45462)Andrea Corallo2020-12-271-1/+2
| | | | | * src/comp.c (Fcomp_el_to_eln_filename): Don't require trailing backslashes in comp-eln-load-path.
* Invert basic block argument order in LIMPLE cond-jumpAndrea Corallo2020-12-241-2/+2
| | | | | | | * lisp/emacs-lisp/comp.el (comp-emit-cond-jump) (comp-emit-switch, comp-emit-narg-prologue, comp-add-cond-cstrs): Invert basic block argument order in LIMPLE cond-jump. * src/comp.c (emit_limple_insn): Likewise.
* Fix --with-nativecomp Windows build (bug#45303)Liāu, Kiong-Gē 廖宮毅2020-12-221-1/+1
| | | | | | | | | | Liāu, Kiong-Gē 廖宮毅 <gongyi.liao@gmail.com> * src/comp.c (eln_load_path_final_clean_up): Fix argument order. * nt/mingw-cfg.site (ac_cv_func_strsignal): Force `ac_cv_func_strsignal' to no. Copyright-paperwork-exempt: yes
* Fix Windows build link-time zlib error (bug#45303)Andrea Corallo2020-12-211-88/+0
| | | | | | | | * src/lisp.h (md5_gz_stream): Declare. * src/comp.c (accumulate_and_process_md5) (final_process_md5, md5_gz_stream): Remove. * src/decompress.c (accumulate_and_process_md5) (final_process_md5, md5_gz_stream): Move from comp.c.
* * src/comp.c (eln_load_path_final_clean_up): Fix call arg order (bug#45303).Andrea Corallo2020-12-211-1/+1
|
* * src/comp.c (Fcomp__compile_ctxt_to_file): Fix sigmask store/restore.Andrea Corallo2020-12-211-2/+1
|
* * Fix missing 'gcc_jit_type_get_const' macro definition (bug#45303).Andrea Corallo2020-12-201-0/+1
| | | | * src/comp.c (gcc_jit_type_get_pointer): Define macro.
* Add 'internal_condition_case_5' (bug#45303).Andrea Corallo2020-12-191-2/+2
| | | | | | | | * src/lisp.h (internal_condition_case_4) (internal_condition_case_5): Declare. * src/eval.c (internal_condition_case_5): New function. * src/comp.c (eln_load_path_final_clean_up): Use 'internal_condition_case_5'.
* * Add 'gcc_jit_type_get_const' to Windows dynamic load machinery (bug#45303).Andrea Corallo2020-12-191-0/+3
| | | | | * src/comp.c: Add 'gcc_jit_type_get_const' to windows dynamic load machinery.