1. 16 Jan, 2015 1 commit
    • Dmitry Antipov's avatar
      Tune pseudovector allocation assuming Qnil == 0 · 3b48f995
      Dmitry Antipov authored
      * alloc.c (allocate_pseudovector): Use memset for both
      Lisp_Objects and regular slots.  Add zerolen arg.
      * lisp.h (allocate_pseudovector): Adjust prototype.
      (ALLOCATE_PSEUDOVECTOR): Adjust user.
      (ALLOCATE_ZEROED_PSEUDOVECTOR): New macro.
      (allocate_hash_table, allocate_window, allocate_frame)
      (allocate_process, allocate_terminal): Remove prototypes.
      * fns.c (allocate_hash_table): Now static here.
      * frame.c (allocate_frame):
      * process.c (allocate_process):
      * terminal.c (allocate_terminal):
      * window.c (allocate_window): Now static here.
      Use ALLOCATE_ZEROED_PSEUDOVECTOR.  Add comment.
      3b48f995
  2. 13 Jan, 2015 3 commits
    • Paul Eggert's avatar
      Remove now-unnecessary forward XTYPE decl · 56478476
      Paul Eggert authored
      * lisp.h (XTYPE): Remove forward declaration.  The recent merge
      from emacs-24 fixed the problem in a better way, by moving XPNTR's
      definition to after XTYPE's.
      56478476
    • Eli Zaretskii's avatar
      Fix problems with 32-bit wide-int build exposed by MinGW · 5aa618b0
      Eli Zaretskii authored
       lisp.h (XPNTR): Move definition to after XTYPE, to avoid
       compilation error in an unoptimized build when !USE_LSB_TAG.
       src/w32heap.c (DUMPED_HEAP_SIZE): For 32-bit wide-int build, use the
       same larger value as for the 64-bit build.
       src/w32term.h (SCROLL_BAR_PACK): Cast the result to UINT_PTR to
       avoid compiler warnings.
       src/w32proc.c (Fw32_get_codepage_charset, Fw32_set_keyboard_layout):
       Avoid compiler warnings about cast from integer to pointer of
       different size.
       src/w32menu.c (menubar_selection_callback, w32_menu_show): Cast to
       UINT_PTR instead of EMACS_INT, to avoid compiler warnings about
       casting from integer to pointer of different size.
       (add_menu_item): Pass the help-echo string as a pointer to
       Lisp_String, not as a Lisp_Object.
       (w32_menu_display_help): Use make_lisp_ptr to reconstruct a Lisp
       string object from its C pointer.
       src/w32fns.c (w32_msg_pump) <WM_EMACS_UNREGISTER_HOT_KEY>: Use
       make_lisp_ptr instead of XIL, to reconstruct a Lisp_Cons from its
       C pointer.
       <WM_EMACS_TOGGLE_LOCK_KEY>: msg.lparam is now a C integer.
       (Fx_create_frame): Type-cast the result of XFASTINT to avoild
       compiler warnings about size differences.
       (Fw32_unregister_hot_key): Pass the tail of w32_grabbed_keys as a
       pointer to a Lisp_Cons struct, not as a disguised EMACS_INT.
       (Fw32_toggle_lock_key): Pass the new state of the key as a C
       integer; use -1 for nil.  Doc fix.
       src/.gdbinit (xgetsym): New subroutine.
       (xsymname, xsymbol): Use it.
       (xprintsym): No need to call xgetptr.
      5aa618b0
    • Dmitry Antipov's avatar
      Consolidate duplicated string matching code. · b53b1ca4
      Dmitry Antipov authored
      * search.c (fast_string_match_internal): New function,
      consolidated from...
      (fast_string_match, fast_string_match_ignore_case): ...functions
      which are...
      * lisp.h (fast_string_match, fast_string_match_ignore_case):
      inlined from here now.
      (fast_string_match_internal): Add prototype.
      * dired.c (file_name_completion): Use fast_string_match_internal.
      b53b1ca4
  3. 12 Jan, 2015 1 commit
  4. 11 Jan, 2015 1 commit
    • Paul Eggert's avatar
      Port to MSB hosts without optimization · 9a57bda3
      Paul Eggert authored
      E.g., when configuring --with-wide-int CFLAGS='-O0' on x86,
      the inline function XTYPE needs to be declared before being used.
      * lisp.h (XTYPE): New forward declaration.
      9a57bda3
  5. 10 Jan, 2015 3 commits
    • Paul Eggert's avatar
      Port to 32-bit --with-wide-int · 6a37ecee
      Paul Eggert authored
      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.
      6a37ecee
    • Paul Eggert's avatar
      Port to 32-bit Sun C 5.12 sparc · 288e1fd7
      Paul Eggert authored
      * make-docfile.c (close_emacs_globals): Align lispsym to GCALIGNMENT.
      The alignment is required on all platforms; it just happens to have
      been properly aligned on the previous platforms we tested.
      288e1fd7
    • Paul Eggert's avatar
      Port Qnil==0 changes to 32-bit --with-wide-int · 29eaf3c8
      Paul Eggert authored
      * lisp.h (lisp_h_XSYMBOL, XSYMBOL): Assume USE_LSB_TAG in the
      macro-implemented version.  For the non-USE_LSB_TAG case, supply
      a new inline function that is the inverse of the new TAG_SYMPTR.
      (lisp_h_XUNTAGBASE, XUNTAGBASE): Remove.  All uses removed.
      (TAG_SYMPTR) [!USE_LSB_TAG]: If the pointer subtraction yields a
      negative number, don't allow sign bits to bleed into the encoded
      value.  Shift in zero bits instead.
      29eaf3c8
  6. 09 Jan, 2015 1 commit
    • Paul Eggert's avatar
      Refactor pointer-to-integer conversion · d1f848ff
      Paul Eggert authored
      * gfilenotify.c (monitor_to_lisp, lisp_to_monitor):
      Rename and move to lisp.h.  All uses changed.
      * lisp.h (XINTPTR, make_pointer_integer): New inline functions,
      which are renamed from gfilenotify.c's lisp_to_monitor and
      monitor_to_lisp, and with more-generic void * signatures.
      d1f848ff
  7. 08 Jan, 2015 3 commits
  8. 05 Jan, 2015 3 commits
    • Paul Eggert's avatar
      * lisp.h (XSYMBOL): Parenthesize id in forward decl. · 6e8fe3f8
      Paul Eggert authored
      Needed when neither optimizing nor inlining.
      Also, sort decls alphabetically.
      6e8fe3f8
    • Paul Eggert's avatar
      Use 0 for Qnil · bc78ff26
      Paul Eggert authored
      Fixes Bug#15880.
      If USE_LSB_TAG, arrange for the representation of Qnil to be zero so
      that NILP (x) is equivalent to testing whether x is 0 at the
      machine level.  The overall effects of this and the previous patch
      shrink the size of the text segment by 2.3% and speeds up
      compilation of all the .elc files by about 0.5% on my platform,
      which is Fedora 20 x86-64.
      * lib-src/make-docfile.c (compare_globals):
      * src/lisp.h (lisp_h_XPNTR, lisp_h_XSYMBOL, lisp_h_XUNTAG)
      (make_lisp_symbol) [USE_LSB_TAG]:
      Symbols now tag the difference from lispsym, not the pointer.
      (lisp_h_XUNTAGBASE, TAG_SYMPTR): New macros.
      (Lisp_Int0, Lisp_Int1, Lisp_Symbol, Lisp_Misc, Lisp_String, Lisp_Cons):
      Renumber so that Lisp_Symbol is 0, so that Qnil is zero.
      (XSYMBOL): New forward decl.
      (XUNTAGBASE): New function.
      (XUNTAG): Use it.
      bc78ff26
    • Paul Eggert's avatar
      Compute C decls for DEFSYMs automatically · 58f2d6ef
      Paul Eggert authored
      Fixes Bug#15880.
      This patch also makes Q constants (e.g., Qnil) constant addresses
      from the C point of view.
      * make-docfile.c: Revamp to generate table of symbols, too.
      Include <stdbool.h>.
      (xstrdup): New function.
      (main): Don't process the same file twice.
      (SYMBOL): New constant in enum global_type.
      (struct symbol): Turn 'value' member into a union, either v.value
      for int or v.svalue for string.  All uses changed.
      (add_global): New arg svalue, which overrides value, so that globals
      can have a string value.
      (close_emacs_global): New arg num_symbols; all uses changed.
      Output lispsym decl.
      (write_globals): Output symbol globals too.  Output more
      ATTRIBUTE_CONST, now that Qnil etc. are C constants.
      Output defsym_name table.
      (scan_c_file): Move most of guts into ...
      (scan_c_stream): ... new function.  Scan for DEFSYMs and
      record symbols found.  Don't read past EOF if file doesn't
      end in newline.
      * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle:
      * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c:
      * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c:
      * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c:
      * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c:
      * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c:
      * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m:
      * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c:
      * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c:
      * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c:
      * xselect.c, xsettings.c, xterm.c:
      Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs).
      These names are now defined automatically by make-docfile.
      * alloc.c (init_symbol): New function.
      (Fmake_symbol): Use it.
      (c_symbol_p): New function.
      (valid_lisp_object_p, purecopy): Use it.
      * alloc.c (marked_pinned_symbols):
      Use make_lisp_symbol instead of make_lisp_ptr.
      (garbage_collect_1): Mark lispsym symbols.
      (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro.
      (mark_object): Use it.
      (sweep_symbols): Sweep lispsym symbols.
      (symbol_uses_obj): New function.
      (which_symbols): Use it.  Work for lispsym symbols, too.
      (init_alloc_once): Initialize Vpurify_flag here; no need to wait,
      since Qt's address is already known now.
      (syms_of_alloc): Add lispsym count to symbols_consed.
      * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0),
      when testing whether storage is all bits zero.
      * dispextern (struct image_type):
      * font.c (font_property_table):
      * frame.c (struct frame_parm_table, frame_parms):
      * keyboard.c (scroll_bar_parts, struct event_head):
      * xdisp.c (struct props):
      Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and
      Lisp_Object *, since Qfoo is no longer an object whose address can be
      taken.  All uses changed.
      * eval.c (run_hook): New function.  Most uses of Frun_hooks changed to
      use it, so that they no longer need to take the address of a Lisp sym.
      (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable.
      * frame.c (syms_of_frame): Add defsyms for the frame_parms table.
      * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here.
      DEFSYM Qdeactivate_mark before the corresponding var.
      * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line
      instead of interning their symbols; this avoids duplicates.
      (LISP_INITIALLY, TAG_PTR)
      (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT):
      New macros.
      (LISP_INITIALLY_ZERO): Use it.
      (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol)
      (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*):
      Move decls up, to avoid forward uses.  Include globals.h earlier, too.
      (make_lisp_symbol): New function.
      (XSETSYMBOL): Use it.
      (DEFSYM): Now just a placeholder for make-docfile.
      * lread.c (DEFINE_SYMBOLS): Define, for globals.h.
      (intern_sym): New function, with body taken from old intern_driver.
      (intern_driver): Use it.  Last arg is now Lisp integer, not ptrdiff_t.
      All uses changed.
      (define_symbol): New function.
      (init_obarray): Define the C symbols taken from lispsym.
      Use plain DEFSYM for Qt and Qnil.
      * syntax.c (init_syntax_once): No need to worry about
      Qchar_table_extra_slots.
      58f2d6ef
  9. 01 Jan, 2015 1 commit
  10. 19 Dec, 2014 1 commit
    • Paul Eggert's avatar
      Minor cleanups for Lisp objects and symbols · ad013ba6
      Paul Eggert authored
      * alloc.c (next_vector, set_next_vector):
      * lisp.h (lisp_h_INTEGERP, make_number, XFASTINT, make_natnum):
      (lisp_h_make_number) [USE_LSB_TAG]:
      Use Lisp_Int0 instead of the mystery constant 0.
      * alloc.c (mark_object): Always set and use po; that's simpler.
      (CHECK_LIVE, CHECK_ALLOCATED_AND_LIVE):
      Properly parenthesize definientia.
      * bidi.c (bidi_initialize):
      * buffer.c (init_buffer_once):
      * nsfns.m (syms_of_nsfns):
      * nsmenu.m (syms_of_nsmenu):
      * nsselect.m (syms_of_nsselect):
      Prefer DEFSYM to defining by hand.
      * data.c: Fix too-long line.
      * lisp.h (DECLARE_GDB_SYM): New macro.
      (DEFINE_GDB_SYMBOL_BEGIN): Use it.
      (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END) [!MAIN_PROGRAM]:
      Declare the symbol, so it's visible to everywhere lisp.h is included.
      Move forward decls as far forward as they can go,
      to allow future changes to use them.
      ad013ba6
  11. 14 Dec, 2014 1 commit
    • Alan Mackenzie's avatar
      New feature optionally to accelerate auto-repeated scrolling. · 37139317
      Alan Mackenzie authored
      src/xdisp.c: Remove "static" from declaration of
      Qfontification_functions.
      
      src/window.c (window_scroll): bind fontification-functions to nil when
      scrolling by whole screens and fast-but-imprecise-scrolling is non-nil.
      (syms_of_window): New DEFVAR_BOOL fast-but-imprecise-scrolling.
      
      src/lisp.h (bool): Declare Qfontification_functions extern.
      
      lisp/cus-start.el (all): Add fast-but-imprecise-scrolling.
      
      doc/emacs/display.texi (Scrolling): fast-but-imprecise-scrolling.
      Describe new variable.
      
      etc/NEWS: Add entry for fast-but-imprecise-scrolling.
      37139317
  12. 30 Nov, 2014 1 commit
    • Paul Eggert's avatar
      Port better to AddressSanitizer. · 3517da70
      Paul Eggert authored
      These changes suffice for temacs on x86-64 with GCC 4.9.2 and
      -fsanitize=address.
      * alloc.c (valid_pointer_p) [ADDRESS_SANITIZER]:
      Return -1 or 0, as the pipe trick doesn't work.
      * alloc.c (relocatable_string_data_p, mark_object, sweep_symbols):
      * data.c (Ffset):
      * print.c (print_object):
      When a pointer-check primitive returns -1, do not assume this
      means the pointer is valid or that the underlying system has failed.
      It could just be that addresses are being sanitized so Emacs can't
      test for pointer validity.
      * lisp.h (defined_GC_CHECK_STRING_BYTES): New constant.
      (USE_STACK_STRING) [GC_CHECK_STRING_BYTES]: Now false, since the
      string validity checker doesn't work on stack-based strings.
      3517da70
  13. 29 Nov, 2014 1 commit
  14. 07 Nov, 2014 1 commit
    • Paul Eggert's avatar
      Uniquify the 'size' symbol. · 0e44a2d2
      Paul Eggert authored
      * frame.c (Qsize):
      * w32notify.c (Qsize): Remove.
      * lisp.h (Qsize): New decl.
      * lread.c (Qsize): Now extern.
      * w32notify.c (syms_of_w32notify): No need to defsym.
      0e44a2d2
  15. 15 Oct, 2014 1 commit
    • Dmitry Antipov's avatar
      Avoid unwanted point motion in Fline_beginning_position. · 0b4d6d30
      Dmitry Antipov authored
      * lisp.h (scan_newline_from_point): Add prototype.
      * search.c (scan_newline_from_point): New function, refactored from...
      * cmds.c (Fforward_line): ...adjusted user.
      * editfns.c (Fline_beginning_position): Use scan_newline_from_point
      and simplify the former since the latter doesn't move point.
      0b4d6d30
  16. 12 Oct, 2014 1 commit
    • Paul Eggert's avatar
      Fix putenv race conditions with undefined behavior. · 4c4c5b91
      Paul Eggert authored
      Do all putenv calls before Emacs creates any threads.
      Use a safer way to modify the TZ environment variable in the
      presence of multiple threads.  For further thread-safety,
      prefer localtime_r and gmtime_r to localtime and gmtime,
      and prefer struct tm's tm_gmtoff (if available) to calling
      both localtime_r and gmtime_r.
      * configure.ac (LOCALTIME_CACHE): Remove.
      We needn't worry about SunOS 4 any more; Sun dropped support in 2003.
      All uses of LOCALTIME_CACHE removed.  This simplifies the fix.
      (tzalloc): Add check for this function.
      * admin/merge-gnulib (GNULIB_MODULES): Add time_r, since Emacs now
      calls localtime_r and gmtime_r directly.
      * src/dbusbind.c (Fdbus__init_bus): Move xputenv call from here ...
      (init_dbusbind): ... to this new function.
      * src/emacs.c (main) [HAVE_DBUS]: Call it before creating threads.
      * src/xterm.c (x_term_init): Move xputenv call from here ...
      (init_xterm): ... to this new function.
      * src/emacs.c (main) [USE_GTK]: Call it before creating threads.
      * src/editfns.c (HAVE_TM_GMTOFF): Default to false.
      (dump_tz_string): New constant.
      (init_editfns): Use it.  This centralizes the dump_tz stuff.
      Call set_time_zone_rule here, so that its xputenv is done
      before Emacs goes multithreaded.
      (mktime_z) [!HAVE_TZALLOC]: New function, which is typically
      thread-safe enough for Emacs.
      (format_time_string, Fdecode_time, Fcurrent_time_string)
      (Fcurrent_time_zone):
      Prefer localtime_r and gmtime_r, which are more thread-safe, to
      localtime and gmtime.  Remove now-unnecessary calls to block_input.
      (tm_gmtoff): New static function.
      (Fdecode_time, Fcurrent_time_zone): Use it.
      (Fencode_time): Use mktime_z, for better thread-safety.
      (set_time_zone_rule): Now static.  Rewrite to be mostly thread-safe,
      i.e., not quite thread-safe but good enough for Emacs typical usage.
      Do not reclaim storage that is in the environment; let it leak.
      Always call tzset, since localtime_r does not.
      * src/emacs.c (dump_tz, Fdump_emacs) [HAVE_TZSET]: Remove dump_tz stuff.
      This is now done in init_editfns.
      * src/systime.h (mktime_z, timezone_t, tzalloc, tzfree) [!HAVE_TZALLOC]:
      New macros and declarations, for platforms lacking tzalloc & friends.
      
      Fixes: debbugs:8705
      4c4c5b91
  17. 09 Oct, 2014 1 commit
  18. 02 Oct, 2014 1 commit
  19. 01 Oct, 2014 1 commit
    • Paul Eggert's avatar
      Use AUTO_CONS instead of SCOPED_CONS, etc. · 27900ac7
      Paul Eggert authored
      * doc/lispref/internals.texi (Stack-allocated Objects):
      Adjust to match the revised, less error-prone macros.
      * src/frame.h (AUTO_FRAME_ARG): Rename from FRAME_PARAMETER.
      * src/lisp.h (AUTO_CONS): Rename from scoped_cons.
      (AUTO_LIST1): Rename from scoped_list1.
      (AUTO_LIST2): Rename from scoped_list2.
      (AUTO_LIST3): Rename from scoped_list3.
      (AUTO_LIST4): Rename from scoped_list4.
      (AUTO_STRING): Rename from SCOPED_STRING.
      * src/frame.h (AUTO_FRAME_ARG):
      * src/lisp.h (AUTO_CONS, AUTO_LIST1, AUTO_LIST2, AUTO_LIST3)
      (AUTO_LIST4, AUTO_STRING):
      Prepend a new argument 'name'.
      Declare a variable instead of yielding a value.
      All uses changed.
      * src/lisp.h (STACK_CONS, AUTO_CONS_EXPR): New internal macros.
      27900ac7
  20. 30 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Simplify stack-allocated Lisp objects, and make them more portable. · dc452569
      Paul Eggert authored
      The build_local_string macro was used in two ways: (1) string
      literals for which scoped allocation suffices, and (2) file name
      components, where it's not safe in general to assume bounded-size
      ASCII data.  Simplify by defining a new macro SCOPED_STRING that
      allocates a block-scope string, and by using SCOPED_STRING for (1)
      and build_string for (2).  Furthermore, actually use stack
      allocation only for objects known to have sufficient alignment.
      This simpler implementation means Emacs can make
      USE_STACK_LISP_OBJECTS the default unless GC_MARK_STACK !=
      GC_MAKE_GCPROS_NOOPS.
      * lisp.h (GCALIGNED): Align even if !USE_STACK_LISP_OBJECTS,
      for fewer differences among implementations.
      (struct Lisp_String): Now GCALIGNED.
      (USE_STACK_LISP_OBJECTS): Default to true, since the
      implementation no longer insists on a nonempty GCALIGNED.
      But make it false if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS.
      (SCOPED_CONS_INITIALIZER): Remove, since it's no longer needed
      separately.  Move definiens to scoped_cons.  The old definition
      was incorrect when GCALIGNED was defined to be empty.
      (union Aligned_String): New type.
      (USE_STACK_CONS, USE_STACK_STRING): New constants, so that the
      implementation ports to compilers that don't align strictly enough.
      Don't worry about the union sizes; it's not worth bothering about.
      (scoped_cons, scoped_list1, scoped_list3, scoped_list4):
      Rewrite using USE_STACK_CONS.
      (scoped_cons): Assume the use of union Aligned_Cons.
      (lisp_string_size, make_local_string, build_local_string): Remove.
      Unless otherwise specified, all callers of build_local_string
      changed to use SCOPED_STRING.
      (SCOPED_STRING): New macro.
      * data.c (wrong_choice):
      * menu.c (single_menu_item):
      * process.c (Fformat_network_address):
      Hoist use of SCOPED_STRING out of a scope, so that its returned
      object lives long enough.
      * fileio.c (Fexpand_file_name): Use build_string, not SCOPED_STRING,
      as the string might be long or might not be ASCII.
      dc452569
  21. 29 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      Keep stack-allocated Lisp objects fast rather than versatile. · 71a72686
      Dmitry Antipov authored
      * configure.ac (HAVE_STATEMENT_EXPRESSIONS): Remove.
      For USE_STACK_LISP_OBJECTS, we always assume __GNUC__.
      * lisp.h (union Aligned_Cons) [!GCALIGNED]: Define as such.
      (SCOPED_CONS_INITIALIZER): New macro.
      (scoped_cons) [USE_STACK_LISP_OBJECTS]: Use it.
      (USE_LOCAL_ALLOCA): Remove.
      (local_cons, local_list1, local_list2, local_list3, local_list4):
      Remove.  Stack overflow checking makes them too slow.
      (make_local_vector): Likewise.  Also we just don't have enough
      users for it.
      (enum LISP_STRING_OVERHEAD): Remove.
      (local_string_init, local_vector_init): Remove prototypes.
      (make_local_string, build_local_string): Redesign to target short
      compile-time string constants, fall back to regular string allocation
      where appropriate.
      (lisp_string_size): New function.
      (verify_ascii) [ENABLE_CHECKING]: Add prototype.
      * alloc.c (local_string_init, local_vector_init): Remove.
      (verify_ascii) [ENABLE_CHECKING]: New function.
      * buffer.c, charset.c, chartab.c, data.c, editfns.c, emacs.c, fileio.c:
      * fns.c, font.c, fontset.c, frame.c, keyboard.c, keymap.c, lread.c:
      * menu.c, minibuf.c, process.c, textprop.c, xdisp.c, xfns.c, xfont.c:
      * xselect.c, xterm.c: All related users changed.
      71a72686
  22. 25 Sep, 2014 4 commits
    • Eli Zaretskii's avatar
      Don't use USE_STACK_LISP_OBJECTS on Windows with GCC older than 4.2. · 686b2196
      Eli Zaretskii authored
       src/lisp.h (USE_STACK_LISP_OBJECTS): Default to false for 32-bit
       MinGW builds that use GCC before 4.2.
      
      Fixes: debbugs:18559
      686b2196
    • Dmitry Antipov's avatar
    • Eli Zaretskii's avatar
      Default to stack objects on DOS_NT platforms as well. · db61bdb1
      Eli Zaretskii authored
       src/w32term.h (ALIGN_STACK) [__GNUC__]: Define to
       __attribute__((force_align_arg_pointer)) for GCC 4.2 and later.
       src/lisp.h (USE_STACK_LISP_OBJECTS): Remove the !DOS_NT condition.
       src/w32proc.c (enum_locale_fn, enum_codepage_fn): Add the
       ALIGN_STACK attribute.
       src/w32fns.c (w32_monitor_enum): Add the ALIGN_STACK attribute.
       src/w32uniscribe.c (add_opentype_font_name_to_list): Add the
       ALIGN_STACK attribute.
       src/w32font.c (add_font_name_to_list, add_font_entity_to_list)
       (add_one_font_entity_to_list): Add the ALIGN_STACK attribute.
      db61bdb1
    • Paul Eggert's avatar
      Fix local_cons etc. to not exhaust the stack when in a loop. · 10381f58
      Paul Eggert authored
      Problem reported in:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00696.html
      * buffer.c (Fother_buffer, other_buffer_safely, init_buffer):
      * charset.c (load_charset_map_from_file, Ffind_charset_region)
      (Ffind_charset_string):
      * chartab.c (uniprop_encode_value_numeric, uniprop_table):
      * data.c (wrong_range):
      * editfns.c (Fpropertize, format2):
      * emacs.c (init_cmdargs, decode_env_path):
      * fileio.c (auto_save_error):
      * fns.c (Fyes_or_no_p):
      * font.c (font_style_to_value, font_parse_xlfd)
      (font_parse_family_registry, font_delete_unmatched)
      (font_add_log):
      * fontset.c (Fset_fontset_font):
      * frame.c (x_get_arg):
      * keyboard.c (echo_dash, safe_run_hooks_error, parse_menu_item)
      (read_char_minibuf_menu_prompt):
      * keymap.c (silly_event_symbol_error, describe_vector):
      * lread.c (load_warn_old_style_backquotes):
      * menu.c (single_menu_item):
      * minibuf.c (Fread_buffer):
      * process.c (status_message, Fformat_network_address)
      (server_accept_connection):
      * textprop.c (copy_text_properties):
      * xdisp.c (Fcurrent_bidi_paragraph_direction):
      * xfns.c (x_default_scroll_bar_color_parameter):
      * xfont.c (xfont_open):
      * xselect.c (x_clipboard_manager_error_1):
      * xterm.c (x_term_init):
      Put USE_LOCAL_ALLOCA at the start of the function.
      * fns.c (maybe_resize_hash_table): Use build_string instead of
      build_local_string, since we'd otherwise need a conditional
      USE_LOCAL_ALLOCA here, but this is just debugging output and is
      not worth the bother of optimization.
      * font.c (font_delete_unmatched): Remove by-hand code that
      observed MAX_ALLOCA limit, since it's now done automatically.
      * keymap.c (Fsingle_key_description): Put USE_SAFE_ALLOCA at top,
      since build_local_string needs its sa_alloc.
      * lisp.h (lisp_word_count): New function.
      (SAFE_ALLOCA_LISP): Use it.
      (USE_LOCAL_ALLOCA): New macro.
      (local_cons, make_local_vector, make_local_string):
      Observe the MAX_ALLOCA limit.
      (LISP_STRING_OVERHEAD): New constant.
      (make_local_string): Use it.
      10381f58
  23. 24 Sep, 2014 3 commits
  24. 23 Sep, 2014 3 commits
    • Paul Eggert's avatar
      * lisp.h (lispstpcpy): Rename from lispstrcpy, and act like stpcpy. · 97914756
      Paul Eggert authored
      All callers changed.
      * xterm.c (x_term_init): Use new functionality to avoid two needs
      to compute a string length.
      97914756
    • Dmitry Antipov's avatar
      Use known length of a Lisp string to copy it faster. · 59e10fbd
      Dmitry Antipov authored
      * lisp.h (lispstrcpy): New function.  Add comment.
      * callproc.c (child_setup):
      * dbusbind.c (xd_append_arg):
      * doc.c (get_doc_string):
      * font.c (Ffont_xlfd_name):
      * frame.c (xrdb_get_resource):
      * process.c (Fmake_network_process, network_interface_info):
      * w32fns.c (Fx_open_connection):
      * w32proc.c (sys_spawnve):
      * xfns.c (select_visual):
      * xfont.c (xfont_list):
      * xsmfns.c (x_session_initialize):
      * xterm.c (x_term_init): Use it.
      59e10fbd
    • Paul Eggert's avatar
      Fix SAFE_ALLOCA to not exhaust the stack when in a loop. · cb8e2bfb
      Paul Eggert authored
      Problem reported by Dmietry Antipov in thread leading to:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00713.html
      This patch fixes only SAFE_ALLOCA, SAFE_NALLOCA, and SAFE_ALLOCA_LISP;
      the experimental local_* macros enabled by USE_LOCAL_ALLOCATORS
      remain unfixed.
      * callproc.c (call_process): Save and restore sa_avail.
      * lisp.h (USE_SAFE_ALLOCA): Define sa_avail.
      (AVAIL_ALLOCA): New macro.
      (SAFE_ALLOCA, SAFE_NALLOCA, SAFE_ALLOCA_LISP):
      Use it, and check against sa_avail rather than MAX_ALLOCA.
      cb8e2bfb
  25. 22 Sep, 2014 1 commit