]> git.eshelyaron.com Git - emacs.git/commitdiff
More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS.
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 18 Sep 2014 11:34:24 +0000 (15:34 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Thu, 18 Sep 2014 11:34:24 +0000 (15:34 +0400)
* lisp.h (local_list4) [USE_LOCAL_ALLOCATORS]: New macro.
[!USE_LOCAL_ALLOCATORS]: Fall back to regular list4.
* frame.h (FRAME_PARAMETER): New macro.
* dispnew.c (init_display):
* fontset.c (Fset_fontset_font):
* frame.c (x_default_parameter):
* xfaces.c (set_font_frame_param, Finternal_merge_in_global_face):
* xfns.c (x_default_scroll_bar_color_parameter)
(x_default_font_parameter, x_create_tip_frame): Use it.
* editfns.c (Fpropertize): Use local_cons.
* process.c (status_message): Use build_local_string.
* xfont.c (xfont_open): Use make_local_string.
* xdisp.c (build_desired_tool_bar_string): Use local_list4.

12 files changed:
src/ChangeLog
src/dispnew.c
src/editfns.c
src/fontset.c
src/frame.c
src/frame.h
src/lisp.h
src/process.c
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xfont.c

index 010f5fd95dd67fd868588ab72708ef541d1560a4..0e676e2c73c2ae0fce48501388115ff961e30579 100644 (file)
@@ -1,3 +1,20 @@
+2014-09-18  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS.
+       * lisp.h (local_list4) [USE_LOCAL_ALLOCATORS]: New macro.
+       [!USE_LOCAL_ALLOCATORS]: Fall back to regular list4.
+       * frame.h (FRAME_PARAMETER): New macro.
+       * dispnew.c (init_display):
+       * fontset.c (Fset_fontset_font):
+       * frame.c (x_default_parameter):
+       * xfaces.c (set_font_frame_param, Finternal_merge_in_global_face):
+       * xfns.c (x_default_scroll_bar_color_parameter)
+       (x_default_font_parameter, x_create_tip_frame): Use it.
+       * editfns.c (Fpropertize): Use local_cons.
+       * process.c (status_message): Use build_local_string.
+       * xfont.c (xfont_open): Use make_local_string.
+       * xdisp.c (build_desired_tool_bar_string): Use local_list4.
+
 2014-09-18  Paul Eggert  <eggert@cs.ucla.edu>
 
        Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64.
index bc5164f3ba86b27855149603c784ee688120b140..078c1ea21646492cdadbfbdccba5ce5c29961420 100644 (file)
@@ -6098,14 +6098,14 @@ init_display (void)
 
     /* Update frame parameters to reflect the new type. */
     Fmodify_frame_parameters
-      (selected_frame, list1 (Fcons (Qtty_type,
-                                     Ftty_type (selected_frame))));
+      (selected_frame, FRAME_PARAMETER (Qtty_type,
+                                       Ftty_type (selected_frame)));
     if (t->display_info.tty->name)
       Fmodify_frame_parameters
        (selected_frame,
-        list1 (Fcons (Qtty, build_string (t->display_info.tty->name))));
+        FRAME_PARAMETER (Qtty, build_string (t->display_info.tty->name)));
     else
-      Fmodify_frame_parameters (selected_frame, list1 (Fcons (Qtty, Qnil)));
+      Fmodify_frame_parameters (selected_frame, FRAME_PARAMETER (Qtty, Qnil));
   }
 
   {
index 47779914c4582a5e42eb33eb8e22be64d44ea50d..37fc169ace187297c06cf8292800488431362820 100644 (file)
@@ -3547,7 +3547,7 @@ usage: (propertize STRING &rest PROPERTIES)  */)
   string = Fcopy_sequence (args[0]);
 
   for (i = 1; i < nargs; i += 2)
-    properties = Fcons (args[i], Fcons (args[i + 1], properties));
+    properties = local_cons (args[i], local_cons (args[i + 1], properties));
 
   Fadd_text_properties (make_number (0),
                        make_number (SCHARS (string)),
index a36ae4aa5e327d03a2ea696668bc46408d5c8864..5e18d14bd65c7ef457f34801978be4a5199f2503 100644 (file)
@@ -1598,7 +1598,7 @@ appended.  By default, FONT-SPEC overrides the previous settings.  */)
          if (! NILP (font_object))
            {
              update_auto_fontset_alist (font_object, fontset);
-             alist = list1 (Fcons (Qfont, Fcons (name, font_object)));
+             alist = FRAME_PARAMETER (Qfont, Fcons (name, font_object));
              Fmodify_frame_parameters (fr, alist);
            }
        }
index cba69373c41cf03f7093334954bd320b9e3d63f3..67993a627e7e5f88d2c87839465e1c181af8473b 100644 (file)
@@ -4274,7 +4274,7 @@ x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop,
   tem = x_frame_get_arg (f, alist, prop, xprop, xclass, type);
   if (EQ (tem, Qunbound))
     tem = deflt;
-  x_set_frame_parameters (f, list1 (Fcons (prop, tem)));
+  x_set_frame_parameters (f, FRAME_PARAMETER (prop, tem));
   return tem;
 }
 
index 947ba6dccd98a182ecfd6e9a9e51233d27ef4619..0ba3e3712f64a62ddafa1fab5b81d952818c753f 100644 (file)
@@ -1060,6 +1060,11 @@ default_pixels_per_inch_y (void)
       }                                                                \
   } while (false)
 
+/* Handy macro to construct an argument to Fmodify_frame_parameters.  */
+
+#define FRAME_PARAMETER(parameter, value)      \
+  local_list1 (scoped_cons (parameter, value))
+
 /* False means there are no visible garbaged frames.  */
 extern bool frame_garbaged;
 
index c5e698cc7c7f6706525407b0241ff9c0c924ec8a..b8e75f90ef54f9321b34fef75e657749b2213b04 100644 (file)
@@ -4623,6 +4623,7 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons));
 # define local_list1(x) local_cons (x, Qnil)
 # define local_list2(x, y) local_cons (x, local_list1 (y))
 # define local_list3(x, y, z) local_cons (x, local_list2 (y, z))
+# define local_list4(x, y, z, t) local_cons (x, local_list3 (y, z, t))
 
 /* Return a function-scoped vector of length SIZE, with each element
    being INIT.  */
@@ -4673,6 +4674,7 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons));
 # define local_list1(x) list1 (x)
 # define local_list2(x, y) list2 (x, y)
 # define local_list3(x, y, z) list3 (x, y, z)
+# define local_list4(x, y, z, t) list4 (x, y, z, t)
 # define make_local_vector(size, init) Fmake_vector (make_number (size), init)
 # define make_local_string(data, nbytes) make_string (data, nbytes)
 # define build_local_string(data) build_string (data)
index 864aba496eb42192cf0e8a610dd29118e73f0d35..0807939dd25dbf8ec291c7cf3d3b210958831533 100644 (file)
@@ -638,7 +638,7 @@ status_message (struct Lisp_Process *p)
     {
       string = Fnumber_to_string (make_number (code));
       string2 = build_local_string ("\n");
-      return concat3 (build_string ("failed with code "),
+      return concat3 (build_local_string ("failed with code "),
                      string, string2);
     }
   else
index 3a895164fe251f0ed84e10a7df1ee4276041c5b7..a35cac35e6025a5357c1816cd69051df0234a429 100644 (file)
@@ -12061,7 +12061,7 @@ build_desired_tool_bar_string (struct frame *f)
       (f, Fmake_string (make_number (size_needed), make_number (' ')));
   else
     {
-      props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
+      props = local_list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
       Fremove_text_properties (make_number (0), make_number (size),
                               props, f->desired_tool_bar_string);
     }
@@ -12174,8 +12174,8 @@ build_desired_tool_bar_string (struct frame *f)
         the start of this item's properties in the tool-bar items
         vector.  */
       image = Fcons (Qimage, plist);
-      props = list4 (Qdisplay, image,
-                    Qmenu_item, make_number (i * TOOL_BAR_ITEM_NSLOTS));
+      props = local_list4 (Qdisplay, image, Qmenu_item,
+                          make_number (i * TOOL_BAR_ITEM_NSLOTS));
 
       /* Let the last image hide all remaining spaces in the tool bar
          string.  The string can be longer than needed when we reuse a
index a0998d7cbbc9bf6e662d92ef5383f1ae711b99ba..f788c304bd8d9a9b7cc304d03a6e507483fa7c41 100644 (file)
@@ -3398,7 +3398,7 @@ set_font_frame_param (Lisp_Object frame, Lisp_Object lface)
          ASET (lface, LFACE_FONT_INDEX, font);
        }
       f->default_face_done_p = 0;
-      Fmodify_frame_parameters (frame, list1 (Fcons (Qfont, font)));
+      Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qfont, font));
     }
 }
 
@@ -3787,18 +3787,18 @@ Default face attributes override any local face attributes.  */)
              && newface->font)
            {
              Lisp_Object name = newface->font->props[FONT_NAME_INDEX];
-             Fmodify_frame_parameters (frame, list1 (Fcons (Qfont, name)));
+             Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qfont, name));
            }
 
          if (STRINGP (gvec[LFACE_FOREGROUND_INDEX]))
-           Fmodify_frame_parameters (frame,
-                                     list1 (Fcons (Qforeground_color,
-                                                   gvec[LFACE_FOREGROUND_INDEX])));
+           Fmodify_frame_parameters
+             (frame, FRAME_PARAMETER (Qforeground_color,
+                                      gvec[LFACE_FOREGROUND_INDEX]));
 
          if (STRINGP (gvec[LFACE_BACKGROUND_INDEX]))
-           Fmodify_frame_parameters (frame,
-                                     list1 (Fcons (Qbackground_color,
-                                                   gvec[LFACE_BACKGROUND_INDEX])));
+           Fmodify_frame_parameters
+             (frame, FRAME_PARAMETER (Qbackground_color,
+                                      gvec[LFACE_BACKGROUND_INDEX]));
        }
     }
 
index 683adb2b2103f7640a0669b23b9d6ed40dd72b46..b107f6e688c5921a9f0eb72dd84943743972e42d 100644 (file)
@@ -1595,7 +1595,7 @@ x_default_scroll_bar_color_parameter (struct frame *f,
 #endif /* not USE_TOOLKIT_SCROLL_BARS */
     }
 
-  x_set_frame_parameters (f, list1 (Fcons (prop, tem)));
+  x_set_frame_parameters (f, FRAME_PARAMETER (prop, tem));
   return tem;
 }
 
@@ -2846,7 +2846,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms)
     {
       /* Remember the explicit font parameter, so we can re-apply it after
         we've applied the `default' face settings.  */
-      x_set_frame_parameters (f, list1 (Fcons (Qfont_param, font_param)));
+      x_set_frame_parameters (f, FRAME_PARAMETER (Qfont_param, font_param));
     }
 
   /* This call will make X resources override any system font setting.  */
@@ -5036,7 +5036,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
 
   /* Add `tooltip' frame parameter's default value. */
   if (NILP (Fframe_parameter (frame, Qtooltip)))
-    Fmodify_frame_parameters (frame, list1 (Fcons (Qtooltip, Qt)));
+    Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qtooltip, Qt));
 
   /* FIXME - can this be done in a similar way to normal frames?
      http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00641.html */
@@ -5054,7 +5054,8 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
       disptype = intern ("color");
 
     if (NILP (Fframe_parameter (frame, Qdisplay_type)))
-      Fmodify_frame_parameters (frame, list1 (Fcons (Qdisplay_type, disptype)));
+      Fmodify_frame_parameters
+       (frame, FRAME_PARAMETER (Qdisplay_type, disptype));
   }
 
   /* Set up faces after all frame parameters are known.  This call
@@ -5073,7 +5074,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
     call2 (Qface_set_after_frame_default, frame, Qnil);
 
     if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
-      Fmodify_frame_parameters (frame, list1 (Fcons (Qbackground_color, bg)));
+      Fmodify_frame_parameters (frame, FRAME_PARAMETER (Qbackground_color, bg));
   }
 
   f->no_split = 1;
index c39c8455aa506116dca1a6b520aa5b98bad34a4d..90b69ad5187998c6d3e3ad567b513a34762e2e19 100644 (file)
@@ -775,7 +775,7 @@ xfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
       if (dashes >= 13)
        {
          len = xfont_decode_coding_xlfd (p0, -1, name);
-         fullname = Fdowncase (make_string (name, len));
+         fullname = Fdowncase (make_local_string (name, len));
        }
       XFree (p0);
     }