diff options
| author | Paul Eggert | 2020-05-25 23:24:47 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-05-25 23:28:04 -0700 |
| commit | c4faf78a985aa8a147b4a5f7530ea43d0ad55835 (patch) | |
| tree | d5137851674fedd2b36068abd84f404645b870b9 | |
| parent | 92278640babbfe1383ebba3baf3bc10278a01050 (diff) | |
| download | emacs-c4faf78a985aa8a147b4a5f7530ea43d0ad55835.tar.gz emacs-c4faf78a985aa8a147b4a5f7530ea43d0ad55835.zip | |
Move union emacs_align_type to alloc.c
* src/alloc.c (union emacs_align_type): Move to here ...
* src/lisp.h: ... from here, and uncomment out some of the
types that alloc.c can see but lisp.h cannot.
| -rw-r--r-- | src/alloc.c | 40 | ||||
| -rw-r--r-- | src/lisp.h | 42 |
2 files changed, 41 insertions, 41 deletions
diff --git a/src/alloc.c b/src/alloc.c index 77d5d2839a2..f8609398a3f 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -104,6 +104,46 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 104 | #include "w32heap.h" /* for sbrk */ | 104 | #include "w32heap.h" /* for sbrk */ |
| 105 | #endif | 105 | #endif |
| 106 | 106 | ||
| 107 | /* A type with alignment at least as large as any object that Emacs | ||
| 108 | allocates. This is not max_align_t because some platforms (e.g., | ||
| 109 | mingw) have buggy malloc implementations that do not align for | ||
| 110 | max_align_t. This union contains types of all GCALIGNED_STRUCT | ||
| 111 | components visible here. */ | ||
| 112 | union emacs_align_type | ||
| 113 | { | ||
| 114 | struct frame frame; | ||
| 115 | struct Lisp_Bignum Lisp_Bignum; | ||
| 116 | struct Lisp_Bool_Vector Lisp_Bool_Vector; | ||
| 117 | struct Lisp_Char_Table Lisp_Char_Table; | ||
| 118 | struct Lisp_CondVar Lisp_CondVar; | ||
| 119 | struct Lisp_Finalizer Lisp_Finalizer; | ||
| 120 | struct Lisp_Float Lisp_Float; | ||
| 121 | struct Lisp_Hash_Table Lisp_Hash_Table; | ||
| 122 | struct Lisp_Marker Lisp_Marker; | ||
| 123 | struct Lisp_Misc_Ptr Lisp_Misc_Ptr; | ||
| 124 | struct Lisp_Mutex Lisp_Mutex; | ||
| 125 | struct Lisp_Overlay Lisp_Overlay; | ||
| 126 | struct Lisp_Sub_Char_Table Lisp_Sub_Char_Table; | ||
| 127 | struct Lisp_Subr Lisp_Subr; | ||
| 128 | struct Lisp_User_Ptr Lisp_User_Ptr; | ||
| 129 | struct Lisp_Vector Lisp_Vector; | ||
| 130 | struct terminal terminal; | ||
| 131 | struct thread_state thread_state; | ||
| 132 | struct window window; | ||
| 133 | |||
| 134 | /* Omit the following since they would require including process.h | ||
| 135 | etc. In practice their alignments never exceed that of the | ||
| 136 | structs already listed. */ | ||
| 137 | #if 0 | ||
| 138 | struct Lisp_Module_Function Lisp_Module_Function; | ||
| 139 | struct Lisp_Process Lisp_Process; | ||
| 140 | struct save_window_data save_window_data; | ||
| 141 | struct scroll_bar scroll_bar; | ||
| 142 | struct xwidget_view xwidget_view; | ||
| 143 | struct xwidget xwidget; | ||
| 144 | #endif | ||
| 145 | }; | ||
| 146 | |||
| 107 | /* MALLOC_SIZE_NEAR (N) is a good number to pass to malloc when | 147 | /* MALLOC_SIZE_NEAR (N) is a good number to pass to malloc when |
| 108 | allocating a block of memory with size close to N bytes. | 148 | allocating a block of memory with size close to N bytes. |
| 109 | For best results N should be a power of 2. | 149 | For best results N should be a power of 2. |
diff --git a/src/lisp.h b/src/lisp.h index 937052f6df8..8bd83a888ce 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -278,7 +278,7 @@ error !; | |||
| 278 | and does not contain a GC-aligned struct or union, putting | 278 | and does not contain a GC-aligned struct or union, putting |
| 279 | GCALIGNED_STRUCT after its closing '}' can help the compiler | 279 | GCALIGNED_STRUCT after its closing '}' can help the compiler |
| 280 | generate better code. Also, such structs should be added to the | 280 | generate better code. Also, such structs should be added to the |
| 281 | emacs_align_type union. | 281 | emacs_align_type union in alloc.c. |
| 282 | 282 | ||
| 283 | Although these macros are reasonably portable, they are not | 283 | Although these macros are reasonably portable, they are not |
| 284 | guaranteed on non-GCC platforms, as C11 does not require support | 284 | guaranteed on non-GCC platforms, as C11 does not require support |
| @@ -5060,46 +5060,6 @@ maybe_gc (void) | |||
| 5060 | maybe_garbage_collect (); | 5060 | maybe_garbage_collect (); |
| 5061 | } | 5061 | } |
| 5062 | 5062 | ||
| 5063 | /* A type with alignment at least as large as any object that Emacs | ||
| 5064 | allocates. This is not max_align_t because some platforms (e.g., | ||
| 5065 | mingw) have buggy malloc implementations that do not align for | ||
| 5066 | max_align_t. This union contains types of all GCALIGNED_STRUCT | ||
| 5067 | components visible here. */ | ||
| 5068 | union emacs_align_type | ||
| 5069 | { | ||
| 5070 | struct Lisp_Bool_Vector Lisp_Bool_Vector; | ||
| 5071 | struct Lisp_Char_Table Lisp_Char_Table; | ||
| 5072 | struct Lisp_CondVar Lisp_CondVar; | ||
| 5073 | struct Lisp_Finalizer Lisp_Finalizer; | ||
| 5074 | struct Lisp_Float Lisp_Float; | ||
| 5075 | struct Lisp_Hash_Table Lisp_Hash_Table; | ||
| 5076 | struct Lisp_Marker Lisp_Marker; | ||
| 5077 | struct Lisp_Misc_Ptr Lisp_Misc_Ptr; | ||
| 5078 | struct Lisp_Mutex Lisp_Mutex; | ||
| 5079 | struct Lisp_Overlay Lisp_Overlay; | ||
| 5080 | struct Lisp_Sub_Char_Table Lisp_Sub_Char_Table; | ||
| 5081 | struct Lisp_Subr Lisp_Subr; | ||
| 5082 | struct Lisp_User_Ptr Lisp_User_Ptr; | ||
| 5083 | struct Lisp_Vector Lisp_Vector; | ||
| 5084 | struct thread_state thread_state; | ||
| 5085 | |||
| 5086 | /* Omit the following since they would require including bignum.h, | ||
| 5087 | frame.h etc., and in practice their alignments never exceed that | ||
| 5088 | of the structs already listed. */ | ||
| 5089 | #if 0 | ||
| 5090 | struct frame frame; | ||
| 5091 | struct Lisp_Bignum Lisp_Bignum; | ||
| 5092 | struct Lisp_Module_Function Lisp_Module_Function; | ||
| 5093 | struct Lisp_Process Lisp_Process; | ||
| 5094 | struct save_window_data save_window_data; | ||
| 5095 | struct scroll_bar scroll_bar; | ||
| 5096 | struct terminal terminal; | ||
| 5097 | struct window window; | ||
| 5098 | struct xwidget xwidget; | ||
| 5099 | struct xwidget_view xwidget_view; | ||
| 5100 | #endif | ||
| 5101 | }; | ||
| 5102 | |||
| 5103 | INLINE_HEADER_END | 5063 | INLINE_HEADER_END |
| 5104 | 5064 | ||
| 5105 | #endif /* EMACS_LISP_H */ | 5065 | #endif /* EMACS_LISP_H */ |