diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2015-01-10 13:33:38 -0800 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-01-10 13:42:35 -0800 |
| commit | 6a37ecee0884ff30ac7666e6502e2a9d2608f291 (patch) | |
| tree | 875bd8310981ff850911f04da4c3c3b95f34537b /src/lisp.h | |
| parent | 649937920b5023be5c0685d1537f5ea2bfb9899a (diff) | |
| download | emacs-6a37ecee0884ff30ac7666e6502e2a9d2608f291.tar.gz | |
Port to 32-bit --with-wide-int
Prefer symbol indexes to struct Lisp_Symbol * casted and then
widened, as the latter had trouble with GCC on Fedora 21 when
configured --with-wide-int and when used in static initializers.
* lib-src/make-docfile.c (write_globals): Define and use symbols like
iQnil (a small integer, like 0) rather than aQnil (an address
constant).
* src/alloc.c (garbage_collect_1, which_symbols):
* src/lread.c (init_obarray):
Prefer builtin_lisp_symbol when it can be used.
* src/dispextern.h (struct image_type.type):
* src/font.c (font_property_table.key):
* src/frame.c (struct frame_parm_table.sym):
* src/keyboard.c (scroll_bar_parts, struct event_head):
* src/xdisp.c (struct props.name):
Use the index of a builtin symbol rather than its address.
All uses changed.
* src/lisp.h (TAG_SYMPTR, XSYMBOL_INIT): Remove, replacing with ...
(TAG_SYMOFFSET, SYMBOL_INDEX): ... new macros that deal with
symbol indexes rather than pointers, and which work better on MSB
hosts because they shift right before tagging. All uses changed.
(DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END):
No longer noops on wide-int hosts, since they work now.
(builtin_lisp_symbol): New function.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 39 |
1 files changed, 20 insertions, 19 deletions
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 #define TAG_PTR(tag, ptr) \ ((USE_LSB_TAG ? (tag) : (EMACS_UINT) (tag) << VALBITS) + (uintptr_t) (ptr)) -/* Yield an integer that tags PTR as a symbol. */ -#define TAG_SYMPTR(ptr) \ +/* Yield an integer that contains a symbol tag along with OFFSET. + OFFSET should be the offset in bytes from 'lispsym' to the symbol. */ +#define TAG_SYMOFFSET(offset) \ TAG_PTR (Lisp_Symbol, \ - ((uintptr_t) ((char *) (ptr) - (char *) lispsym) \ - >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) + ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) /* Declare extern constants for Lisp symbols. These can be helpful when using a debugger like GDB, on older platforms where the debug - format does not represent C macros. However, they don't work with - GCC if INTPTR_MAX != EMACS_INT_MAX. */ -#if EMACS_INT_MAX == INTPTR_MAX -# define DEFINE_LISP_SYMBOL_BEGIN(name) \ - DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) -# define DEFINE_LISP_SYMBOL_END(name) \ - DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMPTR (name))) -#else -# define DEFINE_LISP_SYMBOL_BEGIN(name) /* empty */ -# define DEFINE_LISP_SYMBOL_END(name) /* empty */ -#endif + format does not represent C macros. */ +#define DEFINE_LISP_SYMBOL_BEGIN(name) \ + DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) +#define DEFINE_LISP_SYMBOL_END(name) \ + DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMOFFSET (i##name \ + * sizeof *lispsym))) #include "globals.h" @@ -973,9 +968,9 @@ XSTRING (Lisp_Object a) return XUNTAG (a, Lisp_String); } -/* XSYMBOL_INIT (Qfoo) is like XSYMBOL (Qfoo), except it is valid in - static initializers, and SYM must be a C-defined symbol. */ -#define XSYMBOL_INIT(sym) a##sym +/* The index of the C-defined Lisp symbol SYM. + This can be used in a static initializer. */ +#define SYMBOL_INDEX(sym) i##sym INLINE struct Lisp_Float * XFLOAT (Lisp_Object a) @@ -1054,12 +1049,18 @@ make_lisp_ptr (void *ptr, enum Lisp_Type type) INLINE Lisp_Object make_lisp_symbol (struct Lisp_Symbol *sym) { - Lisp_Object a = XIL (TAG_SYMPTR (sym)); + Lisp_Object a = XIL (TAG_SYMOFFSET ((char *) sym - (char *) lispsym)); eassert (XSYMBOL (a) == sym); return a; } INLINE Lisp_Object +builtin_lisp_symbol (int index) +{ + return make_lisp_symbol (lispsym + index); +} + +INLINE Lisp_Object make_lisp_proc (struct Lisp_Process *p) { return make_lisp_ptr (p, Lisp_Vectorlike); |
