1. 11 Jun, 2014 1 commit
  2. 09 Jun, 2014 1 commit
    • Dmitry Antipov's avatar
      Further adjustments to mark_object and friends. · 2c70e6b0
      Dmitry Antipov authored
      Now the mark_object's stack is just 32 bytes on a 64-bit
      system, which means extra 20% off the stack usage.
      * alloc.c (mark_save_value): As before, refactored out from ...
      (mark_object): ... adjusted user.  Also add comment.
      2c70e6b0
  3. 08 Jun, 2014 1 commit
    • Dmitry Antipov's avatar
      Change object marking routines to minimize stack usage. · 83f14500
      Dmitry Antipov authored
      This change moves a few cold paths from mark_object to NO_INLINE
      functions and adjusts symbol marking loop.  According to GCC 4.8.2
      -Wstack-usage, this reduces mark_object's stack usage from 80 to
      48 bytes on a 64-bit system.  For a long byte-force-recompile runs,
      stack usage at the mark phase is reduced up to 28%.  Surprisingly,
      it also gains up to 3% in speed (with default '-O2 -g3' flags).
      * alloc.c (mark_compiled, mark_localized_symbol): New functions,
      refactored out from ...
      (mark_object): ... adjusted user.  Also mark symbols in a tight
      inner loop.
      (mark_face_cache): Add NO_INLINE.
      83f14500
  4. 30 May, 2014 2 commits
    • Paul Eggert's avatar
      Fix port to 32-bit AIX with xlc. · 1915d8d6
      Paul Eggert authored
      This doesn't fix Bug#17598, but it does fix a regression since Emacs
      built with xlc until recently, and perhaps it'll help us fix Bug#17598.
      * configure.ac (GC_SETJMP_WORKS): Define for AIX, too.
      Merge from gnulib, incorporating:
      2014-05-30 ftoastr: work around compiler bug in IBM xlc 12.1
      * lib/ftoastr.c: Update from gnulib.
      * src/alloc.c (gdb_make_enums_visible): Remove FLOAT_TO_STRING_BUFSIZE.
      * src/conf_post.h (FLEXIBLE_ARRAY_MEMBER) [__IBMC__]: Don't define to empty.
      * src/lisp.h (FLOAT_TO_STRING_BUFSIZE): Make it a macro, instead of an enum,
      to work around a compiler bug in IBM xlc 12.1.
      1915d8d6
    • Dmitry Antipov's avatar
      Debugging facility to check whether 'const char *' points to · 8d3103b1
      Dmitry Antipov authored
      relocatable data of non-pure Lisp string.
      * alloc.c (maybe_lisp_pointer): New function, refactored out of ...
      (mark_maybe_pointer): ... adjusted user.
      (relocatable_string_data_p): New function.
      * lisp.h (relocatable_string_data_p): Add prototype.
      * xdisp.c (message_with_string): If ENABLE_CHECKING, make sure
      the pointer to relocatable Lisp data is not used.
      8d3103b1
  5. 29 May, 2014 1 commit
  6. 24 May, 2014 1 commit
    • Eli Zaretskii's avatar
      Avoid marking too deep portions of stack in mark_stack. · c94e3311
      Eli Zaretskii authored
       src/alloc.c (garbage_collect_1): New function, with all of the guts
       of Fgarbage_collect.
       (mark_stack): Accept an argument END and don't mark Lisp objects
       on the stack beyond the address given by END.  Calculation of END
       was moved to Fgarbage_collect.
       (Fgarbage_collect): Calculate the end address of the stack portion
       that needs to be examined by mark_stack, and pass that address to
       garbage_collect_1, which will pass it to mark_stack. See
       http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00270.html
       for more details about the underlying problems.  In particular,
       this avoids dumping Emacs with the large hash-table whose value is
       held in purify-flag for most of the time loadup.el runs.
      c94e3311
  7. 19 May, 2014 2 commits
    • Paul Eggert's avatar
      Allow any non-nil value to count as true in bool-vector. · 2f1205e0
      Paul Eggert authored
      Likewise for xd_signature in dbusbind.c.
      This is more consistent with the usual practice in Emacs, which is
      that any non-nil value counts as true.
      * doc/lispref/sequences.texi (Bool-Vectors): Coalesce discussion of how to
      print them.  bool-vector's args need not be t or nil.
      * src/alloc.c (Fbool_vector): Don't require args to be t or nil.
      * src/dbusbind.c (xd_signature): Likewise, for booleans.
      * src/data.c, lisp.h (Qbooleanp):
      * src/lisp.h (CHECK_BOOLEAN): Remove.  All uses removed.
      2f1205e0
    • Dmitry Antipov's avatar
      * src/lisp.h (CHECK_BOOLEAN): New function. · 2bcf0551
      Dmitry Antipov authored
      * src/alloc.c (Fbool_vector): New function.
      (syms_of_alloc): Defsubr it.
      * src/data.c (Qbooleanp): New symbol.
      (syms_of_data): DEFSYM it.
      * src/dbusbind.c (xd_signature): Use CHECK_BOOLEAN.
      * doc/lispref/sequences.texi (Bool-vectors): Mention bool-vector.
      2bcf0551
  8. 28 Apr, 2014 2 commits
    • Paul Eggert's avatar
      Use bits_word for gcmarkbits. · 9c23779a
      Paul Eggert authored
      * alloc.c (struct cons_block, struct float_block): On 64-bit hosts,
      bits_word is typically a tad more efficient for mark bits than
      unsigned is, so use bits_word.  All uses changed.
      * lisp.h (BITS_PER_INT): Remove; no longer used.
      9c23779a
    • Paul Eggert's avatar
      Avoid undefined behavior in signed left shift. · 6ab1b16c
      Paul Eggert authored
      This ports to GCC 4.9.0 with -fsanitize=undefined.
      * alloc.c (bool_vector_fill, SETMARKBIT, UNSETMARKBIT):
      * data.c (Fash):
      * regex.c (extract_number):
      * lisp.h (make_number, XINT):
      Do not shift a 1 bit left into a sign bit.
      * alloc.c (struct cons_block, struct float_block): Use unsigned,
      not int, for gcmarkbits.  All uses changed.
      6ab1b16c
  9. 16 Apr, 2014 1 commit
    • Paul Eggert's avatar
      Remove DATA_SEG_BITS. · 5403b2d3
      Paul Eggert authored
      The DATA_SEG_BITS hack was needed for older 32 bit platforms.
      As a result of this change, Emacs won't work on IRIX 6.5 with IRIX
      cc, but that platform is so old that SGI itself stopped supporting
      it in December 2013.  If you still need Emacs on IRIX, please
      either compile with GCC and port the undumping code, or run
      './configure --with-wide-int'.
      * configure.ac (DATA_SEG_BITS): Remove.  All uses removed.
      * src/alloc.c (gdb_make_enums_visible): Update to match lisp.h.
      * src/lisp.h (GCTYPEBITS): Move definition up, and switch to the
      DEFINE_GDB_SYMBOL_START way to define it.
      (NONPOINTER_BITS): New macro.
      (EMACS_INT): Use it.
      [!USE_LSB_TAG && !WIDE_EMACS_INT]: Fail, and suggest reporting
      the problem and/or configuring --with-wide-int.
      (USE_LSB_TAG): Simplify, based on above changes.
      (gdb_DATA_SEG_BITS): Remove.  All uses removed.
      * src/vm-limit.c (exceeds_lisp_ptr): Remove.  All uses removed.
      5403b2d3
  10. 13 Apr, 2014 1 commit
    • Paul Eggert's avatar
      Port to IRIX 6.5. · 13a5993b
      Paul Eggert authored
      This port requires IRIX cc, as I did not have time to get
      undump working with the old GCC on the system I had access to,
      but that's better than nothing.
      * configure.ac (gl_GCC_VERSION_IFELSE): Remove unused macro
      that wouldn't have worked anyway, with IRIX cc.
      (emacs_cv_clang, emacs_cv_sanitize_address)
      (ns_osx_have_104, ns_osx_have_105):
      Don't assume '#error' makes the compiler fail,
      as this doesn't work with IRIX cc.
      (CFLAGS, LIBS): Don't let the GnuTLS results infect later 'configure'
      checks.  This runs afoul of an IRIX configuration where GnuTLS is
      in an optional library that also contains getdelim, and causes
      a later 'configure' to incorrectly think getdelim is supported.
      * src/alloc.c (TAGGABLE_NULL): New constant,
      for porting to hosts with nontrivial DATA_SEG_BITS settings.
      (next_vector, set_next_vector): Use it.
      * src/conf_post.h (INET6) [IRIX6_5]: Define.
      (HAVE_GETADDRINFO) [IRIX6_5]: Undef.
      * src/data.c (BITS_PER_ULL): Don't assume ULLONG_MAX is defined.
      * src/lisp.h (lisp_h_XPNTR): Don't OR in bits that aren't masked out,
      for consistency with how TAGGABLE_NULL is computed.
      
      Fixes: debbugs:9684
      13a5993b
  11. 08 Apr, 2014 1 commit
  12. 07 Apr, 2014 2 commits
    • Paul Eggert's avatar
      * alloc.c: Simplify by removing use of HAVE_EXECINFO_H. · 608a4502
      Paul Eggert authored
      We have a substitute execinfo.h on hosts that lack it.
      (suspicious_free_history): Make it EXTERNALLY_VISIBLE so it
      isn't optimized away.
      608a4502
    • Stefan Monnier's avatar
      * src/alloc.c: Keep track of symbols referenced from pure space (bug#17168). · e3b83880
      Stefan Monnier authored
      (symbol_block_pinned): New var.
      (Fmake_symbol): Initialize `pinned'.
      (purecopy): New function, extracted from Fpurecopy.  Mark symbols as
      pinned and signal an error for un-purifiable objects.
      (pure_cons): Use it.
      (Fpurecopy): Use it, except for objects that can't be purified.
      (mark_pinned_symbols): New function.
      (Fgarbage_collect): Use it.
      (gc_sweep): Remove hack made unnecessary.
      * src/lisp.h (struct Lisp_Symbol): New bitfield `pinned'.
      e3b83880
  13. 05 Apr, 2014 1 commit
    • Paul Eggert's avatar
      Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'. · faa52174
      Paul Eggert authored
      * alloc.c (memory_full):
      * charset.c (syms_of_charset):
      * doc.c (Fsnarf_documentation):
      * emacs.c (main):
      * font.c (BUILD_STYLE_TABLE):
      * keyboard.c (make_lispy_event):
      * profiler.c (setup_cpu_timer):
      * xgselect.c (xg_select):
      * xterm.c (record_event, STORE_KEYSYM_FOR_DEBUG):
      Use ARRAYELTS.
      * font.c (FONT_PROPERTY_TABLE_SIZE): Remove.
      Replace the only use with ARRAYELTS (font_property_table).
      * xfaces.c (DIM): Remove.  All uses replaced by ARRAYELTS.
      faa52174
  14. 03 Apr, 2014 5 commits
  15. 21 Mar, 2014 1 commit
  16. 20 Mar, 2014 1 commit
  17. 28 Feb, 2014 1 commit
    • Paul Eggert's avatar
      Fix a few crashes and leaks when cloning C strings. · 8268febf
      Paul Eggert authored
      * alloc.c, lisp.h (dupstring): New function.
      * gtkutil.c (xg_get_font):
      * term.c (tty_default_color_capabilities):
      * xsettings.c (store_monospaced_changed)
      (store_font_name_changed, parse_settings)
      (read_and_apply_settings, init_gsettings, init_gconf): Use it.
      This avoids some unlikely crashes due to accessing freed storage,
      and avoids some minor memory leaks in the more-typical case.
      8268febf
  18. 20 Jan, 2014 2 commits
  19. 03 Jan, 2014 1 commit
  20. 01 Jan, 2014 1 commit
  21. 26 Dec, 2013 1 commit
    • Paul Eggert's avatar
      Fix core dumps with gcc -fsanitize=address and GNU/Linux. · e76119d7
      Paul Eggert authored
      On my Fedora 19 platform the core dumps were so big that
      my desktop became nearly catatonic.
      * configure.ac: Check whether addresses are sanitized.
      (CANNOT_DUMP): Warn if addresses are sanitized and not CANNOT_DUMP.
      (DOUG_LEA_MALLOC): Do not define if addresses are sanitized.
      (SYSTEM_MALLOC): Define if addresses are sanitized.
      * src/alloc.c (no_sanitize_memcpy) [MAX_SAVE_STACK > 0]: New function.
      (Fgarbage_collect) [MAX_SAVE_STACK > 0]: Use it.
      (USE_ALIGNED_MALLOC): Do not define if addresses are sanitized.
      (mark_memory): Use ATTRIBUTE_NO_SANITIZE_ADDRESS rather than
      a clang-only syntax.
      * src/conf_post.h (__has_feature): New macro, if not already defined.
      (ADDRESS_SANITIZER, ADDRESS_SANITIZER_WORKAROUND)
      (ATTRIBUTE_NO_SANITIZE_ADDRESS): New macros.
      e76119d7
  22. 16 Dec, 2013 1 commit
    • Dmitry Antipov's avatar
      * font.c (valid_font_driver) [ENABLE_CHECKING]: New function · 5ae356d9
      Dmitry Antipov authored
      intended to find bogus pointers in font objects (Bug#16140).
      * font.h (valid_font_driver) [ENABLE_CHECKING]: Add prototype.
      * alloc.c (cleanup_vector): Use valid_font_driver in eassert.
      (compact_font_cache_entry, compact_font_caches) [!HAVE_NTGUI]:
      Disable for MS-Windows due to Bug#15876; apparently this
      requires more or less substantial changes in fontset code.
      * xfont.c (xfont_close):
      * xftfont.c (xftfont_close): Call x_display_info_for_display
      to check whether 'Display *' is valid (Bug#16093 and probably
      Bug#16069).
      5ae356d9
  23. 14 Dec, 2013 3 commits
  24. 13 Dec, 2013 1 commit
  25. 12 Dec, 2013 1 commit
    • Dmitry Antipov's avatar
      * font.h (struct font_entity) [HAVE_NS]: New field to record · cf86e18b
      Dmitry Antipov authored
      font driver which was used to create this entity.
      (struct font) [HAVE_WINDOW_SYSTEM]: New field to record
      frame where the font was opened.
      (font_close_object): Add prototype.
      * font.c (font_make_entity) [HAVE_NS]: Zero out driver field.
      (font_close_object): Not static any more.  Lost frame arg.
      Adjust comment and users.
      * alloc.c (cleanup_vector): Call font_close_object to adjust
      per-frame font counters correctly.  If HAVE_NS, also call
      driver-specific cleanup for font-entity objects.
      * ftfont.c (ftfont_open):
      * nsfont.m (nsfont_open):
      * w32font.c (w32font_open_internal):
      * xfont.c (xfont_open):
      * xftfont.c (xftfont_open): Save frame pointer in font object.
      * macfont.m (macfont_open): Likewise.
      (macfont_descriptor_entity): Save driver pointer to be able
      to call its free_entity routine when font-entity is swept.
      * ftxfont.c (ftxfont_open): Add eassert because frame
      pointer should be saved by ftfont_driver.open.
      cf86e18b
  26. 09 Dec, 2013 1 commit
  27. 01 Dec, 2013 1 commit
  28. 29 Nov, 2013 1 commit
    • Stefan Monnier's avatar
      * configure.ac (HAVE_MENUS): Remove. · 7cdf484b
      Stefan Monnier authored
      * src/xmenu.c (Fmenu_or_popup_active_p):
      * src/window.c (Fset_window_configuration):
      * src/menu.c (Fx_popup_menu, Fx_popup_dialog):
      * src/keyboard.c (record_menu_key, read_char_x_menu_prompt):
      * src/fns.c (Fyes_or_no_p):
      * src/editfns.c (Fmessage_box, Fmessage_or_box):
      * src/alloc.c (make_save_ptr_ptr):
      * src/xdisp.c, src/w32menu.c, src/term.c, src/xterm.h, src/xterm.c:
      Remove HAVE_MENUS.
      7cdf484b
  29. 28 Nov, 2013 1 commit
    • Stefan Monnier's avatar
      Refine redisplay optimizations to only redisplay *some* frames/windows · 655ab9a3
      Stefan Monnier authored
      rather than all of them.
      * src/xdisp.c (REDISPLAY_SOME): New constant.
      (redisplay_other_windows, wset_redisplay, fset_redisplay)
      (bset_redisplay, bset_update_mode_line): New functions.
      (message_dolog): Use bset_redisplay.
      (clear_garbaged_frames): Use fset_redisplay.
      (echo_area_display): Use wset_redisplay.
      (buffer_shared_and_changed): Remove.
      (prepare_menu_bars): Call Vpre_redisplay_function before updating
      frame titles.  Compute the actual set of windows redisplayed.
      Don't update frame titles and menu bars for frames that don't need to
      be redisplayed.
      (propagate_buffer_redisplay): New function.
      (AINC): New macro.
      (redisplay_internal): Use it.  Be more selective in the set of windows
      we redisplay.  Propagate windows_or_buffers_changed to
      update_mode_lines a bit later to simplify the code.
      (mark_window_display_accurate_1): Reset window and buffer's
      `redisplay' flag.
      (redisplay_window): Do nothing if neither the window nor the buffer nor
      the frame needs redisplay.
      * src/window.h (struct window): Add `redisplay' field.
      (wset_redisplay, fset_redisplay, bset_redisplay, bset_update_mode_line)
      (redisplay_other_windows, window_list): New declarations.
      * src/window.c (select_window, Fset_window_start): Use wset_redisplay.
      (window_list): Not static any more.
      (grow_mini_window, shrink_mini_window): Use fset_redisplay.
      * src/minibuf.c (read_minibuf_unwind): Don't redisplay everything.
      * src/insdel.c (prepare_to_modify_buffer_1): Use bset_redisplay.
      * src/frame.c (Fmake_frame_visible): Don't redisplay everything.
      * src/frame.h (struct frame): Add `redisplay' field.
      Move `external_menu_bar' bitfield next to other bit-fields.
      (SET_FRAME_GARBAGED): Use fset_redisplay.
      (SET_FRAME_VISIBLE): Don't garbage the frame;
      Use redisplay_other_windows.
      * src/buffer.h (struct buffer): Add `redisplay' field.
      * src/buffer.c (Fforce_mode_line_update): Pay attention to the `all' flag.
      (modify_overlay): Use bset_redisplay.
      * src/alloc.c (gc_sweep): Don't unmark strings while sweeping symbols.
      
      * lisp/doc-view.el (doc-view-goto-page): Update mode-line.
      655ab9a3