root/src/comp.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. NATIVE_COMP_UNITP
  2. XNATIVE_COMP_UNIT
  3. maybe_defer_native_compilation
  4. unload_comp_unit

     1 /* Elisp native compiler definitions
     2 
     3 Copyright (C) 2019-2023 Free Software Foundation, Inc.
     4 
     5 This file is part of GNU Emacs.
     6 
     7 GNU Emacs is free software: you can redistribute it and/or modify
     8 it under the terms of the GNU General Public License as published by
     9 the Free Software Foundation, either version 3 of the License, or
    10 (at your option) any later version.
    11 
    12 GNU Emacs is distributed in the hope that it will be useful,
    13 but WITHOUT ANY WARRANTY; without even the implied warranty of
    14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15 GNU General Public License for more details.
    16 
    17 You should have received a copy of the GNU General Public License
    18 along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
    19 
    20 #ifndef COMP_H
    21 #define COMP_H
    22 
    23 #include <dynlib.h>
    24 
    25 struct Lisp_Native_Comp_Unit
    26 {
    27   union vectorlike_header header;
    28   /* The original eln file loaded.  In the pdumper file this is stored
    29      as a cons cell of 2 alternative file names: the car is the
    30      filename relative to the directory of an installed binary, the
    31      cdr is the filename relative to the directory of an uninstalled
    32      binary.  This is arranged in loadup.el.  */
    33   Lisp_Object file;
    34   Lisp_Object optimize_qualities;
    35   /* Guard anonymous lambdas against Garbage Collection and serve
    36      sanity checks.  */
    37   Lisp_Object lambda_gc_guard_h;
    38   /* Hash c_name -> d_reloc_imp index.  */
    39   Lisp_Object lambda_c_name_idx_h;
    40   /* Hash doc-idx -> function documentation.  */
    41   Lisp_Object data_fdoc_v;
    42   /* Analogous to the constant vector but per compilation unit.  */
    43   Lisp_Object data_vec;
    44   /* 'data_impure_vec' must be last (see allocate_native_comp_unit).
    45      Same as data_vec but for data that cannot be moved to pure space.  */
    46   Lisp_Object data_impure_vec;
    47   /* STUFFS WE DO NOT DUMP!!  */
    48   Lisp_Object *data_imp_relocs;
    49   bool loaded_once;
    50   bool load_ongoing;
    51   dynlib_handle_ptr handle;
    52 } GCALIGNED_STRUCT;
    53 
    54 #ifdef HAVE_NATIVE_COMP
    55 
    56 INLINE_HEADER_BEGIN
    57 
    58 INLINE bool
    59 NATIVE_COMP_UNITP (Lisp_Object a)
    60 {
    61   return PSEUDOVECTORP (a, PVEC_NATIVE_COMP_UNIT);
    62 }
    63 
    64 INLINE struct Lisp_Native_Comp_Unit *
    65 XNATIVE_COMP_UNIT (Lisp_Object a)
    66 {
    67   eassert (NATIVE_COMP_UNITP (a));
    68   return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Native_Comp_Unit);
    69 }
    70 
    71 /* Defined in comp.c.  */
    72 
    73 extern void hash_native_abi (void);
    74 
    75 extern Lisp_Object load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u,
    76                                    bool loading_dump, bool late_load);
    77 
    78 extern void unload_comp_unit (struct Lisp_Native_Comp_Unit *);
    79 
    80 extern Lisp_Object native_function_doc (Lisp_Object function);
    81 
    82 extern void syms_of_comp (void);
    83 
    84 extern void maybe_defer_native_compilation (Lisp_Object function_name,
    85                                             Lisp_Object definition);
    86 
    87 extern void eln_load_path_final_clean_up (void);
    88 
    89 extern void fixup_eln_load_path (Lisp_Object directory);
    90 
    91 #else /* #ifdef HAVE_NATIVE_COMP */
    92 
    93 static inline void
    94 maybe_defer_native_compilation (Lisp_Object function_name,
    95                                 Lisp_Object definition)
    96 {}
    97 
    98 static inline
    99 void unload_comp_unit (struct Lisp_Native_Comp_Unit *cu)
   100 {}
   101 
   102 extern void syms_of_comp (void);
   103 
   104 INLINE_HEADER_END
   105 
   106 #endif /* #ifdef HAVE_NATIVE_COMP */
   107 
   108 #endif /* #ifndef COMP_H */

/* [<][>][^][v][top][bottom][index][help] */