1. 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.
      a815e5f1
  2. 21 Dec, 2016 1 commit
    • Stefan Monnier's avatar
      * src/data.c (Fmake_variable_frame_local): Remove · a6063ffe
      Stefan Monnier authored
      * src/lisp.h (struct Lisp_Buffer_Local_Value): Remove `frame_local'.
      
      * src/data.c (swap_in_symval_forwarding, set_internal)
      (set_symbol_trapped_write, make_blv, Fmake_variable_buffer_local)
      (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p):
      Don't pay attention to ->frame_local any more.
      (syms_of_data): Remove Qtrapping_frame_local and don't defsubr
      Smake_variable_frame_local.
      
      * etc/NEWS (Incompatible Lisp Changes in Emacs 26.1): Announce removal
      of make-variable-frame-local.
      
      * lisp/help-fns.el (describe-variable): Don't handle the now impossible
      frame-local case.
      
      * lisp/subr.el (make-variable-frame-local): Remove obsolescence data.
      
      * src/frame.c (store_frame_param):
      * src/eval.c (specbind): Don't pay attention to ->frame_local any more.
      
      * src/widget.c (first_frame_p): Remove, unused.
      a6063ffe
  3. 13 Dec, 2016 2 commits
    • Phillip Lord's avatar
      Replace ldefs-boot with a much smaller file · c27b6459
      Phillip Lord authored
       * Makefile.in (bootstrap-build,generate-ldefs-boot): New targets.
         (bootstrap): Depend on bootstrap-build.
       * admin/ldefs-clean.el: New file.
       * lisp/Makefile.in (compile-first): Depend on loaddefs.el
       * lisp/ldefs-boot.el: Remove.
       * lisp/ldefs-boot-auto.el: New file.
       * lisp/ldefs-boot-manual.el: New file.
       * lisp/loadup.el: Load ldefs-boot-manual.el.
       * src/emacs.c (generating_ldefs_boot): New variable.
         (main): Check whether we are generating ldefs.
       * src/eval.c (autoload-do-load): Dump autoload forms to stderr when
         requested.
       * src/lisp.h (generating_ldefs_boot): New variable.
       * admin/gitmerge.el, admin/make-tarball.txt, admin/notes/copyright,
         lisp/Makefile.in, lisp/cus-dep.el, lisp/emacs-lisp/elint.el,
         lisp/finder.el, lisp/loadup.el, msdos/mainmake.v2: Update reference to
         ldefs-boot.
       * admin/update_autogen: Alter mechanism for ldefs-boot generation.
      c27b6459
    • Noam Postavsky's avatar
      Clean up var watcher disabling on thread switching · f66174a1
      Noam Postavsky authored
      * src/data.c (Fset_default): Move code into new C level function,
      `set_default_internal'.
      (set_default_internal): New function, like `Fset_default' but also takes
      additional bindflag parameter.
      (set_internal): Only call `notify_variable_watchers' if bindflag is not
      SET_INTERNAL_THREAD_SWITCH.
      * src/eval.c (do_specbind, do_one_unbind): Add bindflag parameter,
      passed on to set_internal and set_default_internal.  Adjust callers.
      (rebind_for_thread_switch, unbind_for_thread_switch): Pass
      SET_INTERNAL_THREAD_SWITCH to do_specbind, do_one_unbind instead of
      temporarily adjusting symbol's trapped_write field.
      f66174a1
  4. 12 Dec, 2016 1 commit
    • Clément Pit--Claudel's avatar
      Move backtrace to ELisp using a new mapbacktrace primitive · 27cada03
      Clément Pit--Claudel authored
      * src/eval.c (get_backtrace_starting_at, backtrace_frame_apply)
      (Fmapbacktrace, Fbacktrace_frame_internal): New functions.
      (get_backtrace_frame, Fbacktrace_debug): Use `get_backtrace_starting_at'.
      
      * lisp/subr.el (backtrace--print-frame): New function.
      (backtrace): Reimplement using `backtrace--print-frame' and `mapbacktrace'.
      (backtrace-frame): Reimplement using `backtrace-frame--internal'.
      
      * lisp/emacs-lisp/debug.el (debugger-setup-buffer): Pass a base to
      `mapbacktrace' instead of searching for "(debug" in the output of
      `backtrace'.
      
      * test/lisp/subr-tests.el (subr-test-backtrace-simple-tests)
      (subr-test-backtrace-integration-test): New tests.
      
      * doc/lispref/debugging.texi (Internals of Debugger): Document
      `mapbacktrace' and missing argument BASE of `backtrace-frame'.
      27cada03
  5. 09 Dec, 2016 1 commit
    • Eli Zaretskii's avatar
      Fix subtle errors with let-binding of localized variables · 3ef50c1f
      Eli Zaretskii authored
      * src/eval.c (do_specbind): Don't require a "symbol" that is
      actually a cons cell, in order to call set-default, as there are
      no longer such bindings.  This makes do_specbind work like the
      pre-concurrency implementation in specbind for bindings of
      forwarded symbols.  Use specpdl_kind to access the type of the
      binding.
      (specpdl_kind): New function.
      3ef50c1f
  6. 07 Dec, 2016 1 commit
    • Paul Eggert's avatar
      Simplify FUNCTIONP implementation · f0870da2
      Paul Eggert authored
      * src/bytecode.c (exec_byte_code):
      * src/image.c (parse_image_spec):
      Prefer FUNCTIONP (x) to !NILP (Ffunctionp (x)).
      * src/eval.c (FUNCTIONP): Move here ...
      * src/lisp.h: ... from here.  No longer inline, as that
      bloats the text and does not help speed (at least on my platform).
      (functionp): Remove this name, since callers use FUNCTIONP.
      f0870da2
  7. 05 Dec, 2016 2 commits
  8. 03 Dec, 2016 1 commit
    • Noam Postavsky's avatar
      Add lisp watchpoints · 22721316
      Noam Postavsky authored
      This allows calling a function whenever a symbol-value is changed.
      
      * src/lisp.h (lisp_h_SYMBOL_TRAPPED_WRITE_P):
      (SYMBOL_TRAPPED_WRITE_P): New function/macro.
      (lisp_h_SYMBOL_CONSTANT_P): Check for SYMBOL_NOWRITE specifically.
      (enum symbol_trapped_write): New enumeration.
      (struct Lisp_Symbol): Rename field constant to trapped_write.
      (make_symbol_constant): New function.
      
      * src/data.c (Fadd_variable_watcher, Fremove_variable_watcher):
      (set_symbol_trapped_write, restore_symbol_trapped_write):
      (harmonize_variable_watchers, notify_variable_watchers): New functions.
      
      * src/data.c (Fset_default): Call `notify_variable_watchers' for trapped
      symbols.
      (set_internal): Change bool argument BIND to 3-value enum and call
      `notify_variable_watchers' for trapped symbols.
      
      * src/data.c (syms_of_data):
      * src/data.c (syms_of_data):
      * src/font.c (syms_of_font):
      * src/lread.c (intern_sym, init_obarray):
      * src/buffer.c (syms_of_buffer): Use make_symbol_constant.
      
      * src/alloc.c (init_symbol):
      * src/bytecode.c (exec_byte_code): Use SYMBOL_TRAPPED_WRITE_P.
      * src/data.c (Fmake_variable_buffer_local, Fmake_local_variable):
      (Fmake_variable_frame_local):
      * src/eval.c (Fdefvaralias, specbind): Refer to Lisp_Symbol's
      trapped_write instead of constant.
      (Ffuncall): Move subr calling code into separate function.
      (funcall_subr): New function.
      22721316
  9. 29 Nov, 2016 1 commit
  10. 18 Nov, 2016 1 commit
    • Philipp Stephani's avatar
      Prevent dubious argument lists · 0d913da1
      Philipp Stephani authored
      See Bug#24912 and Bug#24913.
      
      * src/eval.c (funcall_lambda): Detect more dubious argument lists.
      * lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): Detect
      more dubious argument lists.
      * test/src/eval-tests.el (eval-tests--bugs-24912-and-24913): Add unit
      test.
      0d913da1
  11. 04 Nov, 2016 1 commit
  12. 13 Oct, 2016 2 commits
  13. 30 Sep, 2016 2 commits
    • Paul Eggert's avatar
      Limit <config.h>’s includes · f4eb8900
      Paul Eggert authored
      This follows up on recent problems with the fact that config.h
      includes stdlib.h etc.; some files need to include stdlib.h later.
      config.h generally should limit itself to includes that are
      universally safe; outside of MS-Windows, only stdbool.h makes
      the cut among the files currently included.  So, move the
      other includes to just the files that need them (Bug#24506).
      * configure.ac (config_opsysfile): Remove, as this generic hook
      is no longer needed.
      * lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c:
      * src/w32proc.c (_GNU_SOURCE):
      Remove, as it’s OK for config.h to do this now.
      * src/conf_post.h: Include <ms-w32.h>, instead of the generic
      config_opsysfile, for simplicity as this old way of configuring is
      now done only for the MS-Windows port.  Do not include <ms-w32.h>
      if DEFER_MS_W32_H, for the benefit of the few files that want its
      effects later.  Do not include <alloca.h>, <string.h>, or
      <stdlib.h>.  Other files modified to include these headers as
      needed, or to not include headers that are no longer needed.
      * src/lisp.h: Include <alloca.h> and <string.h> here, since
      some of the inline functions need them.
      * src/regex.c: Include <alloca.h> if not emacs.  (If emacs,
      we can rely on SAFE_ALLOCA.)  There is no longer any need to
      worry about HAVE_ALLOCA_H.
      * src/unexmacosx.c: Rely on config.h not including stdlib.h.
      * src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H):
      Define before including <config.h> first, and include <ms-w32.h>
      after the troublesome headers.
      f4eb8900
    • Vasilij Schneidermann's avatar
      New user option 'debugger-stack-frame-as-list' · d1890a3a
      Vasilij Schneidermann authored
      * src/eval.c (syms_of_eval) <debugger-stack-frame-as-list>: New
      variable.
      * lisp/cus-start.el (standard): Add debugger-stack-frame-as-list.
      * lisp/emacs-lisp/debug.el (debugger-setup-buffer): Adjust
      backtrace processing for the value of debugger-stack-frame-as-list.
      * lisp/emacs-lisp/edebug.el (edebug-backtrace): Adjust backtrace
      processing for the value of debugger-stack-frame-as-list.
      * doc/lispref/debugging.texi (Internals of Debugger): Document
      debugger-stack-frame-as-list.
      * etc/NEWS: Mention 'debugger-stack-frame-as-list'.
      d1890a3a
  14. 23 Sep, 2016 1 commit
    • Noam Postavsky's avatar
      Fix debugging of string-match-p errors · 3f539c00
      Noam Postavsky authored
      * src/eval.c (call_debugger): Bind inhibit-changing-match-data to nil so
      that debugger code that needs to do regexp match won't break
      (Bug #23949, Bug #24166, Bug#16294).
      
      This was backported from master
      (cherry picked from commit 7fb75680)
      3f539c00
  15. 14 Sep, 2016 1 commit
    • Eli Zaretskii's avatar
      Avoid aborts in GC due to abort_on_gc · 5ad238bf
      Eli Zaretskii authored
      * src/lisp.h:
      * src/print.c (Fprin1_to_string):
      * src/eval.c (signal_or_quit):
      * src/alloc.c (garbage_collect_1): Remove declarations, setting,
      and testing the value of abort_on_gc.  It is no longer needed, and
      using it causes rare aborts in GC for no good reason.  (Bug#23912)
      5ad238bf
  16. 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
  17. 07 Aug, 2016 2 commits
  18. 24 Jul, 2016 1 commit
    • Paul Eggert's avatar
      ‘signal’ no longer returns · 50cc08bf
      Paul Eggert authored
      Although for decades ‘signal’ has been documented to not return,
      a corner case in the Lisp debugger causes ‘signal’ to return.
      Remove the corner case and adjust Emacs internals accordingly.
      An alternative would be to document the corner case, but this
      would complicate the Lisp API unnecessarily.  (Bug#24047)
      * src/eval.c (signal_or_quit): New function, with most of the
      old contents of Fsignal.
      (quit): New function, which uses signal_or_quit and which
      might return.  All keyboard-based callers of Fsignal (Qquit,
      Qnil) changed to use this new function instead.
      (Fsignal): Use signal_or_quit.  Now _Noreturn.  All callers
      changed.
      (xsignal): Move to lisp.h.
      * src/lisp.h (xsignal): Now an inline function, as it's now
      just an alias for Fsignal.
      50cc08bf
  19. 02 Apr, 2016 1 commit
  20. 27 Mar, 2016 1 commit
    • Paul Eggert's avatar
      func-arity minor improvements · bc9cc21d
      Paul Eggert authored
      * src/bytecode.c (get_byte_code_arity): Omit unnecessary
      runtime test for integer argument, unless debugging.
      Use EMACS_INT for Emacs integers.
      * src/eval.c (Ffunc_arity): Omit unused locals.
      Avoid side effects in ‘if’ expr.
      (lambda_arity): Use bool for boolean, and EMACS_INT for Emacs ints.
      bc9cc21d
  21. 26 Mar, 2016 1 commit
    • Paul Pogonyshev's avatar
      Implement 'func-arity' · 6f3243db
      Paul Pogonyshev authored
      * src/eval.c (Ffunc_arity, lambda_arity): New functions.
      * src/bytecode.c (get_byte_code_arity): New function.
      * src/lisp.h (get_byte_code_arity): Add prototype.
      
      * doc/lispref/functions.texi (What Is a Function): Document
      'func-arity'.
      
      * etc/NEWS: Mention 'func-arity'.
      
      * test/src/fns-tests.el (fns-tests-func-arity): New test set.
      6f3243db
  22. 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
  23. 15 Feb, 2016 1 commit
  24. 03 Feb, 2016 1 commit
    • Lars Ingebrigtsen's avatar
      Doc fixes and refactorings based on comments from Eli Zaretskii · 894e21df
      Lars Ingebrigtsen authored
      * doc/lispref/processes.texi (Network Processes): Clarify the
      meaning of :tls-parameters.
      
      * lisp/net/gnutls.el (open-gnutls-stream): Clarify :nowait.
      
      * lisp/net/gnutls.el (gnutls-boot-parameters): Factor out into
      own function.
      (gnutls-negotiate): Use it.
      (open-gnutls-stream): Ditto.
      
      * src/eval.c (vformat_string): Refactor out the printing bits
      from verror.
      (verror): Use it.
      
      * src/gnutls.c (boot_error): Mark failed processes with the
      real error message.
      
      * src/lisp.h: Declare vformat_string.
      894e21df
  25. 01 Jan, 2016 1 commit
  26. 26 Dec, 2015 2 commits
  27. 23 Nov, 2015 1 commit
  28. 20 Nov, 2015 1 commit
    • Paul Eggert's avatar
      Simplify push_handler and profile its malloc · aa7dac89
      Paul Eggert authored
      * src/lisp.h (PUSH_HANDLER): Remove.
      All callers changed to use push_handler directly.
      * src/eval.c (internal_condition_case)
      (internal_condition_case_1, internal_condition_case_2)
      (internal_condition_case_n):
      Use same pattern as for other invokers of push_handler.
      (push_handler, push_handler_nosignal): Use call-by-value
      instead of call-by-reference.  All uses changed.
      (push_handler): Simplify by rewriting in terms of
      push_handler_nosignal.
      (push_handler_nosignal): Profile any newly allocated memory.
      aa7dac89
  29. 19 Nov, 2015 2 commits
    • Paul Eggert's avatar
      Omit ‘const’ on locals · d9b300af
      Paul Eggert authored
      Remove ‘const’ qualifier from locals that were newly added.
      We don’t normally bother declaring locals with ‘const’ even
      though they are not modified, for the same reason we don’t
      bother declaring them with ‘register’ even though their
      addresses are not taken; the advantage in compile-time
      checking isn’t worth the loss of readability.
      * modules/mod-test/mod-test.c (Fmod_test_non_local_exit_funcall)
      (Fmod_test_vector_fill, Fmod_test_vector_eq):
      * src/emacs-module.c (MODULE_SETJMP_1)
      (module_make_global_ref, module_free_global_ref)
      (module_non_local_exit_get, module_make_function)
      (module_extract_integer, module_extract_float)
      (module_get_user_ptr, module_set_user_ptr)
      (module_get_user_finalizer, module_set_user_finalizer)
      (module_vec_get, Fmodule_call)
      (module_non_local_exit_signal_1)
      (module_non_local_exit_throw_1, lisp_to_value)
      (finalize_storage, allocate_emacs_value, mark_modules)
      (module_handle_signal, module_handle_throw)
      (module_format_fun_env):
      * src/eval.c (push_handler, push_handler_nosignal)
      (init_handler):
      * src/lread.c (suffix_p):
      Omit unnecessary ‘const’.
      d9b300af
    • Paul Eggert's avatar
      Fix minor module problems found by static checking · 62d787ed
      Paul Eggert authored
      * src/dynlib.c (dynlib_close): #ifdef out for now, as it’s not used.
      * src/eval.c, src/lisp.h (lisp_eval_depth): Now static.
      * src/module.c (Fmodule_load): Fix pointer signedness bug.
      (Fmodule_call): Tell GCC that the default case is unreachable.
      62d787ed
  30. 18 Nov, 2015 1 commit
    • Philipp Stephani's avatar
      Add catch-all & no-signal version of PUSH_HANDLER · 7cdc5d62
      Philipp Stephani authored
      Ground work for modules. Add a non-signaling version of PUSH_HANDLER and
      a new "catch-all" handler type.
      
      * src/eval.c (init_handler, push_handler, push_handler_nosignal): New
        functions.
      * src/fns.c (hash_remove_from_table): Expose function public.
      * src/lisp.h: New handler type, define macro to push_handler call.
      7cdc5d62
  31. 17 Nov, 2015 1 commit
    • Paul Eggert's avatar
      eval_sub followed dangling pointer when debugging · 54beeef1
      Paul Eggert authored
      Problem reported by Pip Cet (Bug#21245).
      This bug could occur in eval_sub if the C compiler reused
      storage associated with the ‘argvals’ local after ‘argvals’
      went out of scope, and if the Elisp debugger stopped on Elisp
      function exit and accessed ‘argvals’.  It could also occur if
      a variadic function was called with so many arguments (over
      2048 args on x86-64) that SAFE_ALLOCA_LISP called malloc, then
      SAFE_FREE freed the arguments, then the memory manager used
      the storage for other purposes, then the debugger accessed the
      arguments.
      * src/eval.c (eval_sub): Declare ‘argvals’ at top level of
      function body.	Simplify local decls.
      When allocating args via SAFE_ALLOCA, call
      debugger before invoking SAFE_FREE, as the debugger needs
      access to the args.
      (eval_sub, apply_lambda): Rework to avoid need for
      set_backtrace_debug_on_exit hack.  This is cleaner,
      and should work better with buggy custom debuggers.
      54beeef1
  32. 16 Nov, 2015 1 commit
  33. 16 Sep, 2015 1 commit
    • Paul Eggert's avatar
      Omit unnecessary \ before paren in C docstrings · 032ce1c7
      Paul Eggert authored
      Although \( is needed in docstrings in Elisp code, it is not needed in
      docstrings in C code, since C function definitiions do not start with
      a parenthesis.  The backslashes made the docstrings a bit harder to
      read and to format in columns.  Also, some C docstrings had ( in
      column 1 and this did not appear to be causing any problems.  So,
      simplify C docstrings by replacing \( with ( and \) with ).
      032ce1c7