1. 13 Nov, 2017 1 commit
    • Paul Eggert's avatar
      Use alignas to fix GCALIGN-related bugs · b1573a97
      Paul Eggert authored
      Use alignas and unions to specify alignments of objects needing
      addresses that are at least a multiple of GCALIGNMENT.  Using
      these standard C facilities should be safer than relying on ad hoc
      and poorly-understood features like GCC’s __attribute__
      ((aligned (N))), the root cause for recent porting bugs like
      Bug#29040.  The alignas macro was standardized by C11 and Gnulib
      supports alignas for pre-C11 platforms.  I have tested this on Sun
      Studio 12 sparc (2007) and GCC 4.4.7 x86-64 (2012) as well as on
      more recent platforms like GCC 7.2.1 (2017) on Fedora 26 (both
      x86-64 and x86).
      * lib-src/make-docfile.c (close_emacs_globals): lispsym is now
      just an array of struct Lisp_Symbol, since struct Lisp_Symbol is
      now properly aligned.  All uses changed.
      * src/alloc.c (NEXT_FREE_LISP_STRING): Just use the new u.next
      member; this is simpler and safer than casting a pointer that
      might not be aligned properly.
      (aligned_Lisp_Symbol): Remove.  No longer needed, now that struct
      Lisp_Symbol is aligned properly.  All uses replaced with struct
      * src/lisp.h (GCALIGNED): Remove, as it does not work as expected:
      it can cause the natural alignment to be ignored.  All uses
      replaced by unions with a ‘char alignas (GCALIGNMENT)’ member as
      described below.
      (struct Lisp_Symbol, struct Lisp_Cons, struct Lisp_String):
      Change definition from ‘struct TAG { MEMBERS };’ to
      ‘struct TAG { union { struct { MEMBERS } s; char alignas
      (GCALIGNMENT) gcaligned; } u; };’.  This guarantees ‘struct TAG’
      to have an alignment that at least max (GCALIGNMENT, N) where N is
      its old alignment.  All uses like ‘PTR->MEMBER’ changed to
      ‘PTR->u.s.MEMBER’; these uses were supposed to be mostly private
      anyway.  Verify that the resulting ‘struct TAG’ is properly
      aligned for Emacs.
      (union vectorlike_header): New member ‘gcaligned’ to guarantee
      that this type, and its containing types like ‘struct Lisp_Subr’,
      ‘struct buffer’ and ‘struct thread_state’, are all properly
      aligned for Emacs.
      (struct Lisp_String): New union member ‘next’, for the benefit
      (union Aligned_Cons, union Aligned_String): Remove.  All uses
      replaced by struct Lisp_Cons and struct Lisp_String, since they
      are now properly aligned.
      (USE_STACK_CONS, USE_STACK_STRING): Simplify now that we can
      assume struct Lisp_Cons and struct Lisp_String are properly
  2. 10 Nov, 2017 1 commit
    • Paul Eggert's avatar
      Fix off-by-1 bug in --enable-checking=stringbytes · 05aa6d4a
      Paul Eggert authored
      Evidently nobody builds Emacs with --enable-checking=all,
      which is no surprise as it is so slow as to be unusable nowadays.
      Perhaps we should remove the slowest checks, or move them into
      another category, or speed them up, or something.
      * src/alloc.c (SDATA_SIZE) [GC_CHECK_STRING_BYTES]: Fix off-by-one
      error in size calculation, which caused a failure when
      --enable-checking=stringbytes was used.  I introduced this bug in
      2016-09-08T01:08:45!eggert@cs.ucla.edu "Port flexible array
      members to GCC + valgrind".
  3. 02 Nov, 2017 3 commits
    • Paul Eggert's avatar
      Fix alignment portability problems · 6b08ad52
      Paul Eggert authored
      Do not assume that the natural alignment of Lisp objects is a
      multiple of GCALIGNMENT.  This improves on the portability of the
      recent fix for Bug#29040.
      * lib-src/make-docfile.c (close_emacs_globals):
      * src/buffer.c (buffer_defaults, buffer_local_symbols):
      * src/lisp.h (DEFUN):
      * src/thread.c (main_thread):
      Use GCALIGNED, not alignas (GCALIGNMENT).
      * src/alloc.c (COMMON_MULTIPLE):
      Move back here from lisp.h, since it is no longer used elsewhere.
      * src/lisp.h (GCALIGNMENT): No longer a macro, since we need not
      worry about MSVC.  Omit no-longer-needed consistency check.
      * src/thread.c (THREAD_ALIGNMENT): Remove.
    • Eli Zaretskii's avatar
    • Stefan Monnier's avatar
      * src/alloc.c (sweep_symbols): Tweak last change · fdd3dcfa
      Stefan Monnier authored
      Avoid the double-free without the extra check.  Add an explanatory comment.
  4. 31 Oct, 2017 1 commit
  5. 28 Oct, 2017 1 commit
    • Eli Zaretskii's avatar
      Avoid segfaults in 64-bit Windows builds · 00c3c6d8
      Eli Zaretskii authored
      * src/lisp.h (COMMON_MULTIPLE): Move here from alloc.c.
      * src/thread.c (THREAD_ALIGNMENT): New macro.
      (main_thread): Use THREAD_ALIGNMENT to align propertly.  (Bug#29040)
  6. 14 Oct, 2017 1 commit
  7. 02 Oct, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to HTTP for gnu.org · 5172fa02
      Paul Eggert authored
      This fixes some URLs I omitted from my previous pass,
      notably those in lists.gnu.org.  Although lists.gnu.org
      does not yet support TLS 1.1, TLS 1.0 is better than nothing.
      * lisp/erc/erc.el (erc-official-location):
      * lisp/mail/emacsbug.el (report-emacs-bug):
      Use https:, not http:.
  8. 13 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to FTP and HTTP in documentation · bc511a64
      Paul Eggert authored
      Most of this change is to boilerplate commentary such as license URLs.
      This change was prompted by ftp://ftp.gnu.org's going-away party,
      planned for November.  Change these FTP URLs to https://ftp.gnu.org
      instead.  Make similar changes for URLs to other organizations moving
      away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
      fsf.org when this works, as this will further help defend against
      man-in-the-middle attacks (for this part I omitted the MS-DOS and
      MS-Windows sources and the test tarballs to keep the workload down).
      HTTPS is not fully working to lists.gnu.org so I left those URLs alone
      for now.
  9. 29 Aug, 2017 2 commits
    • Paul Eggert's avatar
      Make garbage collection more conservative · e13bdfee
      Paul Eggert authored
      Check for a pointer anywhere within the object, as opposed to just
      the start of the object.  This is needed for gcc -Os -flto on
      x86-64 (Bug#28213).  This change means that the garbage collector
      is more conservative, and will incorrectly keep objects that it
      does not need to, but that is better than incorrectly discarding
      objects that should be kept.
      * src/alloc.c (ADVANCE, VINDEX): Now functions, not macros;
      this is easier to debug.
      (setup_on_free_list): Rename from SETUP_ON_FREE_LIST.
      Now a function with two args, not a macro with three.
      All callers changed.
      (live_string_holding, live_cons_holding, live_symbol_holding)
      (live_misc_holding, live_vector_holding, live_buffer_holding):
      New functions, which check for any object containing the addressed
      byte, not just for an object at the given address.
      (live_string_p, live_cons_p, live_symbol_p, live_misc_p)
      (live_vector_p, live_buffer_p):
      Redefine in terms of the new functions.
      (live_float_p): Refactor slightly to match the new functions.
      (mark_maybe_object, mark_maybe_pointer): Use the new functions.
      Don’t bother checking mark bits, as mark_object already does that,
      and omitting the checks here simplifies the code.  Although
      mark_maybe_object can continue to insist that tagged pointers
      still address the start of the object, mark_maybe_pointer now is
      more conservative and checks for pointers anywhere into an object.
    • Paul Eggert's avatar
      Improve stack-top heuristic · 9baeed35
      Paul Eggert authored
      This is needed for gcc -Os -flto on x86-64; otherwise, GC misses part
      of the stack when scanning for heap roots, causing Emacs to crash
      later (Bug#28213).  The problem is that Emacs's hack for getting an
      address near the stack top does not work when link-time optimization
      moves stack variables around.
      * configure.ac (HAVE___BUILTIN_FRAME_ADDRESS): New macro.
      * lib-src/make-docfile.c (DEFUN_noinline): New constant.
      (write_globals, scan_c_stream): Support noinline.
      * src/alloc.c (NEAR_STACK_TOP): New macro.
      (SET_STACK_TOP_ADDRESS): Use it.
      (flush_stack_call_func, Fgarbage_collect): Now noinline.
  10. 24 Jul, 2017 1 commit
    • Andreas Schwab's avatar
      Properly align global lispsym · 7a4d9f63
      Andreas Schwab authored
      * lib-src/make-docfile.c (close_emacs_globals): Wrap struct
      Lisp_Symbols inside struct.
      * src/alloc.c (sweep_symbols): Update use of lispsym.
      * src/lisp.h (builtin_lisp_symbol): Likewise.
  11. 09 Jul, 2017 1 commit
    • Paul Eggert's avatar
      Fix core dump in substitute-object-in-subtree · 083940a9
      Paul Eggert authored
      Without this fix, (substitute-object-in-subtree #0=(#0# 'a) 'a)
      would dump core, since the C code would recurse indefinitely through
      the infinite structure.  This patch adds an argument to the function,
      and renames it to lread--substitute-object-in-subtree as the function
      is not general-purpose and should not be relied on by outside code.
      See Bug#23660.
      * src/intervals.c (traverse_intervals_noorder): ARG is now void *,
      not Lisp_Object, so that callers need not cons unnecessarily.
      All callers changed.  Also, remove related #if-0 code that was
      “temporary” in the early 1990s and has not been compilable for
      some time.
      * src/lread.c (struct subst): New type, for substitution closure data.
      (seen_list): Remove this static var, as this info is now part of
      struct subst.  All uses removed.
      (Flread__substitute_object_in_subtree): Rename from
      Fsubstitute_object_in_subtree, and give it a 3rd arg so that it
      doesn’t dump core when called from the top level with an
      already-cyclic structure.  All callers changed.
      (SUBSTITUTE): Remove.  All callers expanded and then simplified.
      (substitute_object_recurse): Take a single argument SUBST rather
      than a pair OBJECT and PLACEHOLDER, so that its address can be
      passed around as part of a closure; this avoids the need for an
      AUTO_CONS call.  All callers changed.  If the COMPLETED component
      is t, treat every subobject as potentially circular.
      (substitute_in_interval): Take a struct subst * rather than a
      Lisp_Object, for the closure data.  All callers changed.
      * test/src/lread-tests.el (lread-lread--substitute-object-in-subtree):
      New test, to check that the core dump does not reoccur.
  12. 08 Jun, 2017 1 commit
  13. 27 May, 2017 1 commit
    • Philipp Stephani's avatar
      Avoid another compiler warning on macOS · a3a3ea07
      Philipp Stephani authored
      When configured with --without-ns, HAVE_NS is not defined on macOS,
      thus 'memory-limit' calls the deprecated sbrk(2) function.  Avoid that
      by using the pre-defined __APPLE__ preprocessor macro.
      * src/alloc.c (Fmemory_limit): Never use sbrk(2) on macOS.
  14. 20 May, 2017 1 commit
    • Philipp Stephani's avatar
      Reimplement module functions · 31fded03
      Philipp Stephani authored
      Instead of a lambda, create a new type containing all data required to
      call the function, and support it in the evaluator.  Because this type
      now also needs to store the function documentation, it is too big for
      Lisp_Misc; use a pseudovector instead.  That also has the nice benefit
      that we don't have to add special support to the garbage collector.
      Since the new type is user-visible, give it a predicate.
      Now we can easily support 'help-function-args' and 'func-arity'; add
      unit tests for these.
      * src/lisp.h (allocate_module_function, MODULE_FUNCTIONP)
      (XMODULE_FUNCTION): New pseudovector type 'module function'.
      * src/eval.c (FUNCTIONP): Also treat module functions as functions.
      (funcall_lambda, Ffuncall, eval_sub): Add support for calling module
      (Ffunc_arity): Add support for detecting the arity of module
      * src/emacs-module.c (module_make_function): Adapt to new structure.
      Return module function object directly instead of wrapping it in a
      lambda; remove FIXME.
      (funcall_module): New function to call module functions.  Replaces
      `internal--module-call' and is called directly from eval.c.
      (syms_of_module): Remove internal helper function, which is no longer
      (module_function_arity): New helper function.
      * src/data.c (Ftype_of): Adapt to new implementation.
      (Fmodule_function_p, syms_of_data): New user-visible function.  Now
      that module functions are first-class objects, they deserve a
      predicate.  Define it even if not compiled with --enable-modules so
      that Lisp code doesn't have to check for the function's existence.
      * src/doc.c (Fdocumentation): Support module functions.
      * src/print.c (print_object): Adapt to new implementation.
      * src/alloc.c (mark_object): Specialized garbage collector support is
      no longer needed.
      * lisp/help.el (help-function-arglist): Support module functions.
      While there, simplify the arity calculation by using `func-arity',
      which does the right thing for all kinds of functions.
      * test/data/emacs-module/mod-test.c: Amend docstring so we can test
      the argument list.
      * test/src/emacs-module-tests.el (mod-test-sum-docstring): Adapt to
      new docstring.
      (mod-test-non-local-exit-signal-test): Because `internal--module-call'
      is gone, the backtrace has changed and no longer leaks the
      (module--func-arity): New test for `func-arity'.
      (module--help-function-arglist): New test for `help-function-arglist'.
  15. 06 May, 2017 3 commits
    • Eli Zaretskii's avatar
    • Philipp Stephani's avatar
      Introduce new misc type for module function · a3e96940
      Philipp Stephani authored
      This resolves a couple of FIXMEs in emacs-module.c.
      * src/lisp.h (MODULE_FUNCTIONP, XMODULE_FUNCTION): New functions.
      * src/alloc.c (make_module_function): New function.
      (mark_object): GC support.
      * src/data.c (Ftype_of, syms_of_data): Handle module function type.
      * src/print.c (print_object): Print support for new type.
      * src/emacs-module.c (module_make_function, Finternal_module_call):
      Use new module function type, remove FIXMEs.
      (module_format_fun_env): Adapt and give it external linkage.
      * test/src/emacs-module-tests.el (module-function-object): Add unit
    • Eli Zaretskii's avatar
      Turn on GC_CHECK_MARKED_OBJECTS by default under ENABLE_CHECKING · 3472666f
      Eli Zaretskii authored
      * src/alloc.c (GC_CHECK_MARKED_OBJECTS): Define to 1 by default of
      ENABLE_CHECKING is defined.
      (mark_object): Test for GC_CHECK_MARKED_OBJECTS being non-zero,
      instead of being defined.
  16. 08 Apr, 2017 1 commit
    • Paul Eggert's avatar
      Deprecate copy-record in favor of copy-sequence · a2b3fea9
      Paul Eggert authored
      Since copy-sequence seems to be needed anyway for records, have it
      work on records, and remove copy-record as being superfluous.
      * doc/lispref/records.texi (Records, Record Functions):
      * lisp/emacs-lisp/cl-macs.el (cl-defstruct):
      * lisp/emacs-lisp/eieio.el (make-instance, clone):
      * test/src/alloc-tests.el (record-3):
      Use copy-sequence, not copy-record, to copy records.
      * doc/lispref/sequences.texi (Sequence Functions)
      (Array Functions): Document that aref and copy-sequence
      work on records.
      * etc/NEWS: Omit copy-record.
      * src/alloc.c (Fcopy_record): Remove.
      * src/data.c (Faref): Document that arg can be a record.
      * src/fns.c (Fcopy_sequence): Copy records, too.
  17. 06 Apr, 2017 1 commit
    • Lars Brinkhoff's avatar
      Update documentation for type semantics of records. · 4753f3f0
      Lars Brinkhoff authored
      * objects.texi (Record Type): improve description of what
      `type-of' returns for records.
      (Type Descriptors): new section.
      * elisp.texi: reference it.
      * records.texi (Records): reference it.  Document behaviour when type
      slot is a record.
      * alloc.c (Fmake_record, Frecord): mention type desciptors.
  18. 04 Apr, 2017 3 commits
    • Paul Eggert's avatar
      Minor simplifications and doc for records · 82b9efc8
      Paul Eggert authored
      * doc/lispref/records.texi (Records): Mention size limit.
      * etc/NEWS: Mention records.
      * src/alloc.c (allocate_pseudovector, allocate_record):
      Prefer 'PSEUDOVECTOR_SIZE_MASK' to its definiens.
      (allocate_record): Check arg range here, not in callers, as this
      simplifies the code.  Use allocate_vectorlike instead of
      allocate_vector, to avoid duplicate runtime tests.
      (Fmake_record, record): Don't mention PSEUDOVECTOR_SIZE_BITS in
      the doc string, as it is not visible to the user.
      (Fmake_record, record, Fcopy_record):
      Prefer make_lisp_ptr to XSETVECTOR.
      (record): Broaden memcpy to copy the type, too.
    • Eli Zaretskii's avatar
      Fix recent changes in record data type · 12317ff4
      Eli Zaretskii authored
      * src/alloc.c (Fmake_record, Frecord, Fcopy_record): Avoid
      compiler warnings when 'ptrdiff_t' is narrower than 'long int'.
    • Lars Brinkhoff's avatar
      Add record objects with user-defined types. · a2c33430
      Lars Brinkhoff authored
      * src/alloc.c (allocate_record): New function.
      (Fmake_record, Frecord, Fcopy_record): New functions.
      (syms_of_alloc): defsubr them.
      (purecopy): Work with records.
      * src/data.c (Ftype_of): Return slot 0 for record objects, or type
      name if record's type holds class.
      (Frecordp): New function.
      (syms_of_data): defsubr it.  Define `Qrecordp'.
      (Faref, Faset): Work with records.
      * src/fns.c (Flength): Work with records.
      * src/lisp.h (prec_type): Add PVEC_RECORD.
      * src/lread.c (read1): Add syntax for records.
      * src/print.c (PRINT_CIRCLE_CANDIDATE_P): Add RECORDP.
      (print_object): Add syntax for records.
      * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-2):
      New test.
      * test/src/alloc-tests.el (record-1, record-2, record-3):
      New tests.
      * doc/lispref/elisp.texi, doc/lispref/objects.texi,
      doc/lispref/records.texi: Add documentation for records.
  19. 12 Mar, 2017 1 commit
    • Stefan Monnier's avatar
      Use switch on pseudovector types; plus cleanups along the way · 1b424533
      Stefan Monnier authored
      * src/lisp.h (PSEUDOVECTOR_TYPE): New function, extracted from mark_object.
      (PSEUDOVECTOR_TYPEP): Change type of `code'.
      * src/alloc.c (sweep_vectors): Remove out-of-date assertion.
      (mark_object): Use PSEUDOVECTOR_TYPE.
      * src/data.c (Ftype_of): Use switch on pvec type.
      * src/print.c (print_object): Use switch on pvec type.
      * lisp/emacs-lisp/cl-generic.el (cl--generic-typeof-types):
      Add recently added types.
  20. 21 Feb, 2017 2 commits
    • Paul Eggert's avatar
      Use float instead of Lisp_Object for rehash_size · 83c9c6fc
      Paul Eggert authored
      * src/alloc.c (purecopy_hash_table):
      * src/fns.c (maybe_resize_hash_table, Fmake_hash_table):
      * src/lisp.h (struct Lisp_Hash_Table.rehash_size):
      The rehash_size member of struct Lisp_Hash_Table is now a
      float, not a Lisp_Object.
      * src/alloc.c (purecopy_hash_table): Assign members in order.
      * src/fns.c (make_hash_table): Use EMACS_INT for size and
      float for rehash_size, instead of Lisp_Object for both.
      All callers changed.
      * src/lisp.h (DEFAULT_REHASH_SIZE): Now float, not double,
      and 1 smaller.
      * src/print.c (print_object): Simplify by calling
      Fhash_table_rehash_size and Fhash_table_rehash_threshold.
      Avoid unnecessary NILP.
    • Paul Eggert's avatar
      Use ptrdiff_t instead of Lisp_Object for collision · 5cbdaa98
      Paul Eggert authored
      * src/alloc.c (purecopy_hash_table): Assign, don’t purecopy.
      * src/fns.c (set_hash_next_slot, set_hash_index_slot): Hash index
      arg is now ptrdiff_t index (or -1 if empty), not Lisp_Object
      integer (or Qnil if empty).  All callers changed.
      (larger_vecalloc): New static function.
      (larger_vector): Use it.
      (HASH_NEXT, HASH_INDEX): Move here from lisp.h.  Return ptrdiff_t
      index (or -1) not Lisp_Object integer (or Qnil).  All callers changed.
      * src/fns.c (make_hash_table, maybe_resize_hash_table, hash_lookup)
      (hash_put, hash_remove_from_table, hash_clear, sweep_weak_table):
      * src/profiler.c (evict_lower_half, record_backtrace):
      -1, not nil, is now the convention for end of collision list.
      * src/fns.c (maybe_resize_hash_table): Avoid double-initialization
      of the free list.  Reallocate H->next last, in case other
      reallocations exhaust memory.
      * src/lisp.h (struct Lisp_Hash_Table): ‘next_free’ is now
      ptrdiff_t, not Lisp_Object.  Adjust commentary for ‘next’ and
      ‘index’, which no longer contain nil.
      (HASH_NEXT, HASH_INDEX): Move to src/fns.c.
  21. 19 Feb, 2017 2 commits
    • Stefan Monnier's avatar
      Change type of `rehash_threshold' and `pure' fields in hash-tables · fe927ecf
      Stefan Monnier authored
      * src/lisp.h (struct Lisp_Hash_Table): Change type of
      `rehash_threshold' and `pure' fields and move them after `count'.
      * src/fns.c (make_hash_table): Change type of `rehash_threshold' and `pure'.
      (Fmake_hash_table, Fhash_table_rehash_threshold):
      * src/category.c (hash_get_category_set):
      * src/xterm.c (syms_of_xterm):
      * src/profiler.c (make_log):
      * src/print.c (print_object):
      * src/alloc.c (purecopy_hash_table, purecopy): Adjust accordingly.
    • Paul Eggert's avatar
      Use 'char *FOO' instead of 'char* FOO' · b2a83eed
      Paul Eggert authored
  22. 03 Feb, 2017 1 commit
    • Paul Eggert's avatar
      Re-port alloc.c to Solaris sparc and simplify · e080d019
      Paul Eggert authored
      alloc.c had bitrotted a bit, and used an undefined symbol
      stack_base when Emacs was built on Solaris sparc, leading to
      compilation failures.  Also, code related to __builtin_unwind_init
      was unnecessarily duplicated.  Fix the bitrot and remove some
      * src/alloc.c: Remove uses of GC_SAVE_REGISTERS_ON_STACK, since it
      is never defined.
      (test_setjmp) [!HAVE___BUILTIN_UNWIND_INIT && GC_SETJMP_WORKS]:
      Define a no-op dummy, to simplify use.
      (test_setjmp) [!GC_SETJMP_WORKS]: Test setjmp_tested_p here rather
      than in the caller, to simplify use.
      (stacktop_sentry): New type.
      (__builtin_unwind_init) [!HAVE___BUILTIN_UNWIND_INIT]: New macro.
      (SET_STACK_TOP_ADDRESS): New macro, containing code that was duplicated.
      (flush_stack_call_func, Fgarbage_collect): Use it.
      (init_alloc): Omit unnecessary initialization.
      After dumping, Emacs need not re-test setjmp.
  23. 01 Feb, 2017 1 commit
    • Paul Eggert's avatar
      Revamp quitting and fix infloops · b01ac672
      Paul Eggert authored
      This fixes some infinite loops that cannot be quitted out of,
      e.g., (defun foo () (nth most-positive-fixnum '#1=(1 . #1#)))
      when byte-compiled and when run under X.  See:
      This also attempts to keep the performance improvements I recently
      added, as much as possible under the constraint that the infloops
      must be caught.  In some cases this fixes infloop bugs recently
      introduced when I removed immediate_quit.
      * src/alloc.c (Fmake_list):
      Use rarely_quit, not maybe_quit, for speed in the usual case.
      * src/bytecode.c (exec_byte_code):
      * src/editfns.c (Fcompare_buffer_substrings):
      * src/fns.c (Fnthcdr):
      * src/syntax.c (scan_words, skip_chars, skip_syntaxes)
      Use rarely_quit so that users can C-g out of long loops.
      * src/callproc.c (call_process_cleanup, call_process):
      * src/fileio.c (read_non_regular, Finsert_file_contents):
      * src/indent.c (compute_motion):
      * src/syntax.c (scan_words, Fforward_comment):
      Remove now-unnecessary maybe_quit calls.
      * src/callproc.c (call_process):
      * src/doc.c (get_doc_string, Fsnarf_documentation):
      * src/fileio.c (Fcopy_file, read_non_regular, Finsert_file_contents):
      * src/lread.c (safe_to_load_version):
      * src/sysdep.c (system_process_attributes) [GNU_LINUX]:
      Use emacs_read_quit instead of emacs_read in places where
      C-g handling is safe.
      * src/eval.c (maybe_quit): Move comment here from lisp.h.
      * src/fileio.c (Fcopy_file, e_write):
      Use emacs_write_quit instead of emacs_write_sig in places where
      C-g handling is safe.
      * src/filelock.c (create_lock_file): Use emacs_write, not
      plain write, as emacs_write no longer has a problem.
      (read_lock_data): Use emacs_read, not read, as emacs_read
      no longer has a problem.
      * src/fns.c (rarely_quit): Move to lisp.h and rename to
      incr_rarely_quit.  All uses changed..
      * src/fns.c (Fmemq, Fmemql, Fassq, Frassq, Fplist_put, Fplist_member):
      * src/indent.c (compute_motion):
      * src/syntax.c (find_defun_start, back_comment, forw_comment)
      (Fforward_comment, scan_lists, scan_sexps_forward):
      Use incr_rarely_quit so that users can C-g out of long loops.
      * src/fns.c (Fnconc): Move incr_rarely_quit call to within
      inner loop, so that it catches C-g there too.
      * src/keyboard.c (tty_read_avail_input): Remove commented-out
      and now-obsolete code dealing with interrupts.
      * src/lisp.h (rarely_quit, incr_rarely_quit): New functions,
      the latter moved here from fns.c and renamed from rarely_quit.
      (emacs_read_quit, emacs_write_quit): New decls.
      * src/search.c (find_newline, search_buffer, find_newline1):
      Add maybe_quit to catch C-g.
      * src/sysdep.c (get_child_status): Always invoke maybe_quit
      if interruptible, so that the caller need not bother.
      (emacs_nointr_read, emacs_read_quit, emacs_write_quit):
      New functions.
      (emacs_read): Rewrite in terms of emacs_nointr_read.
      Do not handle C-g or signals; that is now for emacs_read_quit.
      (emacs_full_write): Replace PROCESS_SIGNALS two-way arg
      with INTERRUPTIBLE three-way arg.  All uses changed.
  24. 31 Jan, 2017 1 commit
  25. 30 Jan, 2017 1 commit
    • Vibhav Pant's avatar
      Fix hash tables not being purified correctly. · 9c4dfdd1
      Vibhav Pant authored
      * src/alloc.c
      (purecopy_hash_table) New function, makes a copy of the given hash
      table in pure storage.
      Add new struct `pinned_object' and `pinned_objects' linked list for
      pinning objects.
      (Fpurecopy) Allow purifying hash tables
      (purecopy) Pin hash tables that are either weak or not declared with
      `:purecopy t`, use purecopy_hash_table otherwise.
      (marked_pinned_objects) New function, marks all objects in pinned_objects.
      (garbage_collect_1) Use it. Mark all pinned objects before sweeping.
      * src/lisp.h Add new field `pure' to struct `Lisp_Hash_Table'.
      * src/fns.c: Add `purecopy' parameter to hash tables.
      (Fmake_hash_table): Check for a `:purecopy PURECOPY' argument, pass it
      to make_hash_table.
      (make_hash_table): Add `pure' parameter, set h->pure to it.
      (Fclrhash, Fremhash, Fputhash): Enforce that the table is impure with
      * src/lread.c: (read1) Parse for `purecopy' parameter while reading
        hash tables.
      * src/print.c: (print_object) add the `purecopy' parameter while
        printing hash tables.
      * src/category.c, src/emacs-module.c, src/image.c, src/profiler.c,
        src/xterm.c: Use new (make_hash_table).
  26. 26 Jan, 2017 2 commits
    • Paul Eggert's avatar
      Replace QUIT with maybe_quit · b3a3ed52
      Paul Eggert authored
      There’s no longer need to have QUIT stand for a slug of C statements.
      Use the more-obvious function-call syntax instead.
      Also, use true and false when setting immediate_quit.
      These changes should not affect the generated machine code.
      * src/lisp.h (QUIT): Remove.  All uses replaced by maybe_quit.
    • Paul Eggert's avatar
      Simplify make-list implementation · 0dfd9a69
      Paul Eggert authored
      * src/alloc.c (Fmake_list): Don’t unroll loop, as the complexity
      is not worth it these days.
  27. 01 Jan, 2017 1 commit
  28. 30 Dec, 2016 1 commit
    • Paul Eggert's avatar
      Rename primary_thread to main_thread · 108ef803
      Paul Eggert authored
      This avoids the confusion of using two different phrases "main thread"
      and "primary thread" internally to mean the same thing.  See:
      * src/thread.c (main_thread): Rename from primary_thread,
      since the new name no longer clashes with main_thread_id
      and Emacs internals normally call this the "main thread".
      (init_main_thread): Rename from init_primary_thread.
      (main_thread_p): Rename from primary_thread_p.
      All uses changed.
  29. 24 Dec, 2016 1 commit
    • Paul Eggert's avatar
      Remove interpreter’s byte stack · a815e5f1
      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.
      * src/thread.c (unmark_threads): Remove.  All uses removed.
      * src/thread.h (struct thread_state): Remove m_byte_stack_list member.
      All uses removed.  m_stack_bottom is now the first non-Lisp field.
  30. 22 Dec, 2016 1 commit