1. 08 Jan, 2015 1 commit
  2. 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
  3. 01 Jan, 2015 1 commit
  4. 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
  5. 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
  6. 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
  7. 29 Nov, 2014 1 commit
  8. 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
  9. 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
  10. 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
  11. 09 Oct, 2014 1 commit
  12. 02 Oct, 2014 1 commit
  13. 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
  14. 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
  15. 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
  16. 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
  17. 24 Sep, 2014 3 commits
  18. 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
  19. 22 Sep, 2014 1 commit
  20. 21 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Minor improvements to new stack-allocated Lisp objects. · f135e94e
      Paul Eggert authored
      * 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.
      f135e94e
  21. 18 Sep, 2014 3 commits
    • Dmitry Antipov's avatar
      More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS. · 3cab7dd4
      Dmitry Antipov authored
      * lisp.h (local_list4) [USE_LOCAL_ALLOCATORS]: New macro.
      [!USE_LOCAL_ALLOCATORS]: Fall back to regular list4.
      * frame.h (FRAME_PARAMETER): New macro.
      * dispnew.c (init_display):
      * fontset.c (Fset_fontset_font):
      * frame.c (x_default_parameter):
      * xfaces.c (set_font_frame_param, Finternal_merge_in_global_face):
      * xfns.c (x_default_scroll_bar_color_parameter)
      (x_default_font_parameter, x_create_tip_frame): Use it.
      * editfns.c (Fpropertize): Use local_cons.
      * process.c (status_message): Use build_local_string.
      * xfont.c (xfont_open): Use make_local_string.
      * xdisp.c (build_desired_tool_bar_string): Use local_list4.
      3cab7dd4
    • Paul Eggert's avatar
      Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. · e8be4f44
      Paul Eggert authored
      Revert previous lisp.h change, and install the following instead.
      * lisp.h (USE_LOCAL_ALLOCATORS): Define only if __GNUC__ &&
      !__clang__.  This works with GCC and with clang and is safer for
      compilers we don't know about.
      e8be4f44
    • Paul Eggert's avatar
      Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. · bb95ed98
      Paul Eggert authored
      * lisp.h (ALLOCA_FIXUP): New constant.
      (LOCAL_ALLOCA): New macro.
      (local_cons, make_local_vector, make_local_string): Use them.
      (local_cons): Rename parameter to make capture less likely.
      bb95ed98
  22. 17 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Fix minor problems found by static checking. · 9356a872
      Paul Eggert authored
      * alloc.c, lisp.h (SAVE_TYPE_INT_OBJ, make_save_int_obj):
      Remove; now unused.
      * buffer.h (decode_buffer): Doc and indentation fixes.
      * fns.c (Qstring_collate_lessp, Qstring_collate_equalp): Now static.
      9356a872
  23. 16 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      Always use matched specpdl entry to record call arguments (Bug#18473). · ccb767d6
      Dmitry Antipov authored
      * lisp.h (record_in_backtrace): Adjust prototype.
      * eval.c (record_in_backtrace): Return current specpdl level.
      (set_backtrace_args, set_backtrace_nargs): Merge.  Adjust all users.
      (eval_sub, Ffuncall): Record call arguments in matched specpdl
      entry and use that entry in call to backtrace_debug_on_exit.
      (apply_lambda): Likewise.  Get current specpdl level as 3rd arg.
      (do_debug_on_call): Get current specpdl level as 2nd arg.
      ccb767d6
  24. 15 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack. · edb0288b
      Dmitry Antipov authored
      * lisp.h (local_cons, local_list1, local_list2, local_list3)
      [USE_LOCAL_ALLOCATORS]: New macros.
      [!USE_LOCAL_ALLOCATORS]: Fall back to regular functions.
      (build_local_string): Avoid argument name expansion clash with
      make_local_string.
      * alloc.c (toplevel)
      [USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]:
      Preprocessor guard to avoid impossible configuration.
      * charset.c (Ffind_charset_region, Ffind_charset_string):
      Use make_local_vector.
      * lread.c (read1, substitute_object_recurse): Use scoped_cons.
      * textprop.c (Fput_text_property, Fadd_face_text_property):
      Use scoped_list2.
      (copy_text_properties): Use local_cons and local_list3.
      * chartab.c (uniprop_table):
      * data.c (wrong_choice, wrong_range):
      * doc.c (get_doc_string):
      * editfns.c (format2):
      * fileio.c (Fexpand_file_name, auto_save_error):
      * fns.c (Fyes_or_no_p):
      * font.c (font_parse_xlfd, font_parse_family_registry, font_add_log):
      * fontset.c (Fset_fontset_font):
      * keyboard.c (echo_add_key, echo_dash, parse_menu_item)
      (read_char_minibuf_menu_prompt):
      * keymap.c (silly_event_symbol_error, describe_vector):
      * menu.c (single_menu_item):
      * minibuf.c (Fread_buffer):
      * process.c (status_message, Fformat_network_address)
      (server_accept_connection): Use make_local_string and
      build_local_string.  Prefer compound literals where appropriate.
      edb0288b
  25. 11 Sep, 2014 2 commits
  26. 10 Sep, 2014 3 commits
    • Paul Eggert's avatar
      Simplify lisp.h by removing the __COUNTER__ business. · d1bed1f7
      Paul Eggert authored
      Problem reported by Dmitry Antipov in:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00220.html
      * lisp.h (make_local_vector, make_local_string)
      (build_local_string): Simplify by not bothering with __COUNTER__.
      The __COUNTER__ business wasn't working properly, and was needed
      only for hypothetical future expansion anyway.
      d1bed1f7
    • Paul Eggert's avatar
      * lisp.h (DEFINE_GDB_SYMBOL_ENUM): Remove. · c9c0610d
      Paul Eggert authored
      These can generate a constant with the correct value but the wrong
      width, which doesn't work as a printf argument.  All uses removed.
      Problem reported by Dmitry Antipov in:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00213.html
      (ENUMABLE): Remove; no longer needed.
      (ARRAY_MARK_FLAG_val, PSEUDOVECTOR_FLAG_val, VALMASK_val):
      Remove; no longer needed because of the above change.
      Each definiens moved to the only use.
      c9c0610d
    • Paul Eggert's avatar
      Improve the experimental local and scoped allocation. · 11e28ab0
      Paul Eggert authored
      * configure.ac (HAVE_STRUCT_ATTRIBUTE_ALIGNED)
      (HAVE_STATEMENT_EXPRESSIONS): New configure-time checks.
      * src/alloc.c (local_string_init, local_vector_init):
      New functions, defined if USE_LOCAL_ALLOCATORS.
      Mostly, these are moved here from lisp.h, as it's not
      clear it's worth making them inline.
      * src/lisp.h (USE_STACK_LISP_OBJECTS): Default to false.
      (GCALIGNED): Depend on HAVE_STRUCT_ATTRIBUTE_ALIGNED and
      USE_STACK_LISP_OBJECTS, not on a laundry list.
      (local_string_init, local_vector_init): New decls.
      (union Aligned_Cons): New type.
      (scoped_cons): Use it.  Give up on the char trick, as it's a too
      much of a maintenance hassle; if someone wants this speedup
      they'll just need to convince their compiler to align properly.
      Conversely, use the speedup if struct Lisp_Cons happens to
      be aligned even without a directive.  Better yet, help it along
      by using union Aligned_Cons rather than struct Lisp_Cons.
      (pointer_valid_for_lisp_object): Remove.  This check is not
      necessary, since make_lisp_ptr is already doing it.  All uses removed.
      (local_vector_init, local_string_init): Move to alloc.c.
      (build_local_vector): Remove this awkward macro, replacing with ...
      (make_local_vector): New macro, which acts more like a function.
      Use statement expressions and use __COUNTER__ to avoid macro
      capture.  Fall back on functions if these features are not supported.
      (build_local_string, make_local_string): Likewise.
      11e28ab0