diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/lisp.h | 70 | ||||
| -rw-r--r-- | src/xdisp.c | 21 |
4 files changed, 79 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0e676e2c73c..a80394b5855 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2014-09-21 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Minor improvements to new stack-allocated Lisp objects. | ||
| 4 | * frame.h (FRAME_PARAMETER): | ||
| 5 | Prefer scoped_list1 to local_list1 where either would do. | ||
| 6 | * lisp.h (scoped_list4): New macro. | ||
| 7 | (local_cons, local_list1, local_list2, local_list3, local_list4) | ||
| 8 | (make_local_vector, make_local_string, build_local_string): | ||
| 9 | Prefer functions to macros where either would do. | ||
| 10 | * xdisp.c (build_desired_tool_bar_string): | ||
| 11 | Prefer scoped_list4 to local_list4 where either would do. | ||
| 12 | |||
| 1 | 2014-09-18 Dmitry Antipov <dmantipov@yandex.ru> | 13 | 2014-09-18 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 14 | ||
| 3 | More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS. | 15 | More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS. |
diff --git a/src/frame.h b/src/frame.h index 0ba3e3712f6..94f080d3038 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1063,7 +1063,7 @@ default_pixels_per_inch_y (void) | |||
| 1063 | /* Handy macro to construct an argument to Fmodify_frame_parameters. */ | 1063 | /* Handy macro to construct an argument to Fmodify_frame_parameters. */ |
| 1064 | 1064 | ||
| 1065 | #define FRAME_PARAMETER(parameter, value) \ | 1065 | #define FRAME_PARAMETER(parameter, value) \ |
| 1066 | local_list1 (scoped_cons (parameter, value)) | 1066 | scoped_list1 (scoped_cons (parameter, value)) |
| 1067 | 1067 | ||
| 1068 | /* False means there are no visible garbaged frames. */ | 1068 | /* False means there are no visible garbaged frames. */ |
| 1069 | extern bool frame_garbaged; | 1069 | extern bool frame_garbaged; |
diff --git a/src/lisp.h b/src/lisp.h index b8e75f90ef5..1347b35f046 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4590,13 +4590,15 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons)); | |||
| 4590 | /* Convenient utility macros similar to listX functions. */ | 4590 | /* Convenient utility macros similar to listX functions. */ |
| 4591 | 4591 | ||
| 4592 | #if USE_STACK_LISP_OBJECTS | 4592 | #if USE_STACK_LISP_OBJECTS |
| 4593 | # define scoped_list1(x) scoped_cons (x, Qnil) | 4593 | # define scoped_list1(a) scoped_cons (a, Qnil) |
| 4594 | # define scoped_list2(x, y) scoped_cons (x, scoped_list1 (y)) | 4594 | # define scoped_list2(a, b) scoped_cons (a, scoped_list1 (b)) |
| 4595 | # define scoped_list3(x, y, z) scoped_cons (x, scoped_list2 (y, z)) | 4595 | # define scoped_list3(a, b, c) scoped_cons (a, scoped_list2 (b, c)) |
| 4596 | # define scoped_list4(a, b, c, d) scoped_cons (a, scoped_list3 (b, c, d)) | ||
| 4596 | #else | 4597 | #else |
| 4597 | # define scoped_list1(x) list1 (x) | 4598 | # define scoped_list1(a) list1 (a) |
| 4598 | # define scoped_list2(x, y) list2 (x, y) | 4599 | # define scoped_list2(a, b) list2 (a, b) |
| 4599 | # define scoped_list3(x, y, z) list3 (x, y, z) | 4600 | # define scoped_list3(a, b, c) list3 (a, b, c) |
| 4601 | # define scoped_list4(a, b, c, d) list4 (a, b, c, d) | ||
| 4600 | #endif | 4602 | #endif |
| 4601 | 4603 | ||
| 4602 | /* Local allocators require both statement expressions and a | 4604 | /* Local allocators require both statement expressions and a |
| @@ -4620,10 +4622,10 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons)); | |||
| 4620 | make_lisp_ptr (c_, Lisp_Cons); \ | 4622 | make_lisp_ptr (c_, Lisp_Cons); \ |
| 4621 | }) | 4623 | }) |
| 4622 | 4624 | ||
| 4623 | # define local_list1(x) local_cons (x, Qnil) | 4625 | # define local_list1(a) local_cons (a, Qnil) |
| 4624 | # define local_list2(x, y) local_cons (x, local_list1 (y)) | 4626 | # define local_list2(a, b) local_cons (a, local_list1 (b)) |
| 4625 | # define local_list3(x, y, z) local_cons (x, local_list2 (y, z)) | 4627 | # define local_list3(a, b, c) local_cons (a, local_list2 (b, c)) |
| 4626 | # define local_list4(x, y, z, t) local_cons (x, local_list3 (y, z, t)) | 4628 | # define local_list4(a, b, c, d) local_cons (a, local_list3 (b, c, d)) |
| 4627 | 4629 | ||
| 4628 | /* Return a function-scoped vector of length SIZE, with each element | 4630 | /* Return a function-scoped vector of length SIZE, with each element |
| 4629 | being INIT. */ | 4631 | being INIT. */ |
| @@ -4670,14 +4672,46 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons)); | |||
| 4670 | #else | 4672 | #else |
| 4671 | 4673 | ||
| 4672 | /* Safer but slower implementations. */ | 4674 | /* Safer but slower implementations. */ |
| 4673 | # define local_cons(car, cdr) Fcons (car, cdr) | 4675 | INLINE Lisp_Object |
| 4674 | # define local_list1(x) list1 (x) | 4676 | local_cons (Lisp_Object car, Lisp_Object cdr) |
| 4675 | # define local_list2(x, y) list2 (x, y) | 4677 | { |
| 4676 | # define local_list3(x, y, z) list3 (x, y, z) | 4678 | return Fcons (car, cdr); |
| 4677 | # define local_list4(x, y, z, t) list4 (x, y, z, t) | 4679 | } |
| 4678 | # define make_local_vector(size, init) Fmake_vector (make_number (size), init) | 4680 | INLINE Lisp_Object |
| 4679 | # define make_local_string(data, nbytes) make_string (data, nbytes) | 4681 | local_list1 (Lisp_Object a) |
| 4680 | # define build_local_string(data) build_string (data) | 4682 | { |
| 4683 | return list1 (a); | ||
| 4684 | } | ||
| 4685 | INLINE Lisp_Object | ||
| 4686 | local_list2 (Lisp_Object a, Lisp_Object b) | ||
| 4687 | { | ||
| 4688 | return list2 (a, b); | ||
| 4689 | } | ||
| 4690 | INLINE Lisp_Object | ||
| 4691 | local_list3 (Lisp_Object a, Lisp_Object b, Lisp_Object c) | ||
| 4692 | { | ||
| 4693 | return list3 (a, b, c); | ||
| 4694 | } | ||
| 4695 | INLINE Lisp_Object | ||
| 4696 | local_list4 (Lisp_Object a, Lisp_Object b, Lisp_Object c, Lisp_Object d) | ||
| 4697 | { | ||
| 4698 | return list4 (a, b, c, d); | ||
| 4699 | } | ||
| 4700 | INLINE Lisp_Object | ||
| 4701 | make_local_vector (ptrdiff_t size, Lisp_Object init) | ||
| 4702 | { | ||
| 4703 | return Fmake_vector (make_number (size), init); | ||
| 4704 | } | ||
| 4705 | INLINE Lisp_Object | ||
| 4706 | make_local_string (char const *str, ptrdiff_t nbytes) | ||
| 4707 | { | ||
| 4708 | return make_string (str, nbytes); | ||
| 4709 | } | ||
| 4710 | INLINE Lisp_Object | ||
| 4711 | build_local_string (const char *str) | ||
| 4712 | { | ||
| 4713 | return build_string (str); | ||
| 4714 | } | ||
| 4681 | #endif | 4715 | #endif |
| 4682 | 4716 | ||
| 4683 | 4717 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index a35cac35e60..08b7154aa8b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -12038,11 +12038,11 @@ static void | |||
| 12038 | build_desired_tool_bar_string (struct frame *f) | 12038 | build_desired_tool_bar_string (struct frame *f) |
| 12039 | { | 12039 | { |
| 12040 | int i, size, size_needed; | 12040 | int i, size, size_needed; |
| 12041 | struct gcpro gcpro1, gcpro2, gcpro3; | 12041 | struct gcpro gcpro1, gcpro2; |
| 12042 | Lisp_Object image, plist, props; | 12042 | Lisp_Object image, plist; |
| 12043 | 12043 | ||
| 12044 | image = plist = props = Qnil; | 12044 | image = plist = Qnil; |
| 12045 | GCPRO3 (image, plist, props); | 12045 | GCPRO2 (image, plist); |
| 12046 | 12046 | ||
| 12047 | /* Prepare F->desired_tool_bar_string. If we can reuse it, do so. | 12047 | /* Prepare F->desired_tool_bar_string. If we can reuse it, do so. |
| 12048 | Otherwise, make a new string. */ | 12048 | Otherwise, make a new string. */ |
| @@ -12061,9 +12061,12 @@ build_desired_tool_bar_string (struct frame *f) | |||
| 12061 | (f, Fmake_string (make_number (size_needed), make_number (' '))); | 12061 | (f, Fmake_string (make_number (size_needed), make_number (' '))); |
| 12062 | else | 12062 | else |
| 12063 | { | 12063 | { |
| 12064 | props = local_list4 (Qdisplay, Qnil, Qmenu_item, Qnil); | 12064 | Lisp_Object props = scoped_list4 (Qdisplay, Qnil, Qmenu_item, Qnil); |
| 12065 | struct gcpro gcpro1; | ||
| 12066 | GCPRO1 (props); | ||
| 12065 | Fremove_text_properties (make_number (0), make_number (size), | 12067 | Fremove_text_properties (make_number (0), make_number (size), |
| 12066 | props, f->desired_tool_bar_string); | 12068 | props, f->desired_tool_bar_string); |
| 12069 | UNGCPRO; | ||
| 12067 | } | 12070 | } |
| 12068 | 12071 | ||
| 12069 | /* Put a `display' property on the string for the images to display, | 12072 | /* Put a `display' property on the string for the images to display, |
| @@ -12174,8 +12177,11 @@ build_desired_tool_bar_string (struct frame *f) | |||
| 12174 | the start of this item's properties in the tool-bar items | 12177 | the start of this item's properties in the tool-bar items |
| 12175 | vector. */ | 12178 | vector. */ |
| 12176 | image = Fcons (Qimage, plist); | 12179 | image = Fcons (Qimage, plist); |
| 12177 | props = local_list4 (Qdisplay, image, Qmenu_item, | 12180 | Lisp_Object props |
| 12178 | make_number (i * TOOL_BAR_ITEM_NSLOTS)); | 12181 | = scoped_list4 (Qdisplay, image, Qmenu_item, |
| 12182 | make_number (i * TOOL_BAR_ITEM_NSLOTS)); | ||
| 12183 | struct gcpro gcpro1; | ||
| 12184 | GCPRO1 (props); | ||
| 12179 | 12185 | ||
| 12180 | /* Let the last image hide all remaining spaces in the tool bar | 12186 | /* Let the last image hide all remaining spaces in the tool bar |
| 12181 | string. The string can be longer than needed when we reuse a | 12187 | string. The string can be longer than needed when we reuse a |
| @@ -12186,6 +12192,7 @@ build_desired_tool_bar_string (struct frame *f) | |||
| 12186 | end = i + 1; | 12192 | end = i + 1; |
| 12187 | Fadd_text_properties (make_number (i), make_number (end), | 12193 | Fadd_text_properties (make_number (i), make_number (end), |
| 12188 | props, f->desired_tool_bar_string); | 12194 | props, f->desired_tool_bar_string); |
| 12195 | UNGCPRO; | ||
| 12189 | #undef PROP | 12196 | #undef PROP |
| 12190 | } | 12197 | } |
| 12191 | 12198 | ||