emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117945: Default to stack objects on DOS_NT platform


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r117945: Default to stack objects on DOS_NT platforms as well.
Date: Thu, 25 Sep 2014 09:35:53 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117945
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2014-09-25 12:34:53 +0300
message:
  Default to stack objects on DOS_NT platforms as well.
  
   src/w32term.h (ALIGN_STACK) [__GNUC__]: Define to
   __attribute__((force_align_arg_pointer)) for GCC 4.2 and later.
   src/lisp.h (USE_STACK_LISP_OBJECTS): Remove the !DOS_NT condition.
   src/w32proc.c (enum_locale_fn, enum_codepage_fn): Add the
   ALIGN_STACK attribute.
   src/w32fns.c (w32_monitor_enum): Add the ALIGN_STACK attribute.
   src/w32uniscribe.c (add_opentype_font_name_to_list): Add the
   ALIGN_STACK attribute.
   src/w32font.c (add_font_name_to_list, add_font_entity_to_list)
   (add_one_font_entity_to_list): Add the ALIGN_STACK attribute.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/w32font.c                  w32font.c-20091113204419-o5vbwnq5f7feedwu-8545
  src/w32proc.c                  w32proc.c-20091113204419-o5vbwnq5f7feedwu-814
  src/w32term.h                  w32term.h-20091113204419-o5vbwnq5f7feedwu-954
  src/w32uniscribe.c             
w32uniscribe.c-20091113204419-o5vbwnq5f7feedwu-8619
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-25 07:01:35 +0000
+++ b/src/ChangeLog     2014-09-25 09:34:53 +0000
@@ -1,3 +1,22 @@
+2014-09-25  Eli Zaretskii  <address@hidden>
+
+       Default to stack objects on DOS_NT platforms as well.
+       * w32term.h (ALIGN_STACK) [__GNUC__]: Define to
+       __attribute__((force_align_arg_pointer)) for GCC 4.2 and later.
+
+       * lisp.h (USE_STACK_LISP_OBJECTS): Remove the !DOS_NT condition.
+
+       * w32proc.c (enum_locale_fn, enum_codepage_fn): Add the
+       ALIGN_STACK attribute.
+
+       * w32fns.c (w32_monitor_enum): Add the ALIGN_STACK attribute.
+
+       * w32uniscribe.c (add_opentype_font_name_to_list): Add the
+       ALIGN_STACK attribute.
+
+       * w32font.c (add_font_name_to_list, add_font_entity_to_list)
+       (add_one_font_entity_to_list): Add the ALIGN_STACK attribute.
+
 2014-09-25  Martin Rudalics  <address@hidden>
 
        * frame.c (frame_inhibit_resize):

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-09-25 02:01:14 +0000
+++ b/src/lisp.h        2014-09-25 09:34:53 +0000
@@ -282,12 +282,10 @@
 # endif
 #endif
 
-/* This should work with GCC on non-DOS_NT.  Clang has known problems; see
-   http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00506.html.
-   Also http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00422.html
-   describes an issue with 32-bit MS-Windows.  */
+/* This should work with GCC.  Clang has known problems; see
+   http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00506.html.  */
 #ifndef USE_STACK_LISP_OBJECTS
-# if defined __GNUC__ && !defined __clang__ && !defined DOS_NT
+# if defined __GNUC__ && !defined __clang__
 #  define USE_STACK_LISP_OBJECTS true
 # else
 #  define USE_STACK_LISP_OBJECTS false

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-09-23 17:03:48 +0000
+++ b/src/w32fns.c      2014-09-25 09:34:53 +0000
@@ -5012,7 +5012,7 @@
   return Qnil;
 }
 
-static BOOL CALLBACK
+static BOOL CALLBACK ALIGN_STACK
 w32_monitor_enum (HMONITOR monitor, HDC hdc, RECT *rcMonitor, LPARAM dwData)
 {
   Lisp_Object *monitor_list = (Lisp_Object *) dwData;

=== modified file 'src/w32font.c'
--- a/src/w32font.c     2014-09-22 06:06:19 +0000
+++ b/src/w32font.c     2014-09-25 09:34:53 +0000
@@ -115,15 +115,15 @@
 static Lisp_Object w32_registry (LONG, DWORD);
 
 /* EnumFontFamiliesEx callbacks.  */
-static int CALLBACK add_font_entity_to_list (ENUMLOGFONTEX *,
-                                             NEWTEXTMETRICEX *,
-                                             DWORD, LPARAM);
-static int CALLBACK add_one_font_entity_to_list (ENUMLOGFONTEX *,
-                                                 NEWTEXTMETRICEX *,
-                                                 DWORD, LPARAM);
-static int CALLBACK add_font_name_to_list (ENUMLOGFONTEX *,
-                                           NEWTEXTMETRICEX *,
-                                           DWORD, LPARAM);
+static int CALLBACK ALIGN_STACK add_font_entity_to_list (ENUMLOGFONTEX *,
+                                                        NEWTEXTMETRICEX *,
+                                                        DWORD, LPARAM);
+static int CALLBACK ALIGN_STACK add_one_font_entity_to_list (ENUMLOGFONTEX *,
+                                                            NEWTEXTMETRICEX *,
+                                                            DWORD, LPARAM);
+static int CALLBACK ALIGN_STACK add_font_name_to_list (ENUMLOGFONTEX *,
+                                                      NEWTEXTMETRICEX *,
+                                                      DWORD, LPARAM);
 
 /* struct passed in as LPARAM arg to EnumFontFamiliesEx, for keeping track
    of what we really want.  */
@@ -1000,7 +1000,7 @@
 
 /* Callback function for EnumFontFamiliesEx.
  * Adds the name of a font to a Lisp list (passed in as the lParam arg).  */
-static int CALLBACK
+static int CALLBACK ALIGN_STACK
 add_font_name_to_list (ENUMLOGFONTEX *logical_font,
                       NEWTEXTMETRICEX *physical_font,
                       DWORD font_type, LPARAM list_object)
@@ -1446,7 +1446,7 @@
  * and if so, adds it to a list. Both the data we are checking against
  * and the list to which the fonts are added are passed in via the
  * lparam argument, in the form of a font_callback_data struct. */
-static int CALLBACK
+static int CALLBACK ALIGN_STACK
 add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
                         NEWTEXTMETRICEX *physical_font,
                         DWORD font_type, LPARAM lParam)
@@ -1565,7 +1565,7 @@
 
 /* Callback function for EnumFontFamiliesEx.
  * Terminates the search once we have a match. */
-static int CALLBACK
+static int CALLBACK ALIGN_STACK
 add_one_font_entity_to_list (ENUMLOGFONTEX *logical_font,
                             NEWTEXTMETRICEX *physical_font,
                             DWORD font_type, LPARAM lParam)

=== modified file 'src/w32proc.c'
--- a/src/w32proc.c     2014-09-23 17:03:48 +0000
+++ b/src/w32proc.c     2014-09-25 09:34:53 +0000
@@ -2909,7 +2909,7 @@
    function isn't given a context pointer.  */
 Lisp_Object Vw32_valid_locale_ids;
 
-static BOOL CALLBACK
+static BOOL CALLBACK ALIGN_STACK
 enum_locale_fn (LPTSTR localeNum)
 {
   DWORD id = int_from_hex (localeNum);
@@ -2973,7 +2973,7 @@
    function isn't given a context pointer.  */
 Lisp_Object Vw32_valid_codepages;
 
-static BOOL CALLBACK
+static BOOL CALLBACK ALIGN_STACK
 enum_codepage_fn (LPTSTR codepageNum)
 {
   DWORD id = atoi (codepageNum);

=== modified file 'src/w32term.h'
--- a/src/w32term.h     2014-07-27 13:21:30 +0000
+++ b/src/w32term.h     2014-09-25 09:34:53 +0000
@@ -22,6 +22,22 @@
 #include "frame.h"
 #include "atimer.h"
 
+/* Stack alignment stuff.  Every CALLBACK function should have the
+   ALIGN_STACK attribute if it manipulates Lisp objects, because
+   Windows x86 32-bit ABI only guarantees 4-byte stack alignment, and
+   that is what we will get when a Windows function calls us.  The
+   ALIGN_STACK attribute forces GCC to emit a preamble code to
+   re-align the stack at function entry.  Further details about this
+   can be found in http://www.peterstock.co.uk/games/mingw_sse/.  */
+#ifdef __GNUC__
+# if defined USE_STACK_LISP_OBJECTS && defined _W64    \
+  && __GNUC__ + (__GNUC_MINOR__ > 1) >= 5
+#  define ALIGN_STACK __attribute__((force_align_arg_pointer))
+# else
+#  define ALIGN_STACK
+# endif         /* USE_STACK_LISP_OBJECTS */
+#endif
+
 
 #define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0)
 #define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255)

=== modified file 'src/w32uniscribe.c'
--- a/src/w32uniscribe.c        2014-08-25 07:00:42 +0000
+++ b/src/w32uniscribe.c        2014-09-25 09:34:53 +0000
@@ -52,9 +52,9 @@
 extern Lisp_Object Qopentype;
 
 /* EnumFontFamiliesEx callback.  */
-static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *,
-                                                    NEWTEXTMETRICEX *,
-                                                    DWORD, LPARAM);
+static int CALLBACK ALIGN_STACK add_opentype_font_name_to_list (ENUMLOGFONTEX 
*,
+                                                               NEWTEXTMETRICEX 
*,
+                                                               DWORD, LPARAM);
 /* Used by uniscribe_otf_capability.  */
 static Lisp_Object otf_features (HDC context, char *table);
 
@@ -613,7 +613,7 @@
 /* Callback function for EnumFontFamiliesEx.
    Adds the name of opentype fonts to a Lisp list (passed in as the
    lParam arg). */
-static int CALLBACK
+static int CALLBACK ALIGN_STACK
 add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font,
                                NEWTEXTMETRICEX *physical_font,
                                DWORD font_type, LPARAM list_object)


reply via email to

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