1. 28 Aug, 2016 1 commit
    • Paul Eggert's avatar
      Memory allocator alignment fixes · 7fcce24e
      Paul Eggert authored
      These changes remove some assumptions about heap allocator
      alignment that may not be true on unusual platforms.
      * src/alloc.c (POWER_OF_2): New macro.
      (ROUNDUP): Use it.
      (BLOCK_ALIGN): Verify that it is a power of 2.
      (aligned_alloc): Check that alignment passed to posix_memalign
      satisfies POSIX restrictions.
      (lisp_align_malloc): Check that size passed to aligned_alloc
      satisfies C11 restrictions.
      (MALLOC_IS_GC_ALIGNED): Check that GCALIGNMENT is 8, since the
      code has not been verified to work with other GCALIGNMENT values
      and the ice is thin here.  On GNU/Linux, malloc can return a value
      that is a multiple of 8 but not 16, even though __alignof__
      (max_align_t) is 16.  See:
      https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01902.html
      (lmalloc) [USE_ALIGNED_ALLOC]: Use aligned_alloc only if size
      is a multiple of alignment, since C11 says the behavior is
      undefined otherwise.
      (lmalloc, lrealloc): Don't use INT_ADD_WRAPV on size_t, as in
      general this macro is restricted to signed types.  Remove
      assertion that the result is a multiple of GCALIGNMENT, as that
      need not be true.
      7fcce24e
  2. 09 Aug, 2016 1 commit
    • Paul Eggert's avatar
      Remove interpreter’s byte stack · 644fc17b
      Paul Eggert authored
      This improves performance overall on my benchmark on x86-64,
      since the interpreted program-counter resides in a machine
      register rather than in RAM.
      * etc/DEBUG, src/.gdbinit: Remove xbytecode GDB command, as there
      is no longer a byte stack to decode.
      * src/bytecode.c (struct byte_stack, byte_stack_list)
      (relocate_byte_stack): Remove.  All uses removed.
      (FETCH): Simplify now that pc is now local (typically, in a
      register) and no longer needs to be relocated.
      (CHECK_RANGE): Remove.  All uses now done inline, in a different way.
      (BYTE_CODE_QUIT): Remove; now done by op_relative_branch.
      (exec_byte_code): Allocate a copy of the function’s bytecode,
      so that there is no problem if GC moves it.
      * src/lisp.h (struct handler): Remove byte_stack member.
      All uses removed.
      (SAFE_ALLOCA_LISP_EXTRA): New macro, a generalization of
      SAFE_ALLOCA_LISP.
      (SAFE_ALLOCA_LISP): Use it.
      644fc17b
  3. 02 Jul, 2016 1 commit
    • Eli Zaretskii's avatar
      Rename FACE_OPT_FROM_ID to FACE_FROM_ID_OR_NULL · 55d38fc8
      Eli Zaretskii authored
      * src/dispextern.h (FACE_FROM_ID_OR_NULL): Renamed from
      FACE_OPT_FROM_ID; all callers changed.
      * src/xdisp.c (extend_face_to_end_of_line): Call FACE_FROM_ID, not
      FACE_FROM_ID_OR_NULL, as the resulting face is immediately
      dereferenced.
      (fill_gstring_glyph_string): Call FACE_FROM_ID, not
      FACE_FROM_ID_OR_NULL, as the resulting face will be dereferenced
      when the glyph string is drawn.
      (BUILD_COMPOSITE_GLYPH_STRING): Call FACE_FROM_ID, not
      FACE_FROM_ID_OR_NULL, as the resulting face will be dereferenced
      in fill_composite_glyph_string.
      (calc_line_height_property): Call FACE_FROM_ID_OR_NULL rather that
      FACE_FROM_ID, since the function and its caller can cope with that
      situation.  Conflate 3 tests of missing face or font into just
      one.
      * src/xfaces.c (Fx_list_fonts, Fface_font, lookup_face): Call
      FACE_FROM_ID_OR_NULL rather that FACE_FROM_ID, since these
      functions can cope with that situation.
      (lookup_derived_face): Don't call FACE_FROM_ID if the result will
      not be used.
      * src/w32console.c (w32_face_attributes): Remove redundant 'eassert'.
      55d38fc8
  4. 20 Jun, 2016 1 commit
    • Paul Eggert's avatar
      Minor ABLOCKS_BUSY cleanups in alloc.c · 9341142d
      Paul Eggert authored
      * src/alloc.c (ABLOCKS_BUSY): Rename arg to avoid potential clash
      with member ‘abase’ in definiens.
      (lisp_align_malloc, lisp_align_free): Use bool for boolean.
      Avoid compiler warning with fewer casts.
      (lisp_align_free): Check busy-field values; this can help the
      compiler a bit when optimizing, too.
      9341142d
  5. 19 Jun, 2016 1 commit
  6. 14 Jun, 2016 1 commit
  7. 11 Jun, 2016 1 commit
    • Paul Eggert's avatar
      Catch malloc_get_state, malloc_set_state failure · b4788b93
      Paul Eggert authored
      This should help insulate Emacs better from configuration screwups.
      Future versions of the GNU C library are planned to deprecate
      these functions, but will continue to support them in
      already-built-and-dumped Emacs executables.
      * src/alloc.c (malloc_initialize_hook) [DOUG_LEA_MALLOC]:
      Abort if malloc_set_state fails.
      (alloc_unexec_pre) [DOUG_LEA_MALLOC]:
      Report malloc_get_state failure, and exit.
      b4788b93
  8. 18 May, 2016 1 commit
    • Paul Eggert's avatar
      Port --enable-gcc-warnings to GCC 6.1 · 374f6a5f
      Paul Eggert authored
      * configure.ac (WERROR_CFLAGS): Omit -Wunused-const-variable=2.
      * lib-src/etags.c (LOOKING_AT, LOOKING_AT_NOCASE):
      Omit test whether pointer plus a constant equals a null pointer.
      * src/alloc.c (compact_small_strings):
      Avoid pointer arithmetic on null pointers.
      * src/alloc.c (mark_face_cache):
      * src/fontset.c (free_realized_fontsets, Fset_fontset_font):
      * src/fringe.c (draw_fringe_bitmap_1)
      (Fset_fringe_bitmap_face):
      * src/macfont.m (macfont_draw):
      * src/msdos.c (IT_set_face, IT_clear_screen):
      * src/nsfont.m (nsfont_draw):
      * src/nsterm.h (FRAME_DEFAULT_FACE):
      * src/nsterm.m (ns_draw_window_cursor)
      (ns_draw_vertical_window_border, ns_draw_window_divider)
      (ns_dumpglyphs_box_or_relief)
      (ns_maybe_dumpglyphs_background, ns_dumpglyphs_image)
      (ns_dumpglyphs_stretch):
      * src/w32term.c (w32_draw_vertical_window_border)
      (w32_draw_window_divider, x_set_mouse_face_gc):
      * src/xdisp.c (estimate_mode_line_height, init_iterator)
      (handle_face_prop, handle_single_display_spec, pop_it)
      (CHAR_COMPOSED_P, get_next_display_element)
      (next_element_from_display_vector, extend_face_to_end_of_line)
      (fill_gstring_glyph_string,BUILD_COMPOSITE_GLYPH_STRING):
      * src/xfaces.c (Finternal_merge_in_global_face, Fface_font)
      (lookup_named_face):
      * src/xterm.c (x_draw_vertical_window_border)
      (x_draw_window_divider, x_set_mouse_face_gc):
      Prefer FACE_OPT_FROM_ID to FACE_FROM_ID when the result might be null.
      * src/xterm.c (try_window_id):
      Redo loop to convince GCC 6.1 that it is null pointer safe.
      (x_color_cells):
      Use eassume as necessary to pacify GCC 6.1.
      * src/dispextern.h (FACE_FROM_ID, IMAGE_FROM_ID): Now returns non-null.
      (FACE_OPT_FROM_ID, IMAGE_OPT_FROM_ID): New macro, with the old
      behavior of the non-_OPT macro, to be used when the result
      might be a null pointer.
      * src/dispnew.c (buffer_posn_from_coords, marginal_area_string)
      [HAVE_WINDOW_SYSTEM]:
      * src/intervals.h (INTERVAL_WRITABLE_P):
      * src/term.c (turn_off_face):
      * src/xdisp.c (get_glyph_face_and_encoding, fill_image_glyph_string)
      (produce_image_glyph, produce_xwidget_glyph):
      * src/xfaces.c (lookup_named_face):
      Remove unnecessary test for null pointer.
      * src/keyboard.c (read_char): Suppress bogus -Wclobbered warning.
      * src/process.c (would_block): New function.
      (server_accept_connection, wait_reading_process_output, send_process):
      Use it.
      * src/xdisp.c (get_window_cursor_type, note_mouse_highlight):
      Prefer IMAGE_OPT_FROM_ID to IMAGE_FROM_ID when the result
      might be null.
      374f6a5f
  9. 04 Apr, 2016 1 commit
    • Paul Eggert's avatar
      New C macro AUTO_STRING_WITH_LEN · 17cb263a
      Paul Eggert authored
      Put a bit less pressure on the garbage collector by defining a
      macro that is like AUTO_STRING but also allows null bytes in strings,
      and by extending AUTO_STRING to work with any unibyte string.
      * src/alloc.c (verify_ascii): Remove; all uses removed.
      AUTO_STRING can now be used on non-ASCII unibyte strings.
      * src/lisp.h (AUTO_STRING): Now allows non-ASCII unibyte strings.
      (AUTO_STRING_WITH_LEN): New macro.
      * src/coding.c (from_unicode_buffer):
      * src/editfns.c (format_time_string):
      * src/emacs-module.c (module_make_string, module_format_fun_env):
      * src/fileio.c (Fexpand_file_name):
      * src/font.c (font_parse_family_registry):
      * src/ftfont.c (ftfont_get_charset):
      * src/keymap.c (silly_event_symbol_error):
      * src/menu.c (single_menu_item):
      * src/sysdep.c (system_process_attributes):
      Use AUTO_STRING_WITH_LEN if possible.
      * src/emacs-module.c (module_make_function):
      * src/fileio.c (report_file_errno, report_file_notify_error):
      * src/fns.c (Flocale_info):
      * src/sysdep.c (system_process_attributes):
      Use AUTO_STRING if possible.  This is doable more often now
      that AUTO_STRING works on any unibyte string.
      17cb263a
  10. 27 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Rename C names to match Lisp symbols better · f41f573e
      Paul Eggert authored
      This was inspired by commit e65c3079,
      which fixed a bug where the C name for a symbol disagreed with the
      symbol name itself.  Fix other instances of disagreements that I found.
      Although this doesn’t fix a bug, it should make code easier to follow.
      The remaining disagreements are idiosyncratic: Qminus, Qplus,
      Qsans__serif, Qbackquote, Qcomma, Qcomma_at, Qcomma_dot.
      All uses changed.
      * src/alloc.c (QAutomatic_GC): Rename from Qautomatic_gc.
      * src/dbusbind.c (QCsystem): Rename from QCdbus_system_bus.
      (QCsession): Rename from QCdbus_session_bus.
      (QCtimeout): Rename from QCdbus_timeout.
      (QCbyte): Rename from QCdbus_type_byte.
      (QCboolean): Rename from QCdbus_type_boolean.
      (QCint16): Rename from QCdbus_type_int16.
      (QCuint16): Rename from QCdbus_type_uint16.
      (QCint32): Rename from QCdbus_type_int32.
      (QCuint32): Rename from QCdbus_type_uint32.
      (QCint64): Rename from QCdbus_type_int64.
      (QCuint64): Rename from QCdbus_type_uint64.
      (QCdouble): Rename from QCdbus_type_double.
      (QCstring): Rename from QCdbus_type_string.
      (QCobject_path): Rename from QCdbus_type_object_path.
      (QCsignature): Rename from QCdbus_type_signature.
      (QCunix_fd): Rename from QCdbus_type_unix_fd.
      (QCarray): Rename from QCdbus_type_array.
      (QCvariant): Rename from QCdbus_type_variant.
      (QCstruct): Rename from QCdbus_type_struct.
      (QCdict_entry): Rename from QCdbus_type_dict_entry.
      (QCserial): Rename from QCdbus_registered_serial.
      (QCmethod): Rename from QCdbus_registered_method.
      (QCsignal): Rename from QCdbus_registered_signal.
      * src/emacs-module.c (Qinternal__module_call):
      Rename from Qinternal_module_call.
      * src/frame.c (Qwindow__pixel_to_total):
      Rename from Qwindow_pixel_to_total.
      * src/gnutls.c (QChostname): Rename from QCgnutls_bootprop_hostname.
      (QCpriority): Rename from QCgnutls_bootprop_priority.
      (QCtrustfiles): Rename from QCgnutls_bootprop_trustfiles.
      (QCkeylist): Rename from QCgnutls_bootprop_keylist.
      (QCcrlfiles): Rename from QCgnutls_bootprop_crlfiles.
      (QCmin_prime_bits): Rename from QCgnutls_bootprop_min_prime_bits.
      (QCloglevel): Rename from QCgnutls_bootprop_loglevel.
      (QCcomplete_negotiation): Rename from QCgnutls_complete_negotiation.
      (QCverify_flags): Rename from QCgnutls_bootprop_verify_flags.
      (QCverify_error): Rename from QCgnutls_bootprop_verify_error.
      * src/w32fns.c (Qfont_parameter): Rename from Qfont_param.
      (Qgnutls): Rename from Qgnutls_dll.
      (Qlibxml2): Rename from Qlibxml2_dll.
      (Qzlib): Rename from Qzlib_dll.
      * src/w32select.c (Qutf_16le_dos): Rename from QUNICODE.
      * src/window.c (Qwindow__resize_root_window):
      Rename from Qwindow_resize_root_window.
      (Qwindow__resize_root_window_vertically):
      Rename from Qwindow_resize_root_window_vertically.
      (Qwindow__sanitize_window_sizes):
      Rename from Qwindow_sanitize_window_sizes.
      (Qwindow__pixel_to_total): Rename from Qwindow_pixel_to_total.
      * src/xdisp.c (Qredisplay_internal_xC_functionx):
      Rename from Qredisplay_internal.
      * src/xfns.c (Qfont_parameter): Rename from Qfont_param.
      * src/xselect.c (Q_EMACS_TMP_): Rename from QEMACS_TMP.
      f41f573e
  11. 24 Mar, 2016 1 commit
  12. 20 Mar, 2016 1 commit
  13. 10 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Rework C source files to avoid ^( · 7352c6c6
      Paul Eggert authored
      Work around Bug#22884 by rewording comments and strings to avoid ‘(’
      at the start of a line unless it starts a function.  This change
      is a short-term hack; in the longer run we plan to fix cc-mode’s
      performance for C files that have ‘(’ at the start of a line in a
      comment or string.
      7352c6c6
  14. 09 Feb, 2016 3 commits
  15. 08 Feb, 2016 1 commit
  16. 05 Feb, 2016 2 commits
    • Paul Eggert's avatar
      Omit XLI (init) == 0 optimization in make-vector · 13005688
      Paul Eggert authored
      * src/alloc.c (Fmake_vector): Simplify by omitting the (XLI (init)
      == 0) case, as this optimization is probably not worth the hassle.
      Just for the record, the test for that case could have been
      (XLI (init) % ((EMACS_UINT) -1 / UCHAR_MAX) == 0) (!),
      assuming the typical platform with no padding bits and where
      conversion to int omits the most significant bits.
      13005688
    • Paul Eggert's avatar
      Prefer memcpy and memset to doing it by hand · 605f9019
      Paul Eggert authored
      * src/alloc.c (Fmake_vector):
      * src/ccl.c (setup_ccl_program):
      Use memset to clear array.
      * src/alloc.c (Fvector, Fmake_byte_code):
      * src/charset.c (Fdefine_charset_internal):
      Use memcpy to copy array.
      605f9019
  17. 04 Feb, 2016 1 commit
    • Paul Eggert's avatar
      Simplify USE_ALIGNED_ALLOC · 0815944a
      Paul Eggert authored
      * src/alloc.c (USE_ALIGNED_ALLOC): Simplify, now that we’ve merged
      in the emacs-25 changes.  Omit no-longer-needed decl for aligned_alloc.
      0815944a
  18. 02 Feb, 2016 1 commit
  19. 31 Jan, 2016 2 commits
    • John Wiegley's avatar
      Correct reference to DARWIN_OS preprocessor symbol · 98bdbdbe
      John Wiegley authored
      * src/alloc.c: Correct a preprocessor reference to DARWIN_OS, which may
        not be defined.
      98bdbdbe
    • Paul Eggert's avatar
      Pacify GCC on C library without glibc API · 93b144bb
      Paul Eggert authored
      Without this change, with --enable-gcc-warnings GCC would complain
      “error: redundant redeclaration of ‘aligned_alloc’”.
      * configure.ac: Simplify aligned_alloc testing.
      * src/alloc.c (aligned_alloc): Don’t use if DARWIN_OS,
      since the simplified configure.ac no longer checks for that.
      Don’t declare if HAVE_ALIGNED_ALLOC.
      Correct misspelling of HAVE_ALIGNED_ALLOC in ifdef.
      93b144bb
  20. 30 Jan, 2016 4 commits
    • Paul Eggert's avatar
      Fix extern symbols defined and not used · 3d82a8ee
      Paul Eggert authored
      * src/alloc.c: Always include <signal.h>.
      (malloc_warning) [!SIGDANGER && (SYSTEM_MALLOC || HYBRID_MALLOC)]:
      Do not define; unused.
      * src/emacs.c, src/lisp.h (might_dump) [!DOUG_LEA_MALLOC]: Now static.
      * src/gmalloc.c (gdefault_morecore): Rename from __default_morecore,
      to avoid collision with glibc.  Now static.  All uses changed.
      * src/lastfile.c (my_edata): Define only if
      ((!defined SYSTEM_MALLOC && !defined HYBRID_MALLOC && !defined
      WINDOWSNT) \ || defined CYGWIN || defined DARWIN_OS).
      (Bug#22086)
      3d82a8ee
    • Paul Eggert's avatar
      Build lib/e-*.o only on platforms that need it · 7fdc3cf0
      Paul Eggert authored
      * configure.ac (hybrid malloc): Simplify configuration.
      (SHEAP_OBJ): Remove; no longer needed.
      (HYBRID_MALLOC): New var. Subst it.
      (HYBRID_MALLOC_LIB): New Automake conditional.
      * lib/Makefile.am (noinst_LIBRARIES): Add libegnu.a only if
      HYBRID_MALLOC_LIB.
      (libegnu_a_CPPFLAGS): Omit AM_CPPFLAGS; not needed.
      (MOSTLYCLEANFILES): Add libegnu.a.
      * src/Makefile.in (SHEAP_OBJ): Remove.
      (HYBRID_MALLOC): New macro.
      (base_obj): Use it to conditionally add sheap.o.
      (LIBEGNU_ARCHIVE): New macro.
      ($(LIBEGNU_ARCHIVE)): New rule, replacing $(lib)/libegnu.a.
      All uses of the latter replaced by the former.
      * src/alloc.c (USE_ALIGNED_ALLOC): Simplify configuration.
      Correct misspelling ALIGNED_ALLOC to HAVE_ALIGNED_ALLOC.
      * src/gmalloc.c: Update comment.
      * src/lisp.h (aligned_alloc)
      [!DOUG_LEA_MALLOC && !HYBRID_MALLOC && !SYSTEM_MALLOC]:
      New decl.
      (Bug#22086)
      7fdc3cf0
    • Paul Eggert's avatar
      Include <malloc.h> when advisable · a4817d83
      Paul Eggert authored
      This should help insulate us better from future glibc changes.
      It is good hygiene to include .h files for APIs that Emacs uses.
      Fix type clashes between Emacs and GNU <malloc.h> (Bug#22086).
      * configure.ac: Check for malloc.h.
      * src/alloc.c: Include <malloc.h> depending on HAVE_MALLOC_H,
      not on DOUG_LEA_MALLOC.
      * src/emacs.c, src/gmalloc.c (malloc_enable_thread):
      Remove decl (now in lisp.h).
      * src/gmalloc.c: Include stddef.h earlier, for ptrdiff_t.
      [emacs]: Include lisp.h.
      [HAVE_MALLOC_H]: Include <malloc.h>.
      (__MALLOC_HOOK_VOLATILE): New macro, if not already defined.
      (__after_morecore_hook, __malloc_initialize_hook, __morecore)
      (__default_morecore):
      [!HAVE_MALLOC_H]: New decls near non-inclusion of <malloc.h>.
      (calloc): Make it clear that the macro should not be used.
      Remove unused decl.
      (malloc_info): New macro, to avoid clash with glibc <malloc.h>.
      (__morecore, __default_morecore, __after_morecore_hook)
      (__malloc_extra_blocks, __malloc_initialize_hook, __free_hook)
      (__malloc_hook, __realloc_hook, __memalign_hook, memory_warnings):
      Remove later decls.
      (gmalloc_hook, gfree_hook, grealloc_hook):
      Rename from __malloc_hook, __free_hook, __realloc_hook to
      avoid type collision with glibc <malloc.h>.  All uses changed.
      (gmalloc_hook):
      (__malloc_extra_blocks) [DOUG_LEA_MALLOC||HYBRID_MALLOC||SYSTEM_MALLOC]:
      Now static.
      (gmalloc_hook, __malloc_extra_blocks): Define even if [!HYBRID_MALLOC].
      (__malloc_initialize_hook, __after_morecore_hook):
      Declare with types compatible with glibc.
      (__memalign_hook, hybrid_calloc) [HYBRID_MALLOC]:
      Remove.  All uses removed.
      * src/lisp.h (__malloc_extra_blocks, malloc_enable_thread): New decls.
      * src/ralloc.c, src/vm-limit.c:
      Simplify includes and include <malloc.h> if available.
      a4817d83
    • Paul Eggert's avatar
      * src/alloc.c: Include "sheap.h". · e4cd4a76
      Paul Eggert authored
      (alloc_unexec_pre, alloc_unexec_post) [HYBRID_MALLOC]:
      Set and clear bss_sbrk_did_unexec, on all platforms not just Cygwin.
      * src/lisp.h (alloc_unexec_pre, alloc_unexec_post) [!DOUG_LEA_MALLOC]:
      Declare unconditionally.
      * src/unexcw.c, src/unexelf.c (bss_sbrk_did_unexec): Remove decl.
      (unexec): Don’t set or clear bss_sbrk_did_unexec;
      the caller now does this.
      (Bug#22086)
      e4cd4a76
  21. 27 Jan, 2016 1 commit
    • Paul Eggert's avatar
      malloc.h hygiene · b88e9cde
      Paul Eggert authored
      This attempts to future-proof Emacs a bit against possible glibc
      changes, by having Emacs use <malloc.h> declarations rather than
      coding them up by hand.  Problem noted by Florian Weimer in:
      https://sourceware.org/ml/libc-alpha/2016-01/msg00777.html
      Implement this mainly by moving malloc.h-related functions from
      emacs.c (which does not include <malloc.h>) to alloc.c (which does).
      * src/alloc.c (my_heap_start) [DOUG_LEA_MALLOC || GNU_LINUX]:
      New function.
      The remaining changes to this file apply only if DOUG_LEA_MALLOC.
      (alloc_unexec_pre, alloc_unexec_post): New functions.
      (malloc_initialize_hook): Use my_heap_start and alloc_unexec_post.
      (__MALLOC_HOOK_VOLATILE): New macro, if not already defined.
      (__malloc_initialize_hook): Use it.
      (malloc_state_ptr, malloc_initialize_hook, __malloc_initialize_hook):
      Move here from ...
      * src/emacs.c: ... here.
      (malloc_get_state, malloc_set_state): Remove extern decls.
      (my_heap_start) [DOUG_LEA_MALLOC || GNU_LINUX]: Remove static var.
      All uses changed to similarly-named new function.
      (Fdump_emacs): Use new functions alloc_unexec_pre, alloc_unexec_post.
      * src/lisp.h (my_heap_start, alloc_unexec_pre, alloc_unexec_post):
      New decls.
      b88e9cde
  22. 11 Jan, 2016 2 commits
    • Eli Zaretskii's avatar
      Avoid an infloop when we run out of memory · 36b95394
      Eli Zaretskii authored
      * src/alloc.c (garbage_collect_1): Don't bother saving and
      restoring the echo-area message if we are GC'ing after running out
      of memory.  This avoids an infloop due to repeated attempts to
      allocate memory for the cons cell needed to save the message,
      which signals the memory-full error, which attempts to save the
      echo-area message, which signals memory-full again, etc.
      36b95394
    • Paul Eggert's avatar
      Simplify HAVE_MODULES use in mark_maybe_pointer · eef6784e
      Paul Eggert authored
      * src/alloc.c (HAVE_MODULES): Now a constant 0 if not defined,
      so that later code can use 'if' rather than '#ifdef'.
      (mark_maybe_pointer): Simplify based on HAVE_MODULES now
      always working.
      eef6784e
  23. 10 Jan, 2016 2 commits
  24. 01 Jan, 2016 1 commit
  25. 31 Dec, 2015 1 commit
    • YAMAMOTO Mitsuharu's avatar
      Avoid writing to purespace · 47580e0d
      YAMAMOTO Mitsuharu authored
      * src/alloc.c (Fmake_string): Don't write to empty string contents.
      (allocate_vector): Don't write to empty vector size.
      * src/character.h (CHECK_CHARACTER_CAR, CHECK_CHARACTER_CDR):
      Don't call unnecessary XSETCAR or XSETCDR.
      * src/lisp.h (STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE): Don't
      write to empty string size_byte.
      47580e0d
  26. 29 Dec, 2015 1 commit
  27. 13 Dec, 2015 1 commit
    • Paul Eggert's avatar
      Fix performance regression with gcc -O0 · 09663d9b
      Paul Eggert authored
      This fixes the smaller performance hit that I noted in:
      https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00357.html
      * src/alloc.c (macro_XPNTR_OR_SYMBOL_OFFSET, macro_XPNTR):
      * src/puresize.h (puresize_h_PURE_P)
      (puresize_h_CHECK_IMPURE):
      New macros, with the old contents of the functions.
      * src/alloc.c (XPNTR_OR_SYMBOL_OFFSET, XPNTR):
      * src/puresize.h (PURE_P, CHECK_IMPURE):
      Use the new macros.  Also macros, if DEFINE_KEY_OPS_AS_MACROS.
      * src/conf_post.h (ATTRIBUTE_UNUSED):
      * src/lisp.h (DEFINE_KEY_OPS_AS_MACROS): New macros.
      09663d9b
  28. 06 Dec, 2015 1 commit
    • Paul Eggert's avatar
      Improve module interface when WIDE_EMACS_INT · 302bbe00
      Paul Eggert authored
      * src/emacs-module.c (plain_values): New constant.
      (module_nil): Now a constant.
      (Finternal_module_call, value_to_lisp_bits, lisp_to_value_bits)
      (syms_of_module): Use if, not #ifdef, so that both sides are
      checked at compile-time, and so that GCC doesn’t complain
      about an unused var in the typical case.  Also, depend on
      plain_values, not on WIDE_EMACS_INT; the code shouldn’t assume
      that WIDE_EMACS_INT implies !USE_LSB_TAG.
      (value_to_lisp_bits, lisp_to_value_bits): New functions.
      Sign-extend integers rather than zero-extending them, as small
      negative integers are more likely.
      (value_to_lisp, lisp_to_value): Rewrite in terms of the new *_bits
      functions.
      (HAVE_STRUCT_ATTRIBUTE_ALIGNED): Define to 0 if not already defined.
      (mark_modules): Remove.  All uses removed.
      (lisp_to_value): Don’t assume Fcons returns a pointer aligned
      to GCALIGNMENT.
      (syms_of_module): Check that module_nil converts to Qnil.
      * src/lisp.h (lisp_h_XSYMBOL, XSYMBOL): Use signed conversion, since
      we prefer signed to unsigned when either will do.
      (TAG_PTR): Sign-extend pointers when USE_LSB_TAG, as this is
      a bit better for emacs-module.c.
      302bbe00
  29. 24 Nov, 2015 1 commit
    • Eli Zaretskii's avatar
      Fix crash at startup related to GC of font entities · d5fdffec
      Eli Zaretskii authored
      * src/font.h (GC_FONT_SPEC_P, GC_FONT_ENTITY_P)
      (GC_FONT_OBJECT_P, GC_XFONT_SPEC, GC_XFONT_ENTITY)
      (GC_XFONT_OBJECT): New macros, for use in garbage collector.
      * src/alloc.c (compact_font_cache_entry, compact_font_caches):
      Don't ifdef away font cache compaction on NT_GUI, as the problems
      which led to that seem to have been solved.
      (compact_font_cache_entry): Use GC_FONT_SPEC_P, GC_XFONT_SPEC,
      GC_XFONT_ENTITY, and GC_XFONT_OBJECT, instead of their non-GC_
      cousins.  (Bug#21999)
      d5fdffec
  30. 21 Nov, 2015 2 commits
    • Paul Eggert's avatar
      Add a few safety checks when ENABLE_CHECKING · 8afaa132
      Paul Eggert authored
      This was motivated by the recent addition of module code,
      which added some ENABLE_CHECKING-enabled checks that are
      useful elsewhere too.
      * src/alloc.c (compact_font_cache_entry):
      * src/fns.c (sweep_weak_table):
      * src/lread.c (oblookup):
      Use gc_asize rather than doing it by hand.
      * src/emacs-module.c (module_make_global_ref)
      (module_free_global_ref, module_vec_size):
      Omit assertions that lisp.h now checks.
      * src/lisp.h (XFASTINT, ASIZE): In functional implementations,
      check that the result is nonnegative.  Use eassume, as this
      info can help a bit when optimizing production code.
      (XSYMBOL) [!USE_LSB_TAG]: Assert that argument is a symbol,
      to be consistent with the USE_LSB_TAG case.
      (gc_asize): New function, when ASIZE is needed in the gc.
      (gc_aset): Use it.
      (HASH_TABLE_P): Move definition up, so that it can be used ...
      (XHASH_TABLE): ... here, to assert that the arg is a hash table.
      8afaa132
    • Eli Zaretskii's avatar
      Improve documentation of dynamic modules · 3858b794
      Eli Zaretskii authored
      * src/fns.c (Frequire): Doc fix to include the dynamic module
      support.
      * src/lread.c (Fload, Vload_suffixes): Doc fixes to include the
      dynamic module support.
      (Fload): Treat the module suffix the same as '*.el' and '*.elc'
      wrt the MUST-SUFFIX argument.
      
      * etc/NEWS: Expand documentation of dynamically loaded modules.
      3858b794