1. 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
  2. 02 Oct, 2014 1 commit
  3. 30 Sep, 2014 1 commit
  4. 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
  5. 17 Sep, 2014 2 commits
  6. 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
  7. 11 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Spelling fixes. · 0f2ed592
      Paul Eggert authored
      * lisp/ses.el (ses-file-format-extend-parameter-list): Rename from
      ses-file-format-extend-paramter-list.  All uses changed.
      * lisp/gnus-cloud.el (gnus-cloud-parse-version-1): Fix misspelling
      of ":delete".
      0f2ed592
  8. 10 Sep, 2014 2 commits
    • Paul Eggert's avatar
    • 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
  9. 09 Sep, 2014 2 commits
    • Dmitry Antipov's avatar
      Cleanup last change and make all new stuff conditional. · e2588fa5
      Dmitry Antipov authored
      * lisp.h (build_local_string): Rename to ...
      (make_local_string): ... this macro.
      (build_local_string, scoped_list1, scoped_list3): New macros.
      (toplevel) [USE_STACK_LISP_OBJECTS]: Define all new macros
      and functions as such, use regular fallbacks otherwise.
      * alloc.c (verify_alloca) [USE_STACK_LISP_OBJECTS]: Define
      conditionally.
      e2588fa5
    • Dmitry Antipov's avatar
      Add macros to allocate temporary Lisp objects with alloca. · c7dfea94
      Dmitry Antipov authored
      Respect MAX_ALLOCA and fall back to regular GC for large objects.
      * character.h (parse_str_as_multibyte): Move prototype to ...
      * lisp.h (parse_str_as_multibyte): ... here.
      (struct Lisp_Cons): Add GCALIGNED attribute if supported.
      (scoped_cons, scoped_list2, build_local_vector, build_local_string):
      New macros.
      (scoped_cons_init, pointer_valid_for_lisp_object, local_vector_init)
      (local_string_init): New functions.
      * alloc.c (verify_alloca) [ENABLE_CHECKING]: New function.
      (init_alloc_once): Call it.
      c7dfea94
  10. 07 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Use SAFE_ALLOCA etc. to avoid unbounded stack allocation. · b3bf18b3
      Paul Eggert authored
      This follows up on the recent thread in emacs-devel on alloca; see:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00042.html
      This patch also cleans up alloca-related glitches noted while
      examining the code looking for unbounded alloca.
      * alloc.c (listn):
      * callproc.c (init_callproc):
      Rewrite to avoid need for alloca.
      * buffer.c (mouse_face_overlay_overlaps)
      (report_overlay_modification):
      * buffer.h (GET_OVERLAYS_AT):
      * coding.c (make_subsidiaries):
      * doc.c (Fsnarf_documentation):
      * editfns.c (Fuser_full_name):
      * fileio.c (Ffile_name_directory, Fexpand_file_name)
      (search_embedded_absfilename, Fsubstitute_in_file_name):
      * fns.c (Fmake_hash_table):
      * font.c (font_vconcat_entity_vectors, font_update_drivers):
      * fontset.c (fontset_pattern_regexp, Ffontset_info):
      * frame.c (Fmake_terminal_frame, x_set_frame_parameters)
      (xrdb_get_resource, x_get_resource_string):
      * ftfont.c (ftfont_get_charset, ftfont_check_otf, ftfont_drive_otf):
      * ftxfont.c (ftxfont_draw):
      * image.c (xbm_load, xpm_load, jpeg_load_body):
      * keyboard.c (echo_add_key, menu_bar_items, tool_bar_items):
      * keymap.c (Fdescribe_buffer_bindings, describe_map):
      * lread.c (openp):
      * menu.c (digest_single_submenu, find_and_call_menu_selection)
      (find_and_return_menu_selection):
      * print.c (PRINTFINISH):
      * process.c (Fformat_network_address):
      * scroll.c (do_scrolling, do_direct_scrolling, scrolling_1):
      * search.c (search_buffer, Fmatch_data, Fregexp_quote):
      * sound.c (wav_play, au_play):
      * syntax.c (skip_chars):
      * term.c (tty_menu_activate, tty_menu_show):
      * textprop.c (get_char_property_and_overlay):
      * window.c (Fset_window_configuration):
      * xdisp.c (safe__call, next_overlay_change, vmessage)
      (compute_overhangs_and_x, draw_glyphs, note_mouse_highlight):
      * xfaces.c (face_at_buffer_position):
      * xmenu.c (x_menu_show):
      Use SAFE_ALLOCA etc. instead of plain alloca, since the
      allocation size isn't bounded.
      * callint.c (Fcall_interactively): Redo memory_full check
      so that it can be done at compile-time on some platforms.
      * coding.c (MAX_LOOKUP_MAX): New constant.
      (get_translation_table): Use it.
      * callproc.c (call_process): Use SAFE_NALLOCA instead of
      SAFE_ALLOCA, to catch integer overflows on size calculation.
      (exec_failed) [!DOS_NT]: New function.
      (child_setup) [!DOS_NT]: Use it.
      * editfns.c (Ftranspose_regions):
      Hoist USE_SAFE_ALLOC + SAFE_FREE out of 'if'.
      * editfns.c (check_translation):
      Allocate larger buffers on the heap.
      * eval.c (internal_lisp_condition_case):
      Check for MAX_ALLOCA overflow.
      * fns.c (sort_vector): Use SAFE_ALLOCA_LISP rather than Fmake_vector.
      (Fbase64_encode_region, Fbase64_decode_region):
      Avoid unnecessary calls to SAFE_FREE before 'error'.
      * buffer.c (mouse_face_overlay_overlaps):
      * editfns.c (Fget_pos_property, check_translation):
      * eval.c (Ffuncall):
      * font.c (font_unparse_xlfd, font_find_for_lface):
      * ftfont.c (ftfont_drive_otf):
      * keyboard.c (echo_add_key, read_decoded_event_from_main_queue)
      (menu_bar_items, tool_bar_items):
      * sound.c (Fplay_sound_internal):
      * xdisp.c (load_overlay_strings, dump_glyph_row):
      Use an ordinary auto buffer rather than alloca, since the
      allocation size is fixed and small.
      * ftfont.c: Include <c-strcase.h>.
      (matching_prefix): New function.
      (get_adstyle_property): Use it, to avoid need for alloca.
      * keyboard.c (echo_add_key):
      * keymap.c (describe_map): Use ptrdiff_t, not int.
      * keyboard.c (echo_add_key): Prefer sizeof to strlen.
      * keymap.c (Fdescribe_buffer_bindings): Use SBYTES, not SCHARS,
      when counting bytes.
      * lisp.h (xlispstrdupa): Remove, replacing with ...
      (SAFE_ALLOCA_STRING): ... new macro with different API.
      This fixes a portability problem, namely, alloca result
      passed to another function.  All uses changed.
      (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Check for MAX_ALLOCA,
      not MAX_ALLOCA - 1.
      * regex.c (REGEX_USE_SAFE_ALLOCA, REGEX_SAFE_FREE)
      (REGEX_ALLOCATE): New macros.
      (REGEX_REALLOCATE, REGEX_ALLOCATE_STACK, REGEX_REALLOCATE_STACK)
      (REGEX_FREE_STACK, FREE_VARIABLES, re_match_2_internal):
      Use them.
      * xdisp.c (message3): Use SAFE_ALLOCA_STRING rather than doing it
      by hand.
      (decode_mode_spec_coding): Store directly into buf rather than
      into an alloca temporary and copying the temporary to the buf.
      
      Fixes: debbugs:18410
      b3bf18b3
  11. 29 Aug, 2014 1 commit
    • Dmitry Antipov's avatar
      Add vectors support to Fsort. · 1764ec44
      Dmitry Antipov authored
      * configure.ac (AC_CHECK_FUNCS): Check for qsort_r.
      * src/fns.c (sort_vector, sort_vector_compare): New functions.
      (sort_list): Likewise, refactored out of ...
      (Fsort): ... adjusted user.  Mention vectors in docstring.
      (sort_vector_predicate) [!HAVE_QSORT_R]: New variable.
      * src/alloc.c (make_save_int_obj): New function.
      * src/lisp.h (enum Lisp_Save_Type): New member SAVE_TYPE_INT_OBJ.
      (make_save_int_obj): Add prototype.
      * test/automated/fns-tests.el (fns-tests-sort): New test.
      1764ec44
  12. 28 Aug, 2014 1 commit
    • Ken Brown's avatar
      Add support for HYBRID_MALLOC, allowing the use of gmalloc before · ea652500
      Ken Brown authored
      dumping and the system malloc after dumping.  (Bug#18222)
      
      * configure.ac (HYBRID_MALLOC): New macro; define to use gmalloc
      before dumping and the system malloc after dumping.  Define on Cygwin.
      * src/conf_post.h (malloc, realloc, calloc, free) [HYBRID_MALLOC]:
      Define as macros, expanding to hybrid_malloc, etc.
      (HYBRID_GET_CURRENT_DIR_NAME): New macro.
      (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Define as
      macro.
      * src/gmalloc.c: Set up the infrastructure for HYBRID_MALLOC, with a
      full implementation on Cygwin.  Remove Cygwin-specific code that
      is no longer needed.
      (malloc, realloc, calloc, free, aligned_alloc) [HYBRID_MALLOC]:
      Redefine as macros expanding to gmalloc, grealloc, etc.
      (DUMPED, ALLOCATED_BEFORE_DUMPING) [CYGWIN]: New macros.
      (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Undefine.
      (USE_PTHREAD, posix_memalign) [HYBRID_MALLOC]: Don't define.
      (hybrid_malloc, hybrid_calloc, hybrid_free, hybrid_realloc)
      [HYBRID_MALLOC]:
      (hybrid_get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]:
      (hybrid_aligned_alloc) [HYBRID_MALLOC && (HAVE_ALIGNED_ALLOC ||
      HAVE_POSIX_MEMALIGN)]: New functions.
      * src/alloc.c (aligned_alloc) [HYBRID_MALLOC && (ALIGNED_ALLOC ||
      HAVE_POSIX_MEMALIGN)]: Define as macro expanding to
      hybrid_aligned_alloc; declare.
      (USE_ALIGNED_ALLOC) [HYBRID_MALLOC && (ALIGNED_ALLOC ||
      HAVE_POSIX_MEMALIGN)]: Define.
      (refill_memory_reserve) [HYBRID_MALLOC]: Do nothing.
      * src/sysdep.c (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]:
      Define as macro, expanding to gget_current_dir_name, and define
      the latter.
      * src/emacs.c (main) [HYBRID_MALLOC]: Don't call memory_warnings() or
      malloc_enable_thread().  Don't initialize malloc.
      * src/lisp.h (NONPOINTER_BITS) [CYGWIN]: Define (because GNU_MALLOC is
      no longer defined on Cygwin).
      (refill_memory_reserve) [HYBRID_MALLOC]: Don't declare.
      * src/sheap.c (bss_sbrk_buffer_end): New variable.
      * src/unexcw.c (__malloc_initialized): Remove variable.
      * src/ralloc.c: Throughout, treat HYBRID_MALLOC the same as
      SYSTEM_MALLOC.
      * src/xdisp.c (decode_mode_spec) [HYBRID_MALLOC]: Don't check
      	Vmemory_full.
      ea652500
  13. 09 Aug, 2014 1 commit
  14. 26 Jul, 2014 2 commits
    • Paul Eggert's avatar
      Revert previous change. · 9e9f8582
      Paul Eggert authored
      There is certainly nothing wrong with writing code like 'lo <= i
      && i <= hi', even if LO happens to a constant.  There isn't even
      anything wrong in general with writing 'a <= b' if A happens to
      be a constant.  At any rate stylistic changes shouldn't
      be done like this without discussion.
      9e9f8582
    • Andreas Schwab's avatar
      Reorder conditions that are written backwards · 3acf58ee
      Andreas Schwab authored
      * alloc.c (xnmalloc, xnrealloc, xpalloc, make_save_value)
      (Fgarbage_collect): Reorder conditions that are written backwards.
      * data.c (cons_to_unsigned): Likewise.
      * dispnew.c (update_frame_1, sit_for): Likewise.
      * fileio.c (file_offset): Likewise.
      * filelock.c (read_lock_data, lock_file): Likewise.
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      Likewise.
      * font.c (font_intern_prop, font_style_symbolic): Likewise.
      * lisp.h (FIXNUM_OVERFLOW_P): Likewise.
      * lread.c (read1): Likewise.
      * minibuf.c (read_minibuf_noninteractive): Likewise.
      * nsterm.m (x_set_frame_alpha): Likewise.
      * process.c (wait_reading_process_output): Likewise.
      * region-cache.c (delete_cache_boundaries): Likewise.
      * xterm.c (x_set_frame_alpha): Likewise.
      3acf58ee
  15. 11 Jul, 2014 2 commits
    • Dmitry Antipov's avatar
      * src/alloc.c (Fmemory_info) [HAVE_LINUX_SYSINFO]: Return nil if · 3aa96ff5
      Dmitry Antipov authored
      sysinfo failed.  Adjust docstring.
      * doc/lispref/internals.texi (Garbage Collection): Mention memory-info.
      * lisp/files.el (out-of-memory-warning-percentage): New defcustom.
      (warn-maybe-out-of-memory): Use it.
      3aa96ff5
    • Eli Zaretskii's avatar
      Implement memory-info for MS-DOS. · 5f7c30e7
      Eli Zaretskii authored
       src/dosfns.c (dos_memory_info): New function.
       src/dosfns.h (dos_memory_info): Add prototype.
       src/alloc.c (Fmemory_info) [MSDOS]: Call dos_memory_info.
       src/vm-limit.c (get_lim_data) [MSDOS]: Call dos_memory_info, instead
       of doing some of its job.
      5f7c30e7
  16. 10 Jul, 2014 2 commits
  17. 02 Jul, 2014 1 commit
    • Dmitry Antipov's avatar
      Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects. · 477daa5b
      Dmitry Antipov authored
      * lisp.h (struct Lisp_Sub_Char_Table): Use C integers for depth and
      min_char slots.  Adjust comment.
      (enum char_table_specials): Rename from CHAR_TABLE_STANDARD_SLOTS.
      Add SUB_CHAR_TABLE_OFFSET member.
      (make_uninit_sub_char_table): New function.
      * alloc.c (mark_char_table): Add extra argument to denote char table
      subtype.  Adjust to match new layout of sub char-table.
      (mark_object): Always mark sub char-tables with mark_char_table.
      * chartab.c (make_sub_char_table, copy_sub_char_table)
      (sub_char_table_ref, sub_char_table_ref_and_range, sub_char_table_set)
      (sub_char_table_set_range, optimize_sub_char_table, map_sub_char_table)
      (map_sub_char_table_for_charset, uniprop_table_uncompress):
      All related users changed.
      * lread.c (read1): Adjust to match new layout of sub char-table.
      477daa5b
  18. 13 Jun, 2014 1 commit
  19. 11 Jun, 2014 1 commit
  20. 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
  21. 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
  22. 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
  23. 29 May, 2014 1 commit
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 08 Apr, 2014 1 commit
  30. 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