emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c4faf78: Move union emacs_align_type to alloc.c


From: Paul Eggert
Subject: master c4faf78: Move union emacs_align_type to alloc.c
Date: Tue, 26 May 2020 02:28:09 -0400 (EDT)

branch: master
commit c4faf78a985aa8a147b4a5f7530ea43d0ad55835
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 src/alloc.c | 40 ++++++++++++++++++++++++++++++++++++++++
 src/lisp.h  | 42 +-----------------------------------------
 2 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index 77d5d28..f860939 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/>.  */
 #include "w32heap.h"   /* for sbrk */
 #endif
 
+/* A type with alignment at least as large as any object that Emacs
+   allocates.  This is not max_align_t because some platforms (e.g.,
+   mingw) have buggy malloc implementations that do not align for
+   max_align_t.  This union contains types of all GCALIGNED_STRUCT
+   components visible here.  */
+union emacs_align_type
+{
+  struct frame frame;
+  struct Lisp_Bignum Lisp_Bignum;
+  struct Lisp_Bool_Vector Lisp_Bool_Vector;
+  struct Lisp_Char_Table Lisp_Char_Table;
+  struct Lisp_CondVar Lisp_CondVar;
+  struct Lisp_Finalizer Lisp_Finalizer;
+  struct Lisp_Float Lisp_Float;
+  struct Lisp_Hash_Table Lisp_Hash_Table;
+  struct Lisp_Marker Lisp_Marker;
+  struct Lisp_Misc_Ptr Lisp_Misc_Ptr;
+  struct Lisp_Mutex Lisp_Mutex;
+  struct Lisp_Overlay Lisp_Overlay;
+  struct Lisp_Sub_Char_Table Lisp_Sub_Char_Table;
+  struct Lisp_Subr Lisp_Subr;
+  struct Lisp_User_Ptr Lisp_User_Ptr;
+  struct Lisp_Vector Lisp_Vector;
+  struct terminal terminal;
+  struct thread_state thread_state;
+  struct window window;
+
+  /* Omit the following since they would require including process.h
+     etc.  In practice their alignments never exceed that of the
+     structs already listed.  */
+#if 0
+  struct Lisp_Module_Function Lisp_Module_Function;
+  struct Lisp_Process Lisp_Process;
+  struct save_window_data save_window_data;
+  struct scroll_bar scroll_bar;
+  struct xwidget_view xwidget_view;
+  struct xwidget xwidget;
+#endif
+};
+
 /* MALLOC_SIZE_NEAR (N) is a good number to pass to malloc when
    allocating a block of memory with size close to N bytes.
    For best results N should be a power of 2.
diff --git a/src/lisp.h b/src/lisp.h
index 937052f..8bd83a8 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -278,7 +278,7 @@ error !;
    and does not contain a GC-aligned struct or union, putting
    GCALIGNED_STRUCT after its closing '}' can help the compiler
    generate better code.  Also, such structs should be added to the
-   emacs_align_type union.
+   emacs_align_type union in alloc.c.
 
    Although these macros are reasonably portable, they are not
    guaranteed on non-GCC platforms, as C11 does not require support
@@ -5060,46 +5060,6 @@ maybe_gc (void)
     maybe_garbage_collect ();
 }
 
-/* A type with alignment at least as large as any object that Emacs
-   allocates.  This is not max_align_t because some platforms (e.g.,
-   mingw) have buggy malloc implementations that do not align for
-   max_align_t.  This union contains types of all GCALIGNED_STRUCT
-   components visible here.  */
-union emacs_align_type
-{
-  struct Lisp_Bool_Vector Lisp_Bool_Vector;
-  struct Lisp_Char_Table Lisp_Char_Table;
-  struct Lisp_CondVar Lisp_CondVar;
-  struct Lisp_Finalizer Lisp_Finalizer;
-  struct Lisp_Float Lisp_Float;
-  struct Lisp_Hash_Table Lisp_Hash_Table;
-  struct Lisp_Marker Lisp_Marker;
-  struct Lisp_Misc_Ptr Lisp_Misc_Ptr;
-  struct Lisp_Mutex Lisp_Mutex;
-  struct Lisp_Overlay Lisp_Overlay;
-  struct Lisp_Sub_Char_Table Lisp_Sub_Char_Table;
-  struct Lisp_Subr Lisp_Subr;
-  struct Lisp_User_Ptr Lisp_User_Ptr;
-  struct Lisp_Vector Lisp_Vector;
-  struct thread_state thread_state;
-
-  /* Omit the following since they would require including bignum.h,
-     frame.h etc., and in practice their alignments never exceed that
-     of the structs already listed.  */
-#if 0
-  struct frame frame;
-  struct Lisp_Bignum Lisp_Bignum;
-  struct Lisp_Module_Function Lisp_Module_Function;
-  struct Lisp_Process Lisp_Process;
-  struct save_window_data save_window_data;
-  struct scroll_bar scroll_bar;
-  struct terminal terminal;
-  struct window window;
-  struct xwidget xwidget;
-  struct xwidget_view xwidget_view;
-#endif
-};
-
 INLINE_HEADER_END
 
 #endif /* EMACS_LISP_H */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]