[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117912: Minor improvements to new stack-allocated L
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r117912: Minor improvements to new stack-allocated Lisp objects. |
Date: |
Sun, 21 Sep 2014 22:49:29 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117912
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2014-09-21 15:49:24 -0700
message:
Minor improvements to new stack-allocated Lisp objects.
* frame.h (FRAME_PARAMETER):
Prefer scoped_list1 to local_list1 where either would do.
* lisp.h (scoped_list4): New macro.
(local_cons, local_list1, local_list2, local_list3, local_list4)
(make_local_vector, make_local_string, build_local_string):
Prefer functions to macros where either would do.
* xdisp.c (build_desired_tool_bar_string):
Prefer scoped_list4 to local_list4 where either would do.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/frame.h frame.h-20091113204419-o5vbwnq5f7feedwu-229
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
src/xdisp.c xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-09-18 11:34:24 +0000
+++ b/src/ChangeLog 2014-09-21 22:49:24 +0000
@@ -1,3 +1,15 @@
+2014-09-21 Paul Eggert <address@hidden>
+
+ Minor improvements to new stack-allocated Lisp objects.
+ * frame.h (FRAME_PARAMETER):
+ Prefer scoped_list1 to local_list1 where either would do.
+ * lisp.h (scoped_list4): New macro.
+ (local_cons, local_list1, local_list2, local_list3, local_list4)
+ (make_local_vector, make_local_string, build_local_string):
+ Prefer functions to macros where either would do.
+ * xdisp.c (build_desired_tool_bar_string):
+ Prefer scoped_list4 to local_list4 where either would do.
+
2014-09-18 Dmitry Antipov <address@hidden>
More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS.
=== modified file 'src/frame.h'
--- a/src/frame.h 2014-09-18 11:34:24 +0000
+++ b/src/frame.h 2014-09-21 22:49:24 +0000
@@ -1063,7 +1063,7 @@
/* Handy macro to construct an argument to Fmodify_frame_parameters. */
#define FRAME_PARAMETER(parameter, value) \
- local_list1 (scoped_cons (parameter, value))
+ scoped_list1 (scoped_cons (parameter, value))
/* False means there are no visible garbaged frames. */
extern bool frame_garbaged;
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2014-09-18 11:34:24 +0000
+++ b/src/lisp.h 2014-09-21 22:49:24 +0000
@@ -4590,13 +4590,15 @@
/* Convenient utility macros similar to listX functions. */
#if USE_STACK_LISP_OBJECTS
-# define scoped_list1(x) scoped_cons (x, Qnil)
-# define scoped_list2(x, y) scoped_cons (x, scoped_list1 (y))
-# define scoped_list3(x, y, z) scoped_cons (x, scoped_list2 (y, z))
+# define scoped_list1(a) scoped_cons (a, Qnil)
+# define scoped_list2(a, b) scoped_cons (a, scoped_list1 (b))
+# define scoped_list3(a, b, c) scoped_cons (a, scoped_list2 (b, c))
+# define scoped_list4(a, b, c, d) scoped_cons (a, scoped_list3 (b, c, d))
#else
-# define scoped_list1(x) list1 (x)
-# define scoped_list2(x, y) list2 (x, y)
-# define scoped_list3(x, y, z) list3 (x, y, z)
+# define scoped_list1(a) list1 (a)
+# define scoped_list2(a, b) list2 (a, b)
+# define scoped_list3(a, b, c) list3 (a, b, c)
+# define scoped_list4(a, b, c, d) list4 (a, b, c, d)
#endif
/* Local allocators require both statement expressions and a
@@ -4620,10 +4622,10 @@
make_lisp_ptr (c_, Lisp_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))
+# define local_list1(a) local_cons (a, Qnil)
+# define local_list2(a, b) local_cons (a, local_list1 (b))
+# define local_list3(a, b, c) local_cons (a, local_list2 (b, c))
+# define local_list4(a, b, c, d) local_cons (a, local_list3 (b, c, d))
/* Return a function-scoped vector of length SIZE, with each element
being INIT. */
@@ -4670,14 +4672,46 @@
#else
/* Safer but slower implementations. */
-# define local_cons(car, cdr) Fcons (car, cdr)
-# 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)
+INLINE Lisp_Object
+local_cons (Lisp_Object car, Lisp_Object cdr)
+{
+ return Fcons (car, cdr);
+}
+INLINE Lisp_Object
+local_list1 (Lisp_Object a)
+{
+ return list1 (a);
+}
+INLINE Lisp_Object
+local_list2 (Lisp_Object a, Lisp_Object b)
+{
+ return list2 (a, b);
+}
+INLINE Lisp_Object
+local_list3 (Lisp_Object a, Lisp_Object b, Lisp_Object c)
+{
+ return list3 (a, b, c);
+}
+INLINE Lisp_Object
+local_list4 (Lisp_Object a, Lisp_Object b, Lisp_Object c, Lisp_Object d)
+{
+ return list4 (a, b, c, d);
+}
+INLINE Lisp_Object
+make_local_vector (ptrdiff_t size, Lisp_Object init)
+{
+ return Fmake_vector (make_number (size), init);
+}
+INLINE Lisp_Object
+make_local_string (char const *str, ptrdiff_t nbytes)
+{
+ return make_string (str, nbytes);
+}
+INLINE Lisp_Object
+build_local_string (const char *str)
+{
+ return build_string (str);
+}
#endif
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2014-09-18 11:34:24 +0000
+++ b/src/xdisp.c 2014-09-21 22:49:24 +0000
@@ -12038,11 +12038,11 @@
build_desired_tool_bar_string (struct frame *f)
{
int i, size, size_needed;
- struct gcpro gcpro1, gcpro2, gcpro3;
- Lisp_Object image, plist, props;
+ struct gcpro gcpro1, gcpro2;
+ Lisp_Object image, plist;
- image = plist = props = Qnil;
- GCPRO3 (image, plist, props);
+ image = plist = Qnil;
+ GCPRO2 (image, plist);
/* Prepare F->desired_tool_bar_string. If we can reuse it, do so.
Otherwise, make a new string. */
@@ -12061,9 +12061,12 @@
(f, Fmake_string (make_number (size_needed), make_number (' ')));
else
{
- props = local_list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
+ Lisp_Object props = scoped_list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
+ struct gcpro gcpro1;
+ GCPRO1 (props);
Fremove_text_properties (make_number (0), make_number (size),
props, f->desired_tool_bar_string);
+ UNGCPRO;
}
/* Put a `display' property on the string for the images to display,
@@ -12174,8 +12177,11 @@
the start of this item's properties in the tool-bar items
vector. */
image = Fcons (Qimage, plist);
- props = local_list4 (Qdisplay, image, Qmenu_item,
- make_number (i * TOOL_BAR_ITEM_NSLOTS));
+ Lisp_Object props
+ = scoped_list4 (Qdisplay, image, Qmenu_item,
+ make_number (i * TOOL_BAR_ITEM_NSLOTS));
+ struct gcpro gcpro1;
+ GCPRO1 (props);
/* Let the last image hide all remaining spaces in the tool bar
string. The string can be longer than needed when we reuse a
@@ -12186,6 +12192,7 @@
end = i + 1;
Fadd_text_properties (make_number (i), make_number (end),
props, f->desired_tool_bar_string);
+ UNGCPRO;
#undef PROP
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117912: Minor improvements to new stack-allocated Lisp objects.,
Paul Eggert <=