aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog22
-rw-r--r--src/alloc.c4
-rw-r--r--src/dispextern.h4
-rw-r--r--src/font.c38
-rw-r--r--src/frame.c82
-rw-r--r--src/image.c33
-rw-r--r--src/keyboard.c57
-rw-r--r--src/lisp.h39
-rw-r--r--src/lread.c2
-rw-r--r--src/xdisp.c21
10 files changed, 163 insertions, 139 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 39775eb675c..14d582d57ec 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,27 @@
12015-01-10 Paul Eggert <eggert@cs.ucla.edu> 12015-01-10 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Port to 32-bit --with-wide-int
4 Prefer symbol indexes to struct Lisp_Symbol * casted and then
5 widened, as the latter had trouble with GCC on Fedora 21 when
6 configured --with-wide-int and when used in static initializers.
7 * alloc.c (garbage_collect_1, which_symbols):
8 * lread.c (init_obarray):
9 Prefer builtin_lisp_symbol when it can be used.
10 * dispextern.h (struct image_type.type):
11 * font.c (font_property_table.key):
12 * frame.c (struct frame_parm_table.sym):
13 * keyboard.c (scroll_bar_parts, struct event_head):
14 * xdisp.c (struct props.name):
15 Use the index of a builtin symbol rather than its address.
16 All uses changed.
17 * lisp.h (TAG_SYMPTR, XSYMBOL_INIT): Remove, replacing with ...
18 (TAG_SYMOFFSET, SYMBOL_INDEX): ... new macros that deal with
19 symbol indexes rather than pointers, and which work better on MSB
20 hosts because they shift right before tagging. All uses changed.
21 (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END):
22 No longer noops on wide-int hosts, since they work now.
23 (builtin_lisp_symbol): New function.
24
3 Port to HAVE_FREETYPE && !HAVE_XFT 25 Port to HAVE_FREETYPE && !HAVE_XFT
4 * dispextern.h (struct face.extra) [HAVE_FREETYPE && !HAVE_XFT]: 26 * dispextern.h (struct face.extra) [HAVE_FREETYPE && !HAVE_XFT]:
5 * font.h (syms_of_xftfont) [HAVE_FREETYPE && !HAVE_XFT]: 27 * font.h (syms_of_xftfont) [HAVE_FREETYPE && !HAVE_XFT]:
diff --git a/src/alloc.c b/src/alloc.c
index 712c8f771f7..7c937332407 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5630,7 +5630,7 @@ garbage_collect_1 (void *end)
5630 mark_buffer (&buffer_local_symbols); 5630 mark_buffer (&buffer_local_symbols);
5631 5631
5632 for (i = 0; i < ARRAYELTS (lispsym); i++) 5632 for (i = 0; i < ARRAYELTS (lispsym); i++)
5633 mark_object (make_lisp_symbol (&lispsym[i])); 5633 mark_object (builtin_lisp_symbol (i));
5634 5634
5635 for (i = 0; i < staticidx; i++) 5635 for (i = 0; i < staticidx; i++)
5636 mark_object (*staticvec[i]); 5636 mark_object (*staticvec[i]);
@@ -7019,7 +7019,7 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
7019 { 7019 {
7020 for (int i = 0; i < ARRAYELTS (lispsym); i++) 7020 for (int i = 0; i < ARRAYELTS (lispsym); i++)
7021 { 7021 {
7022 Lisp_Object sym = make_lisp_symbol (&lispsym[i]); 7022 Lisp_Object sym = builtin_lisp_symbol (i);
7023 if (symbol_uses_obj (sym, obj)) 7023 if (symbol_uses_obj (sym, obj))
7024 { 7024 {
7025 found = Fcons (sym, found); 7025 found = Fcons (sym, found);
diff --git a/src/dispextern.h b/src/dispextern.h
index 161f252dd39..e9e6f709079 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2906,8 +2906,8 @@ struct redisplay_interface
2906 2906
2907struct image_type 2907struct image_type
2908{ 2908{
2909 /* A symbol uniquely identifying the image type, e.g., 'jpeg'. */ 2909 /* Index of a symbol uniquely identifying the image type, e.g., 'jpeg'. */
2910 struct Lisp_Symbol *type; 2910 int type;
2911 2911
2912 /* Check that SPEC is a valid image specification for the given 2912 /* Check that SPEC is a valid image specification for the given
2913 image type. Value is true if SPEC is valid. */ 2913 image type. Value is true if SPEC is valid. */
diff --git a/src/font.c b/src/font.c
index 60134b1de5b..a68c3c707c8 100644
--- a/src/font.c
+++ b/src/font.c
@@ -639,30 +639,30 @@ font_prop_validate_otf (Lisp_Object prop, Lisp_Object val)
639 values. */ 639 values. */
640static const struct 640static const struct
641{ 641{
642 /* Pointer to the key symbol. */ 642 /* Index of the key symbol. */
643 struct Lisp_Symbol *key; 643 int key;
644 /* Function to validate PROP's value VAL, or NULL if any value is 644 /* Function to validate PROP's value VAL, or NULL if any value is
645 ok. The value is VAL or its regularized value if VAL is valid, 645 ok. The value is VAL or its regularized value if VAL is valid,
646 and Qerror if not. */ 646 and Qerror if not. */
647 Lisp_Object (*validator) (Lisp_Object prop, Lisp_Object val); 647 Lisp_Object (*validator) (Lisp_Object prop, Lisp_Object val);
648} font_property_table[] = 648} font_property_table[] =
649 { { XSYMBOL_INIT (QCtype), font_prop_validate_symbol }, 649 { { SYMBOL_INDEX (QCtype), font_prop_validate_symbol },
650 { XSYMBOL_INIT (QCfoundry), font_prop_validate_symbol }, 650 { SYMBOL_INDEX (QCfoundry), font_prop_validate_symbol },
651 { XSYMBOL_INIT (QCfamily), font_prop_validate_symbol }, 651 { SYMBOL_INDEX (QCfamily), font_prop_validate_symbol },
652 { XSYMBOL_INIT (QCadstyle), font_prop_validate_symbol }, 652 { SYMBOL_INDEX (QCadstyle), font_prop_validate_symbol },
653 { XSYMBOL_INIT (QCregistry), font_prop_validate_symbol }, 653 { SYMBOL_INDEX (QCregistry), font_prop_validate_symbol },
654 { XSYMBOL_INIT (QCweight), font_prop_validate_style }, 654 { SYMBOL_INDEX (QCweight), font_prop_validate_style },
655 { XSYMBOL_INIT (QCslant), font_prop_validate_style }, 655 { SYMBOL_INDEX (QCslant), font_prop_validate_style },
656 { XSYMBOL_INIT (QCwidth), font_prop_validate_style }, 656 { SYMBOL_INDEX (QCwidth), font_prop_validate_style },
657 { XSYMBOL_INIT (QCsize), font_prop_validate_non_neg }, 657 { SYMBOL_INDEX (QCsize), font_prop_validate_non_neg },
658 { XSYMBOL_INIT (QCdpi), font_prop_validate_non_neg }, 658 { SYMBOL_INDEX (QCdpi), font_prop_validate_non_neg },
659 { XSYMBOL_INIT (QCspacing), font_prop_validate_spacing }, 659 { SYMBOL_INDEX (QCspacing), font_prop_validate_spacing },
660 { XSYMBOL_INIT (QCavgwidth), font_prop_validate_non_neg }, 660 { SYMBOL_INDEX (QCavgwidth), font_prop_validate_non_neg },
661 /* The order of the above entries must match with enum 661 /* The order of the above entries must match with enum
662 font_property_index. */ 662 font_property_index. */
663 { XSYMBOL_INIT (QClang), font_prop_validate_symbol }, 663 { SYMBOL_INDEX (QClang), font_prop_validate_symbol },
664 { XSYMBOL_INIT (QCscript), font_prop_validate_symbol }, 664 { SYMBOL_INDEX (QCscript), font_prop_validate_symbol },
665 { XSYMBOL_INIT (QCotf), font_prop_validate_otf } 665 { SYMBOL_INDEX (QCotf), font_prop_validate_otf }
666 }; 666 };
667 667
668/* Return an index number of font property KEY or -1 if KEY is not an 668/* Return an index number of font property KEY or -1 if KEY is not an
@@ -674,7 +674,7 @@ get_font_prop_index (Lisp_Object key)
674 int i; 674 int i;
675 675
676 for (i = 0; i < ARRAYELTS (font_property_table); i++) 676 for (i = 0; i < ARRAYELTS (font_property_table); i++)
677 if (EQ (key, make_lisp_symbol (font_property_table[i].key))) 677 if (EQ (key, builtin_lisp_symbol (font_property_table[i].key)))
678 return i; 678 return i;
679 return -1; 679 return -1;
680} 680}
@@ -691,7 +691,7 @@ font_prop_validate (int idx, Lisp_Object prop, Lisp_Object val)
691 if (NILP (val)) 691 if (NILP (val))
692 return val; 692 return val;
693 if (NILP (prop)) 693 if (NILP (prop))
694 prop = make_lisp_symbol (font_property_table[idx].key); 694 prop = builtin_lisp_symbol (font_property_table[idx].key);
695 else 695 else
696 { 696 {
697 idx = get_font_prop_index (prop); 697 idx = get_font_prop_index (prop);
diff --git a/src/frame.c b/src/frame.c
index fb9bf2e9cbb..3d2ffbf624f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2925,48 +2925,48 @@ or bottommost possible position (that stays within the screen). */)
2925 2925
2926struct frame_parm_table { 2926struct frame_parm_table {
2927 const char *name; 2927 const char *name;
2928 struct Lisp_Symbol *sym; 2928 int sym;
2929}; 2929};
2930 2930
2931static const struct frame_parm_table frame_parms[] = 2931static const struct frame_parm_table frame_parms[] =
2932{ 2932{
2933 {"auto-raise", XSYMBOL_INIT (Qauto_raise)}, 2933 {"auto-raise", SYMBOL_INDEX (Qauto_raise)},
2934 {"auto-lower", XSYMBOL_INIT (Qauto_lower)}, 2934 {"auto-lower", SYMBOL_INDEX (Qauto_lower)},
2935 {"background-color", 0}, 2935 {"background-color", -1},
2936 {"border-color", XSYMBOL_INIT (Qborder_color)}, 2936 {"border-color", SYMBOL_INDEX (Qborder_color)},
2937 {"border-width", XSYMBOL_INIT (Qborder_width)}, 2937 {"border-width", SYMBOL_INDEX (Qborder_width)},
2938 {"cursor-color", XSYMBOL_INIT (Qcursor_color)}, 2938 {"cursor-color", SYMBOL_INDEX (Qcursor_color)},
2939 {"cursor-type", XSYMBOL_INIT (Qcursor_type)}, 2939 {"cursor-type", SYMBOL_INDEX (Qcursor_type)},
2940 {"font", 0}, 2940 {"font", -1},
2941 {"foreground-color", 0}, 2941 {"foreground-color", -1},
2942 {"icon-name", XSYMBOL_INIT (Qicon_name)}, 2942 {"icon-name", SYMBOL_INDEX (Qicon_name)},
2943 {"icon-type", XSYMBOL_INIT (Qicon_type)}, 2943 {"icon-type", SYMBOL_INDEX (Qicon_type)},
2944 {"internal-border-width", XSYMBOL_INIT (Qinternal_border_width)}, 2944 {"internal-border-width", SYMBOL_INDEX (Qinternal_border_width)},
2945 {"right-divider-width", XSYMBOL_INIT (Qright_divider_width)}, 2945 {"right-divider-width", SYMBOL_INDEX (Qright_divider_width)},
2946 {"bottom-divider-width", XSYMBOL_INIT (Qbottom_divider_width)}, 2946 {"bottom-divider-width", SYMBOL_INDEX (Qbottom_divider_width)},
2947 {"menu-bar-lines", XSYMBOL_INIT (Qmenu_bar_lines)}, 2947 {"menu-bar-lines", SYMBOL_INDEX (Qmenu_bar_lines)},
2948 {"mouse-color", XSYMBOL_INIT (Qmouse_color)}, 2948 {"mouse-color", SYMBOL_INDEX (Qmouse_color)},
2949 {"name", XSYMBOL_INIT (Qname)}, 2949 {"name", SYMBOL_INDEX (Qname)},
2950 {"scroll-bar-width", XSYMBOL_INIT (Qscroll_bar_width)}, 2950 {"scroll-bar-width", SYMBOL_INDEX (Qscroll_bar_width)},
2951 {"scroll-bar-height", XSYMBOL_INIT (Qscroll_bar_height)}, 2951 {"scroll-bar-height", SYMBOL_INDEX (Qscroll_bar_height)},
2952 {"title", XSYMBOL_INIT (Qtitle)}, 2952 {"title", SYMBOL_INDEX (Qtitle)},
2953 {"unsplittable", XSYMBOL_INIT (Qunsplittable)}, 2953 {"unsplittable", SYMBOL_INDEX (Qunsplittable)},
2954 {"vertical-scroll-bars", XSYMBOL_INIT (Qvertical_scroll_bars)}, 2954 {"vertical-scroll-bars", SYMBOL_INDEX (Qvertical_scroll_bars)},
2955 {"horizontal-scroll-bars", XSYMBOL_INIT (Qhorizontal_scroll_bars)}, 2955 {"horizontal-scroll-bars", SYMBOL_INDEX (Qhorizontal_scroll_bars)},
2956 {"visibility", XSYMBOL_INIT (Qvisibility)}, 2956 {"visibility", SYMBOL_INDEX (Qvisibility)},
2957 {"tool-bar-lines", XSYMBOL_INIT (Qtool_bar_lines)}, 2957 {"tool-bar-lines", SYMBOL_INDEX (Qtool_bar_lines)},
2958 {"scroll-bar-foreground", XSYMBOL_INIT (Qscroll_bar_foreground)}, 2958 {"scroll-bar-foreground", SYMBOL_INDEX (Qscroll_bar_foreground)},
2959 {"scroll-bar-background", XSYMBOL_INIT (Qscroll_bar_background)}, 2959 {"scroll-bar-background", SYMBOL_INDEX (Qscroll_bar_background)},
2960 {"screen-gamma", XSYMBOL_INIT (Qscreen_gamma)}, 2960 {"screen-gamma", SYMBOL_INDEX (Qscreen_gamma)},
2961 {"line-spacing", XSYMBOL_INIT (Qline_spacing)}, 2961 {"line-spacing", SYMBOL_INDEX (Qline_spacing)},
2962 {"left-fringe", XSYMBOL_INIT (Qleft_fringe)}, 2962 {"left-fringe", SYMBOL_INDEX (Qleft_fringe)},
2963 {"right-fringe", XSYMBOL_INIT (Qright_fringe)}, 2963 {"right-fringe", SYMBOL_INDEX (Qright_fringe)},
2964 {"wait-for-wm", XSYMBOL_INIT (Qwait_for_wm)}, 2964 {"wait-for-wm", SYMBOL_INDEX (Qwait_for_wm)},
2965 {"fullscreen", XSYMBOL_INIT (Qfullscreen)}, 2965 {"fullscreen", SYMBOL_INDEX (Qfullscreen)},
2966 {"font-backend", XSYMBOL_INIT (Qfont_backend)}, 2966 {"font-backend", SYMBOL_INDEX (Qfont_backend)},
2967 {"alpha", XSYMBOL_INIT (Qalpha)}, 2967 {"alpha", SYMBOL_INDEX (Qalpha)},
2968 {"sticky", XSYMBOL_INIT (Qsticky)}, 2968 {"sticky", SYMBOL_INDEX (Qsticky)},
2969 {"tool-bar-position", XSYMBOL_INIT (Qtool_bar_position)}, 2969 {"tool-bar-position", SYMBOL_INDEX (Qtool_bar_position)},
2970}; 2970};
2971 2971
2972#ifdef HAVE_WINDOW_SYSTEM 2972#ifdef HAVE_WINDOW_SYSTEM
@@ -4824,9 +4824,9 @@ syms_of_frame (void)
4824 4824
4825 for (i = 0; i < ARRAYELTS (frame_parms); i++) 4825 for (i = 0; i < ARRAYELTS (frame_parms); i++)
4826 { 4826 {
4827 Lisp_Object v = (frame_parms[i].sym 4827 Lisp_Object v = (frame_parms[i].sym < 0
4828 ? make_lisp_symbol (frame_parms[i].sym) 4828 ? intern_c_string (frame_parms[i].name)
4829 : intern_c_string (frame_parms[i].name)); 4829 : builtin_lisp_symbol (frame_parms[i].sym));
4830 Fput (v, Qx_frame_parameter, make_number (i)); 4830 Fput (v, Qx_frame_parameter, make_number (i));
4831 } 4831 }
4832 } 4832 }
diff --git a/src/image.c b/src/image.c
index addb932f834..5d08a890234 100644
--- a/src/image.c
+++ b/src/image.c
@@ -548,8 +548,8 @@ static struct image_type *
548define_image_type (struct image_type *type) 548define_image_type (struct image_type *type)
549{ 549{
550 struct image_type *p = NULL; 550 struct image_type *p = NULL;
551 struct Lisp_Symbol *new_type = type->type; 551 int new_type = type->type;
552 bool type_valid = 1; 552 bool type_valid = true;
553 553
554 block_input (); 554 block_input ();
555 555
@@ -561,14 +561,15 @@ define_image_type (struct image_type *type)
561 { 561 {
562#if defined HAVE_NTGUI && defined WINDOWSNT 562#if defined HAVE_NTGUI && defined WINDOWSNT
563 /* If we failed to load the library before, don't try again. */ 563 /* If we failed to load the library before, don't try again. */
564 Lisp_Object tested = Fassq (make_lisp_symbol (new_type), Vlibrary_cache); 564 Lisp_Object tested = Fassq (builtin_lisp_symbol (new_type),
565 Vlibrary_cache);
565 if (CONSP (tested) && NILP (XCDR (tested))) 566 if (CONSP (tested) && NILP (XCDR (tested)))
566 type_valid = 0; 567 type_valid = false;
567 else 568 else
568#endif 569#endif
569 { 570 {
570 type_valid = type->init (); 571 type_valid = type->init ();
571 CACHE_IMAGE_TYPE (make_lisp_symbol (new_type), 572 CACHE_IMAGE_TYPE (builtin_lisp_symbol (new_type),
572 type_valid ? Qt : Qnil); 573 type_valid ? Qt : Qnil);
573 } 574 }
574 } 575 }
@@ -1747,7 +1748,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
1747 1748
1748 /* Do image transformations and compute masks, unless we 1749 /* Do image transformations and compute masks, unless we
1749 don't have the image yet. */ 1750 don't have the image yet. */
1750 if (!EQ (make_lisp_symbol (img->type->type), Qpostscript)) 1751 if (!EQ (builtin_lisp_symbol (img->type->type), Qpostscript))
1751 postprocess_image (f, img); 1752 postprocess_image (f, img);
1752 } 1753 }
1753 1754
@@ -2332,7 +2333,7 @@ static const struct image_keyword xbm_format[XBM_LAST] =
2332 2333
2333static struct image_type xbm_type = 2334static struct image_type xbm_type =
2334{ 2335{
2335 XSYMBOL_INIT (Qxbm), 2336 SYMBOL_INDEX (Qxbm),
2336 xbm_image_p, 2337 xbm_image_p,
2337 xbm_load, 2338 xbm_load,
2338 x_clear_image, 2339 x_clear_image,
@@ -3138,7 +3139,7 @@ static bool init_xpm_functions (void);
3138 3139
3139static struct image_type xpm_type = 3140static struct image_type xpm_type =
3140{ 3141{
3141 XSYMBOL_INIT (Qxpm), 3142 SYMBOL_INDEX (Qxpm),
3142 xpm_image_p, 3143 xpm_image_p,
3143 xpm_load, 3144 xpm_load,
3144 x_clear_image, 3145 x_clear_image,
@@ -5066,7 +5067,7 @@ static const struct image_keyword pbm_format[PBM_LAST] =
5066 5067
5067static struct image_type pbm_type = 5068static struct image_type pbm_type =
5068{ 5069{
5069 XSYMBOL_INIT (Qpbm), 5070 SYMBOL_INDEX (Qpbm),
5070 pbm_image_p, 5071 pbm_image_p,
5071 pbm_load, 5072 pbm_load,
5072 x_clear_image, 5073 x_clear_image,
@@ -5453,7 +5454,7 @@ static bool init_png_functions (void);
5453 5454
5454static struct image_type png_type = 5455static struct image_type png_type =
5455{ 5456{
5456 XSYMBOL_INIT (Qpng), 5457 SYMBOL_INDEX (Qpng),
5457 png_image_p, 5458 png_image_p,
5458 png_load, 5459 png_load,
5459 x_clear_image, 5460 x_clear_image,
@@ -6105,7 +6106,7 @@ static bool init_jpeg_functions (void);
6105 6106
6106static struct image_type jpeg_type = 6107static struct image_type jpeg_type =
6107{ 6108{
6108 XSYMBOL_INIT (Qjpeg), 6109 SYMBOL_INDEX (Qjpeg),
6109 jpeg_image_p, 6110 jpeg_image_p,
6110 jpeg_load, 6111 jpeg_load,
6111 x_clear_image, 6112 x_clear_image,
@@ -6705,7 +6706,7 @@ static bool init_tiff_functions (void);
6705 6706
6706static struct image_type tiff_type = 6707static struct image_type tiff_type =
6707{ 6708{
6708 XSYMBOL_INIT (Qtiff), 6709 SYMBOL_INDEX (Qtiff),
6709 tiff_image_p, 6710 tiff_image_p,
6710 tiff_load, 6711 tiff_load,
6711 x_clear_image, 6712 x_clear_image,
@@ -7164,7 +7165,7 @@ static bool init_gif_functions (void);
7164 7165
7165static struct image_type gif_type = 7166static struct image_type gif_type =
7166{ 7167{
7167 XSYMBOL_INIT (Qgif), 7168 SYMBOL_INDEX (Qgif),
7168 gif_image_p, 7169 gif_image_p,
7169 gif_load, 7170 gif_load,
7170 gif_clear_image, 7171 gif_clear_image,
@@ -7851,7 +7852,7 @@ static bool init_imagemagick_functions (void);
7851 7852
7852static struct image_type imagemagick_type = 7853static struct image_type imagemagick_type =
7853 { 7854 {
7854 XSYMBOL_INIT (Qimagemagick), 7855 SYMBOL_INDEX (Qimagemagick),
7855 imagemagick_image_p, 7856 imagemagick_image_p,
7856 imagemagick_load, 7857 imagemagick_load,
7857 imagemagick_clear_image, 7858 imagemagick_clear_image,
@@ -8623,7 +8624,7 @@ static bool init_svg_functions (void);
8623 8624
8624static struct image_type svg_type = 8625static struct image_type svg_type =
8625{ 8626{
8626 XSYMBOL_INIT (Qsvg), 8627 SYMBOL_INDEX (Qsvg),
8627 svg_image_p, 8628 svg_image_p,
8628 svg_load, 8629 svg_load,
8629 x_clear_image, 8630 x_clear_image,
@@ -9039,7 +9040,7 @@ static const struct image_keyword gs_format[GS_LAST] =
9039 9040
9040static struct image_type gs_type = 9041static struct image_type gs_type =
9041{ 9042{
9042 XSYMBOL_INIT (Qpostscript), 9043 SYMBOL_INDEX (Qpostscript),
9043 gs_image_p, 9044 gs_image_p,
9044 gs_load, 9045 gs_load,
9045 gs_clear_image, 9046 gs_clear_image,
diff --git a/src/keyboard.c b/src/keyboard.c
index 2a50003038d..5411afff482 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5164,17 +5164,17 @@ static const char *const lispy_drag_n_drop_names[] =
5164 "drag-n-drop" 5164 "drag-n-drop"
5165}; 5165};
5166 5166
5167/* An array of scroll bar parts, indexed by an enum scroll_bar_part value. 5167/* An array of symbol indexes of scroll bar parts, indexed by an enum
5168 Note that Qnil corresponds to scroll_bar_nowhere and should not appear 5168 scroll_bar_part value. Note that Qnil corresponds to
5169 in Lisp events. */ 5169 scroll_bar_nowhere and should not appear in Lisp events. */
5170static struct Lisp_Symbol *const scroll_bar_parts[] = { 5170static short const scroll_bar_parts[] = {
5171 XSYMBOL_INIT (Qnil), XSYMBOL_INIT (Qabove_handle), XSYMBOL_INIT (Qhandle), 5171 SYMBOL_INDEX (Qnil), SYMBOL_INDEX (Qabove_handle), SYMBOL_INDEX (Qhandle),
5172 XSYMBOL_INIT (Qbelow_handle), XSYMBOL_INIT (Qup), XSYMBOL_INIT (Qdown), 5172 SYMBOL_INDEX (Qbelow_handle), SYMBOL_INDEX (Qup), SYMBOL_INDEX (Qdown),
5173 XSYMBOL_INIT (Qtop), XSYMBOL_INIT (Qbottom), XSYMBOL_INIT (Qend_scroll), 5173 SYMBOL_INDEX (Qtop), SYMBOL_INDEX (Qbottom), SYMBOL_INDEX (Qend_scroll),
5174 XSYMBOL_INIT (Qratio), XSYMBOL_INIT (Qbefore_handle), 5174 SYMBOL_INDEX (Qratio), SYMBOL_INDEX (Qbefore_handle),
5175 XSYMBOL_INIT (Qhorizontal_handle), XSYMBOL_INIT (Qafter_handle), 5175 SYMBOL_INDEX (Qhorizontal_handle), SYMBOL_INDEX (Qafter_handle),
5176 XSYMBOL_INIT (Qleft), XSYMBOL_INIT (Qright), XSYMBOL_INIT (Qleftmost), 5176 SYMBOL_INDEX (Qleft), SYMBOL_INDEX (Qright), SYMBOL_INDEX (Qleftmost),
5177 XSYMBOL_INIT (Qrightmost), XSYMBOL_INIT (Qend_scroll), XSYMBOL_INIT (Qratio) 5177 SYMBOL_INDEX (Qrightmost), SYMBOL_INDEX (Qend_scroll), SYMBOL_INDEX (Qratio)
5178}; 5178};
5179 5179
5180/* A vector, indexed by button number, giving the down-going location 5180/* A vector, indexed by button number, giving the down-going location
@@ -5448,7 +5448,7 @@ make_scroll_bar_position (struct input_event *ev, Lisp_Object type)
5448{ 5448{
5449 return list5 (ev->frame_or_window, type, Fcons (ev->x, ev->y), 5449 return list5 (ev->frame_or_window, type, Fcons (ev->x, ev->y),
5450 make_number (ev->timestamp), 5450 make_number (ev->timestamp),
5451 make_lisp_symbol (scroll_bar_parts[ev->part])); 5451 builtin_lisp_symbol (scroll_bar_parts[ev->part]));
5452} 5452}
5453 5453
5454/* Given a struct input_event, build the lisp event which represents 5454/* Given a struct input_event, build the lisp event which represents
@@ -6087,7 +6087,7 @@ make_lispy_movement (struct frame *frame, Lisp_Object bar_window, enum scroll_ba
6087 { 6087 {
6088 Lisp_Object part_sym; 6088 Lisp_Object part_sym;
6089 6089
6090 part_sym = make_lisp_symbol (scroll_bar_parts[part]); 6090 part_sym = builtin_lisp_symbol (scroll_bar_parts[part]);
6091 return list2 (Qscroll_bar_movement, 6091 return list2 (Qscroll_bar_movement,
6092 list5 (bar_window, 6092 list5 (bar_window,
6093 Qvertical_scroll_bar, 6093 Qvertical_scroll_bar,
@@ -10986,28 +10986,27 @@ init_keyboard (void)
10986 10986
10987/* This type's only use is in syms_of_keyboard, to put properties on the 10987/* This type's only use is in syms_of_keyboard, to put properties on the
10988 event header symbols. */ 10988 event header symbols. */
10989struct event_head { 10989struct event_head
10990 struct Lisp_Symbol *var; 10990{
10991 struct Lisp_Symbol *kind; 10991 short var;
10992 short kind;
10992}; 10993};
10993 10994
10994
10995
10996static const struct event_head head_table[] = { 10995static const struct event_head head_table[] = {
10997 {XSYMBOL_INIT (Qmouse_movement), XSYMBOL_INIT (Qmouse_movement)}, 10996 {SYMBOL_INDEX (Qmouse_movement), SYMBOL_INDEX (Qmouse_movement)},
10998 {XSYMBOL_INIT (Qscroll_bar_movement), XSYMBOL_INIT (Qmouse_movement)}, 10997 {SYMBOL_INDEX (Qscroll_bar_movement), SYMBOL_INDEX (Qmouse_movement)},
10999 10998
11000 /* Some of the event heads. */ 10999 /* Some of the event heads. */
11001 {XSYMBOL_INIT (Qswitch_frame), XSYMBOL_INIT (Qswitch_frame)}, 11000 {SYMBOL_INDEX (Qswitch_frame), SYMBOL_INDEX (Qswitch_frame)},
11002 11001
11003 {XSYMBOL_INIT (Qfocus_in), XSYMBOL_INIT (Qfocus_in)}, 11002 {SYMBOL_INDEX (Qfocus_in), SYMBOL_INDEX (Qfocus_in)},
11004 {XSYMBOL_INIT (Qfocus_out), XSYMBOL_INIT (Qfocus_out)}, 11003 {SYMBOL_INDEX (Qfocus_out), SYMBOL_INDEX (Qfocus_out)},
11005 {XSYMBOL_INIT (Qdelete_frame), XSYMBOL_INIT (Qdelete_frame)}, 11004 {SYMBOL_INDEX (Qdelete_frame), SYMBOL_INDEX (Qdelete_frame)},
11006 {XSYMBOL_INIT (Qiconify_frame), XSYMBOL_INIT (Qiconify_frame)}, 11005 {SYMBOL_INDEX (Qiconify_frame), SYMBOL_INDEX (Qiconify_frame)},
11007 {XSYMBOL_INIT (Qmake_frame_visible), XSYMBOL_INIT (Qmake_frame_visible)}, 11006 {SYMBOL_INDEX (Qmake_frame_visible), SYMBOL_INDEX (Qmake_frame_visible)},
11008 /* `select-window' should be handled just like `switch-frame' 11007 /* `select-window' should be handled just like `switch-frame'
11009 in read_key_sequence. */ 11008 in read_key_sequence. */
11010 {XSYMBOL_INIT (Qselect_window), XSYMBOL_INIT (Qswitch_frame)} 11009 {SYMBOL_INDEX (Qselect_window), SYMBOL_INDEX (Qswitch_frame)}
11011}; 11010};
11012 11011
11013void 11012void
@@ -11180,8 +11179,8 @@ syms_of_keyboard (void)
11180 for (i = 0; i < ARRAYELTS (head_table); i++) 11179 for (i = 0; i < ARRAYELTS (head_table); i++)
11181 { 11180 {
11182 const struct event_head *p = &head_table[i]; 11181 const struct event_head *p = &head_table[i];
11183 Lisp_Object var = make_lisp_symbol (p->var); 11182 Lisp_Object var = builtin_lisp_symbol (p->var);
11184 Lisp_Object kind = make_lisp_symbol (p->kind); 11183 Lisp_Object kind = builtin_lisp_symbol (p->kind);
11185 Fput (var, Qevent_kind, kind); 11184 Fput (var, Qevent_kind, kind);
11186 Fput (var, Qevent_symbol_elements, list1 (var)); 11185 Fput (var, Qevent_symbol_elements, list1 (var));
11187 } 11186 }
diff --git a/src/lisp.h b/src/lisp.h
index ab72bf158a4..1fa1deb82a4 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -725,25 +725,20 @@ struct Lisp_Symbol
725#define TAG_PTR(tag, ptr) \ 725#define TAG_PTR(tag, ptr) \
726 ((USE_LSB_TAG ? (tag) : (EMACS_UINT) (tag) << VALBITS) + (uintptr_t) (ptr)) 726 ((USE_LSB_TAG ? (tag) : (EMACS_UINT) (tag) << VALBITS) + (uintptr_t) (ptr))
727 727
728/* Yield an integer that tags PTR as a symbol. */ 728/* Yield an integer that contains a symbol tag along with OFFSET.
729#define TAG_SYMPTR(ptr) \ 729 OFFSET should be the offset in bytes from 'lispsym' to the symbol. */
730#define TAG_SYMOFFSET(offset) \
730 TAG_PTR (Lisp_Symbol, \ 731 TAG_PTR (Lisp_Symbol, \
731 ((uintptr_t) ((char *) (ptr) - (char *) lispsym) \ 732 ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS)))
732 >> (USE_LSB_TAG ? 0 : GCTYPEBITS)))
733 733
734/* Declare extern constants for Lisp symbols. These can be helpful 734/* Declare extern constants for Lisp symbols. These can be helpful
735 when using a debugger like GDB, on older platforms where the debug 735 when using a debugger like GDB, on older platforms where the debug
736 format does not represent C macros. However, they don't work with 736 format does not represent C macros. */
737 GCC if INTPTR_MAX != EMACS_INT_MAX. */ 737#define DEFINE_LISP_SYMBOL_BEGIN(name) \
738#if EMACS_INT_MAX == INTPTR_MAX 738 DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name)
739# define DEFINE_LISP_SYMBOL_BEGIN(name) \ 739#define DEFINE_LISP_SYMBOL_END(name) \
740 DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) 740 DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMOFFSET (i##name \
741# define DEFINE_LISP_SYMBOL_END(name) \ 741 * sizeof *lispsym)))
742 DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMPTR (name)))
743#else
744# define DEFINE_LISP_SYMBOL_BEGIN(name) /* empty */
745# define DEFINE_LISP_SYMBOL_END(name) /* empty */
746#endif
747 742
748#include "globals.h" 743#include "globals.h"
749 744
@@ -973,9 +968,9 @@ XSTRING (Lisp_Object a)
973 return XUNTAG (a, Lisp_String); 968 return XUNTAG (a, Lisp_String);
974} 969}
975 970
976/* XSYMBOL_INIT (Qfoo) is like XSYMBOL (Qfoo), except it is valid in 971/* The index of the C-defined Lisp symbol SYM.
977 static initializers, and SYM must be a C-defined symbol. */ 972 This can be used in a static initializer. */
978#define XSYMBOL_INIT(sym) a##sym 973#define SYMBOL_INDEX(sym) i##sym
979 974
980INLINE struct Lisp_Float * 975INLINE struct Lisp_Float *
981XFLOAT (Lisp_Object a) 976XFLOAT (Lisp_Object a)
@@ -1054,12 +1049,18 @@ make_lisp_ptr (void *ptr, enum Lisp_Type type)
1054INLINE Lisp_Object 1049INLINE Lisp_Object
1055make_lisp_symbol (struct Lisp_Symbol *sym) 1050make_lisp_symbol (struct Lisp_Symbol *sym)
1056{ 1051{
1057 Lisp_Object a = XIL (TAG_SYMPTR (sym)); 1052 Lisp_Object a = XIL (TAG_SYMOFFSET ((char *) sym - (char *) lispsym));
1058 eassert (XSYMBOL (a) == sym); 1053 eassert (XSYMBOL (a) == sym);
1059 return a; 1054 return a;
1060} 1055}
1061 1056
1062INLINE Lisp_Object 1057INLINE Lisp_Object
1058builtin_lisp_symbol (int index)
1059{
1060 return make_lisp_symbol (lispsym + index);
1061}
1062
1063INLINE Lisp_Object
1063make_lisp_proc (struct Lisp_Process *p) 1064make_lisp_proc (struct Lisp_Process *p)
1064{ 1065{
1065 return make_lisp_ptr (p, Lisp_Vectorlike); 1066 return make_lisp_ptr (p, Lisp_Vectorlike);
diff --git a/src/lread.c b/src/lread.c
index 324052462fe..7f7bd8985d9 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4058,7 +4058,7 @@ init_obarray (void)
4058 staticpro (&initial_obarray); 4058 staticpro (&initial_obarray);
4059 4059
4060 for (int i = 0; i < ARRAYELTS (lispsym); i++) 4060 for (int i = 0; i < ARRAYELTS (lispsym); i++)
4061 define_symbol (make_lisp_symbol (&lispsym[i]), defsym_name[i]); 4061 define_symbol (builtin_lisp_symbol (i), defsym_name[i]);
4062 4062
4063 DEFSYM (Qunbound, "unbound"); 4063 DEFSYM (Qunbound, "unbound");
4064 4064
diff --git a/src/xdisp.c b/src/xdisp.c
index 36babfa74db..31702ed4135 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -622,8 +622,8 @@ enum prop_handled
622 622
623struct props 623struct props
624{ 624{
625 /* The name of the property. */ 625 /* The symbol index of the name of the property. */
626 struct Lisp_Symbol *name; 626 short name;
627 627
628 /* A unique index for the property. */ 628 /* A unique index for the property. */
629 enum prop_idx idx; 629 enum prop_idx idx;
@@ -644,14 +644,14 @@ static enum prop_handled handle_fontified_prop (struct it *);
644 644
645static struct props it_props[] = 645static struct props it_props[] =
646{ 646{
647 {XSYMBOL_INIT (Qfontified), FONTIFIED_PROP_IDX, handle_fontified_prop}, 647 {SYMBOL_INDEX (Qfontified), FONTIFIED_PROP_IDX, handle_fontified_prop},
648 /* Handle `face' before `display' because some sub-properties of 648 /* Handle `face' before `display' because some sub-properties of
649 `display' need to know the face. */ 649 `display' need to know the face. */
650 {XSYMBOL_INIT (Qface), FACE_PROP_IDX, handle_face_prop}, 650 {SYMBOL_INDEX (Qface), FACE_PROP_IDX, handle_face_prop},
651 {XSYMBOL_INIT (Qdisplay), DISPLAY_PROP_IDX, handle_display_prop}, 651 {SYMBOL_INDEX (Qdisplay), DISPLAY_PROP_IDX, handle_display_prop},
652 {XSYMBOL_INIT (Qinvisible), INVISIBLE_PROP_IDX, handle_invisible_prop}, 652 {SYMBOL_INDEX (Qinvisible), INVISIBLE_PROP_IDX, handle_invisible_prop},
653 {XSYMBOL_INIT (Qcomposition), COMPOSITION_PROP_IDX, handle_composition_prop}, 653 {SYMBOL_INDEX (Qcomposition), COMPOSITION_PROP_IDX, handle_composition_prop},
654 {NULL, 0, NULL} 654 {0, 0, NULL}
655}; 655};
656 656
657/* Value is the position described by X. If X is a marker, value is 657/* Value is the position described by X. If X is a marker, value is
@@ -3516,7 +3516,8 @@ compute_stop_pos (struct it *it)
3516 3516
3517 /* Get properties here. */ 3517 /* Get properties here. */
3518 for (p = it_props; p->handler; ++p) 3518 for (p = it_props; p->handler; ++p)
3519 values_here[p->idx] = textget (iv->plist, make_lisp_symbol (p->name)); 3519 values_here[p->idx] = textget (iv->plist,
3520 builtin_lisp_symbol (p->name));
3520 3521
3521 /* Look for an interval following iv that has different 3522 /* Look for an interval following iv that has different
3522 properties. */ 3523 properties. */
@@ -3529,7 +3530,7 @@ compute_stop_pos (struct it *it)
3529 for (p = it_props; p->handler; ++p) 3530 for (p = it_props; p->handler; ++p)
3530 { 3531 {
3531 Lisp_Object new_value = textget (next_iv->plist, 3532 Lisp_Object new_value = textget (next_iv->plist,
3532 make_lisp_symbol (p->name)); 3533 builtin_lisp_symbol (p->name));
3533 if (!EQ (values_here[p->idx], new_value)) 3534 if (!EQ (values_here[p->idx], new_value))
3534 break; 3535 break;
3535 } 3536 }