diff options
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/src/comp.c b/src/comp.c index 7d2987605d9..1b55226b0c3 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -5174,8 +5174,7 @@ maybe_defer_native_compilation (Lisp_Object function_name, | |||
| 5174 | if (!load_gccjit_if_necessary (false)) | 5174 | if (!load_gccjit_if_necessary (false)) |
| 5175 | return; | 5175 | return; |
| 5176 | 5176 | ||
| 5177 | if (!native_comp_deferred_compilation | 5177 | if (!native_comp_jit_compilation |
| 5178 | || !NILP (Vinhibit_automatic_native_compilation) | ||
| 5179 | || noninteractive | 5178 | || noninteractive |
| 5180 | || !NILP (Vpurify_flag) | 5179 | || !NILP (Vpurify_flag) |
| 5181 | || !COMPILEDP (definition) | 5180 | || !COMPILEDP (definition) |
| @@ -5672,28 +5671,18 @@ syms_of_comp (void) | |||
| 5672 | { | 5671 | { |
| 5673 | #ifdef HAVE_NATIVE_COMP | 5672 | #ifdef HAVE_NATIVE_COMP |
| 5674 | DEFVAR_LISP ("comp--delayed-sources", Vcomp__delayed_sources, | 5673 | DEFVAR_LISP ("comp--delayed-sources", Vcomp__delayed_sources, |
| 5675 | doc: /* List of sources to be native-compiled when startup is finished. | 5674 | doc: /* List of sources to be native-compiled when startup is finished. |
| 5676 | For internal use. */); | 5675 | For internal use. */); |
| 5677 | DEFVAR_BOOL ("comp--compilable", | 5676 | DEFVAR_BOOL ("comp--compilable", comp__compilable, |
| 5678 | comp__compilable, | 5677 | doc: /* Non-nil when comp.el can be native compiled. |
| 5679 | doc: /* Non-nil when comp.el can be native compiled. | ||
| 5680 | For internal use. */); | 5678 | For internal use. */); |
| 5681 | /* Compiler control customizes. */ | 5679 | /* Compiler control customizes. */ |
| 5682 | DEFVAR_LISP ("inhibit-automatic-native-compilation", | 5680 | DEFVAR_BOOL ("native-comp-jit-compilation", native_comp_jit_compilation, |
| 5683 | Vinhibit_automatic_native_compilation, | 5681 | doc: /* If non-nil, compile loaded .elc files asynchronously. |
| 5684 | doc: /* If non-nil, inhibit automatic native compilation of loaded .elc files. | ||
| 5685 | 5682 | ||
| 5686 | After compilation, each function definition is updated to the native | 5683 | After compilation, each function definition is updated to use the |
| 5687 | compiled one. */); | 5684 | natively-compiled one. */); |
| 5688 | Vinhibit_automatic_native_compilation = Qnil; | 5685 | native_comp_jit_compilation = true; |
| 5689 | |||
| 5690 | DEFVAR_BOOL ("native-comp-deferred-compilation", | ||
| 5691 | native_comp_deferred_compilation, | ||
| 5692 | doc: /* If non-nil compile loaded .elc files asynchronously. | ||
| 5693 | |||
| 5694 | After compilation, each function definition is updated to the native | ||
| 5695 | compiled one. */); | ||
| 5696 | native_comp_deferred_compilation = true; | ||
| 5697 | 5686 | ||
| 5698 | DEFSYM (Qnative_comp_speed, "native-comp-speed"); | 5687 | DEFSYM (Qnative_comp_speed, "native-comp-speed"); |
| 5699 | DEFSYM (Qnative_comp_debug, "native-comp-debug"); | 5688 | DEFSYM (Qnative_comp_debug, "native-comp-debug"); |
| @@ -5837,74 +5826,83 @@ compiled one. */); | |||
| 5837 | /* FIXME should be initialized but not here... Plus this don't have | 5826 | /* FIXME should be initialized but not here... Plus this don't have |
| 5838 | to be necessarily exposed to lisp but can easy debug for now. */ | 5827 | to be necessarily exposed to lisp but can easy debug for now. */ |
| 5839 | DEFVAR_LISP ("comp-subr-list", Vcomp_subr_list, | 5828 | DEFVAR_LISP ("comp-subr-list", Vcomp_subr_list, |
| 5840 | doc: /* List of all defined subrs. */); | 5829 | doc: /* List of all defined subrs. */); |
| 5841 | DEFVAR_LISP ("comp-abi-hash", Vcomp_abi_hash, | 5830 | DEFVAR_LISP ("comp-abi-hash", Vcomp_abi_hash, |
| 5842 | doc: /* String signing the .eln files ABI. */); | 5831 | doc: /* String signing the .eln files ABI. */); |
| 5843 | Vcomp_abi_hash = Qnil; | 5832 | Vcomp_abi_hash = Qnil; |
| 5844 | DEFVAR_LISP ("comp-native-version-dir", Vcomp_native_version_dir, | 5833 | DEFVAR_LISP ("comp-native-version-dir", Vcomp_native_version_dir, |
| 5845 | doc: /* Directory in use to disambiguate eln compatibility. */); | 5834 | doc: /* Directory in use to disambiguate eln compatibility. */); |
| 5846 | Vcomp_native_version_dir = Qnil; | 5835 | Vcomp_native_version_dir = Qnil; |
| 5847 | 5836 | ||
| 5848 | DEFVAR_LISP ("comp-deferred-pending-h", Vcomp_deferred_pending_h, | 5837 | DEFVAR_LISP ("comp-deferred-pending-h", Vcomp_deferred_pending_h, |
| 5849 | doc: /* Hash table symbol-name -> function-value. | 5838 | doc: /* Hash table symbol-name -> function-value. |
| 5850 | For internal use. */); | 5839 | For internal use. */); |
| 5851 | Vcomp_deferred_pending_h = CALLN (Fmake_hash_table, QCtest, Qeq); | 5840 | Vcomp_deferred_pending_h = CALLN (Fmake_hash_table, QCtest, Qeq); |
| 5852 | 5841 | ||
| 5853 | DEFVAR_LISP ("comp-eln-to-el-h", Vcomp_eln_to_el_h, | 5842 | DEFVAR_LISP ("comp-eln-to-el-h", Vcomp_eln_to_el_h, |
| 5854 | doc: /* Hash table eln-filename -> el-filename. */); | 5843 | doc: /* Hash table eln-filename -> el-filename. */); |
| 5855 | Vcomp_eln_to_el_h = CALLN (Fmake_hash_table, QCtest, Qequal); | 5844 | Vcomp_eln_to_el_h = CALLN (Fmake_hash_table, QCtest, Qequal); |
| 5856 | 5845 | ||
| 5857 | DEFVAR_LISP ("native-comp-eln-load-path", Vnative_comp_eln_load_path, | 5846 | DEFVAR_LISP ("native-comp-eln-load-path", Vnative_comp_eln_load_path, |
| 5858 | doc: /* List of eln cache directories. | 5847 | doc: /* List of directories to look for natively-compiled *.eln files. |
| 5859 | 5848 | ||
| 5860 | If a directory is non absolute it is assumed to be relative to | 5849 | The *.eln files are actually looked for in a version-specific |
| 5861 | `invocation-directory'. | 5850 | subdirectory of each directory in this list. That subdirectory |
| 5862 | `comp-native-version-dir' value is used as a sub-folder name inside | 5851 | is determined by the value of `comp-native-version-dir'. |
| 5863 | each eln cache directory. | 5852 | If the name of a directory in this list is not absolute, it is |
| 5864 | The last directory of this list is assumed to be the system one. */); | 5853 | assumed to be relative to `invocation-directory'. |
| 5854 | The last directory of this list is assumed to be the one holding | ||
| 5855 | the system *.eln files, which are the files produced when building | ||
| 5856 | Emacs. */); | ||
| 5865 | 5857 | ||
| 5866 | /* Temporary value in use for bootstrap. We can't do better as | 5858 | /* Temporary value in use for bootstrap. We can't do better as |
| 5867 | `invocation-directory' is still unset, will be fixed up during | 5859 | `invocation-directory' is still unset, will be fixed up during |
| 5868 | dump reload. */ | 5860 | dump reload. */ |
| 5869 | Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil); | 5861 | Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil); |
| 5870 | 5862 | ||
| 5871 | DEFVAR_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines, | 5863 | DEFVAR_LISP ("native-comp-enable-subr-trampolines", |
| 5872 | doc: /* If non-nil, enable primitive trampoline synthesis. | 5864 | Vnative_comp_enable_subr_trampolines, |
| 5873 | This makes Emacs respect redefinition or advises of primitive functions | 5865 | doc: /* If non-nil, enable generation of trampolines for calling primitives. |
| 5874 | when they are called from Lisp code natively-compiled at `native-comp-speed' | 5866 | Trampolines are needed so that Emacs respects redefinition or advice of |
| 5875 | of 2. | 5867 | primitive functions when they are called from Lisp code natively-compiled |
| 5868 | at `native-comp-speed' of 2. | ||
| 5876 | 5869 | ||
| 5877 | By default, this is enabled, and when Emacs sees a redefined or advised | 5870 | By default, the value is t, and when Emacs sees a redefined or advised |
| 5878 | primitive called from natively-compiled Lisp, it generates a trampoline | 5871 | primitive called from natively-compiled Lisp, it generates a trampoline |
| 5879 | for it on-the-fly. | 5872 | for it on-the-fly. |
| 5880 | 5873 | ||
| 5881 | Disabling this, when a trampoline for a redefined or advised primitive is | 5874 | If the value is a file name (a string), it specifies the directory in |
| 5882 | not available from previous compilations, means that such redefinition | 5875 | which to deposit the generated trampolines, overriding the directories |
| 5883 | or advise will not have effect on calls from natively-compiled Lisp code. | 5876 | in `native-comp-eln-load-path'. |
| 5884 | That is, calls to primitives without existing trampolines from | 5877 | |
| 5885 | natively-compiled Lisp will behave as if the primitive was called | 5878 | When this variable is nil, generation of trampolines is disabled. |
| 5886 | directly from C. */); | 5879 | |
| 5880 | Disabling the generation of trampolines, when a trampoline for a redefined | ||
| 5881 | or advised primitive is not already available from previous compilations, | ||
| 5882 | means that such redefinition or advice will not have effect when calling | ||
| 5883 | primitives from natively-compiled Lisp code. That is, calls to primitives | ||
| 5884 | without existing trampolines from natively-compiled Lisp will behave as if | ||
| 5885 | the primitive was called directly from C, and will ignore its redefinition | ||
| 5886 | and advice. */); | ||
| 5887 | 5887 | ||
| 5888 | DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h, | 5888 | DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h, |
| 5889 | doc: /* Hash table subr-name -> installed trampoline. | 5889 | doc: /* Hash table subr-name -> installed trampoline. |
| 5890 | This is used to prevent double trampoline instantiation but also to | 5890 | This is used to prevent double trampoline instantiation, and also to |
| 5891 | protect the trampolines against GC. */); | 5891 | protect the trampolines against GC. */); |
| 5892 | Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table); | 5892 | Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table); |
| 5893 | 5893 | ||
| 5894 | DEFVAR_LISP ("comp-no-native-file-h", V_comp_no_native_file_h, | 5894 | DEFVAR_LISP ("comp-no-native-file-h", V_comp_no_native_file_h, |
| 5895 | doc: /* Files for which no deferred compilation has to be performed. | 5895 | doc: /* Files for which no deferred compilation should be performed. |
| 5896 | These files' compilation should not be deferred because the bytecode | 5896 | These files' compilation should not be deferred because the bytecode |
| 5897 | version was explicitly requested by the user during load. | 5897 | version was explicitly requested by the user during load. |
| 5898 | For internal use. */); | 5898 | For internal use. */); |
| 5899 | V_comp_no_native_file_h = CALLN (Fmake_hash_table, QCtest, Qequal); | 5899 | V_comp_no_native_file_h = CALLN (Fmake_hash_table, QCtest, Qequal); |
| 5900 | 5900 | ||
| 5901 | DEFVAR_BOOL ("comp-file-preloaded-p", comp_file_preloaded_p, | 5901 | DEFVAR_BOOL ("comp-file-preloaded-p", comp_file_preloaded_p, |
| 5902 | doc: /* When non-nil assume the file being compiled to | 5902 | doc: /* When non-nil, assume the file being compiled to be preloaded. */); |
| 5903 | be preloaded. */); | ||
| 5904 | 5903 | ||
| 5905 | DEFVAR_LISP ("comp-loaded-comp-units-h", Vcomp_loaded_comp_units_h, | 5904 | DEFVAR_LISP ("comp-loaded-comp-units-h", Vcomp_loaded_comp_units_h, |
| 5906 | doc: /* Hash table recording all loaded compilation units. | 5905 | doc: /* Hash table recording all loaded compilation units, file -> CU. */); |
| 5907 | file -> CU. */); | ||
| 5908 | Vcomp_loaded_comp_units_h = | 5906 | Vcomp_loaded_comp_units_h = |
| 5909 | CALLN (Fmake_hash_table, QCweakness, Qvalue, QCtest, Qequal); | 5907 | CALLN (Fmake_hash_table, QCweakness, Qvalue, QCtest, Qequal); |
| 5910 | 5908 | ||