1. 16 Jan, 2015 1 commit
    • Dmitry Antipov's avatar
      Tune pseudovector allocation assuming Qnil == 0 · 3b48f995
      Dmitry Antipov authored
      * alloc.c (allocate_pseudovector): Use memset for both
      Lisp_Objects and regular slots.  Add zerolen arg.
      * lisp.h (allocate_pseudovector): Adjust prototype.
      (ALLOCATE_PSEUDOVECTOR): Adjust user.
      (ALLOCATE_ZEROED_PSEUDOVECTOR): New macro.
      (allocate_hash_table, allocate_window, allocate_frame)
      (allocate_process, allocate_terminal): Remove prototypes.
      * fns.c (allocate_hash_table): Now static here.
      * frame.c (allocate_frame):
      * process.c (allocate_process):
      * terminal.c (allocate_terminal):
      * window.c (allocate_window): Now static here.
      Use ALLOCATE_ZEROED_PSEUDOVECTOR.  Add comment.
      3b48f995
  2. 10 Jan, 2015 1 commit
    • Paul Eggert's avatar
      Port to 32-bit --with-wide-int · 6a37ecee
      Paul Eggert authored
      Prefer symbol indexes to struct Lisp_Symbol * casted and then
      widened, as the latter had trouble with GCC on Fedora 21 when
      configured --with-wide-int and when used in static initializers.
      * lib-src/make-docfile.c (write_globals): Define and use symbols like
      iQnil (a small integer, like 0) rather than aQnil (an address
      constant).
      * src/alloc.c (garbage_collect_1, which_symbols):
      * src/lread.c (init_obarray):
      Prefer builtin_lisp_symbol when it can be used.
      * src/dispextern.h (struct image_type.type):
      * src/font.c (font_property_table.key):
      * src/frame.c (struct frame_parm_table.sym):
      * src/keyboard.c (scroll_bar_parts, struct event_head):
      * src/xdisp.c (struct props.name):
      Use the index of a builtin symbol rather than its address.
      All uses changed.
      * src/lisp.h (TAG_SYMPTR, XSYMBOL_INIT): Remove, replacing with ...
      (TAG_SYMOFFSET, SYMBOL_INDEX): ... new macros that deal with
      symbol indexes rather than pointers, and which work better on MSB
      hosts because they shift right before tagging.  All uses changed.
      (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END):
      No longer noops on wide-int hosts, since they work now.
      (builtin_lisp_symbol): New function.
      6a37ecee
  3. 05 Jan, 2015 1 commit
    • 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
  4. 01 Jan, 2015 1 commit
  5. 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
  6. 13 Dec, 2014 1 commit
    • Paul Eggert's avatar
      Replace union hack with C11-style max_align_t · 7fc616af
      Paul Eggert authored
      * admin/merge-gnulib (GNULIB_MODULES): Add stddef, for max_align_t.
      * lib/gnulib.mk: Regenerate.
      * src/alloc.c (XMALLOC_BASE_ALIGNMENT): Use max_align_t instead of
      a hack involving a union.
      7fc616af
  7. 10 Dec, 2014 1 commit
  8. 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
  9. 02 Oct, 2014 1 commit
  10. 30 Sep, 2014 1 commit
  11. 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
  12. 17 Sep, 2014 2 commits
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 09 Aug, 2014 1 commit
  21. 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
  22. 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
  23. 10 Jul, 2014 2 commits
  24. 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
  25. 13 Jun, 2014 1 commit
  26. 11 Jun, 2014 1 commit
  27. 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
  28. 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
  29. 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
  30. 29 May, 2014 1 commit
  31. 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
  32. 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