aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* src/bytecode.c (exec_byte_code): Make hash_code a Lisp_Object.Vibhav Pant2017-02-111-2/+4
| | | | | This avoids using XUINT every time while comparing it with HASH_HASH (h, i), replacing it with EQ.
* src/bytecode.c (exec_byte_code): Remove unnecessary (e)assert.Vibhav Pant2017-02-111-4/+2
|
* ; src/bytecode.c (exec_byte_code): Refactor byte-switch code.Vibhav Pant2017-02-111-21/+14
| | | | Remove unnecessary asserts, remove duplicate code.
* src/bytecode.c: Add optional sanity check for jump tables.Vibhav Pant2017-02-111-3/+4
| | | | | * src/bytecode.c (exec_byte_code): When sanity checks are enabled, check that the jump table's size is equal to it's count.
* Merge branch 'master' into feature/byte-switchVibhav Pant2017-02-1110-269/+272
|\
| * Fix handling of XBM images on MS-WindowsEli Zaretskii2017-02-111-2/+2
| | | | | | | | | | * src/image.c (xbm_load) [HAVE_NTGUI]: Fix calculation of 'nbytes' when inverting XBM data bits. (Bug#25661)
| * Fix handling of PBM dataEli Zaretskii2017-02-111-1/+11
| | | | | | | | | | * src/image.c (pbm_load): Handle PBM data with no blanks between individual pixel values correctly. (Bug#25660)
| * Fix warnings in debug tracing codeNoam Postavsky2017-02-102-6/+6
| | | | | | | | | | | | * src/xdisp.c (dump_glyph, dump_glyph_string): * src/xfaces.c (dump_realized_face): Cast arguments or adjust format specifiers to match signedness.
| * Fix a few integer-overflow glitchesPaul Eggert2017-02-104-55/+50
| | | | | | | | | | | | | | | | | | | | * src/composite.c (composition_compute_stop_pos, composition_reseat_it): * src/dispextern.h (struct composition_it.rule_idx): * src/keyboard.c (Fset__this_command_keys): * src/xwidget.c (webkit_js_to_lisp): Don’t assume object sizes fit in ‘int’. * src/xwidget.c (Fxwidget_resize): Don’t assume Emacs integers fit in ‘int’.
| * Fix a bug with displaying an image after a TABEli Zaretskii2017-02-101-1/+4
| | | | | | | | | | * src/xdisp.c (display_line): Handle TAB at end of screen line specially only when we are displaying characters. (Bug#25662)
| * Restore special setting of this-command-keys by M-xEli Zaretskii2017-02-101-0/+25
| | | | | | | | | | | | | | | | | | | | It was lost when execute-extended-command was reimplemented in Lisp. * src/keyboard.c (Fset__this_command_keys): New function. (syms_of_keyboard): Defsubr it. * lisp/simple.el (execute-extended-command): Set this-command-keys as novice.el expects. (Bug#25612)
| * Make FOR_EACH_TAIL more like other FOR_EACH macrosPaul Eggert2017-02-063-111/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See comments by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2017-02/msg00181.html and by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2017-02/msg00207.html * src/fns.c (internal_equal): Do not bypass check for depth overflow when tail-recursing via a dotted list tail or an overlay plist, to avoid a rare infloop. * src/lisp.h (FOR_EACH_TAIL, FOR_EACH_TAIL_SAFE): Take TAIL as an arg, and update it at each iteration, rather than have callers access it.tail. All callers changed. (FOR_EACH_TAIL): Do not check for dotted lists, as this is now the caller’s responsibility. All callers changed. (FOR_EACH_TAIL_CONS): Remove. All callers changed. (struct for_each_tail_internal.tail): Remove; no longer needed. (FOR_EACH_TAIL_INTERNAL): Remove dotted arg, and set the tail arg each time through the loop. All callers changed.
| * Port to clang 3.8.0Paul Eggert2017-02-051-3/+9
| | | | | | | | | | | | It does not allow a for-loop's control var to be an anonymous struct. * src/lisp.h (struct for_each_tail_internal): New type. (FOR_EACH_TAIL_INTERNAL): Use it.
| * FOR_EACH_TAIL now checks for quitPaul Eggert2017-02-051-20/+32
| | | | | | | | | | | | | | | | | | As per Eli Zaretskii (Bug#25606#20). Although these calls to maybe_quit are unnecessary in practice, Eli was not convinced that the calls are unnecessary. * src/lisp.h (FOR_EACH_TAIL, FOR_EACH_TAIL_CONS): Call maybe_quit every so often. (FOR_EACH_TAIL_INTERNAL): New arg CHECK_QUIT. All callers changed.
| * Signal list cycles in ‘length’ etc.Paul Eggert2017-02-053-216/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use macros like FOR_EACH_TAIL instead of maybe_quit to catch list cycles automatically instead of relying on the user becoming impatient and typing C-g (Bug#25606). * src/fns.c (Flength, Fmember, Fmemq, Fmemql, Fassq, Fassoc, Frassq) (Frassoc, Fdelete, Freverse): Use FOR_EACH_TAIL instead of maybe_quit. (Fnreverse): Use simple EQ to check for circular list instead of rarely_quit, as this suffices in this unusual case. (Fplist_put, Flax_plist_put, Flax_plist_put): Use FOR_EACH_TAIL_CONS instead of maybe_quit. (internal_equal): Use FOR_EACH_TAIL_CONS to check lists, instead of by-hand tail recursion that did not catch cycles. * src/fns.c (Fsafe_length, Fplist_get): * src/xdisp.c (display_mode_element): Use FOR_EACH_TAIL_SAFE instead of by-hand Floyd’s algorithm. * src/lisp.h (QUIT_COUNT_HEURISTIC): Remove; no longer needed. (rarely_quit): Simply count toward USHRT_MAX + 1, since the fancier versions are no longer needed. (FOR_EACH_TAIL_CONS, FOR_EACH_TAIL_SAFE) (FOR_EACH_TAIL_INTERNAL): New macros, the last with definiens mostly taken from FOR_EACH_TAIL. (FOR_EACH_TAIL): Rewrite in terms of FOR_EACH_TAIL_INTERNAL.
| * Simplify use of FOR_EACH_TAILPaul Eggert2017-02-053-23/+33
| | | | | | | | | | | | | | | | * src/data.c (circular_list): New function. * src/lisp.h (FOR_EACH_TAIL): Use Brent’s algorithm and C99 for-loop decl, to eliminate the need for the args TAIL, TORTOISE and N, and to speed things up a bit on typical hosts with optimization. All uses changed (Bug#25605).
* | * src/bytecode.c: Refactor to follow GNU coding standardsVibhav Pant2017-02-111-14/+10
| |
* | src/bytecode.c: Avoid comparing values unnecessarily in BswitchVibhav Pant2017-02-101-2/+4
| | | | | | | | | | | | * src/bytecode.c: (exec_byte_code) While linear searching the jump table, compare the value's hash table first to avoid calling h->test.cmpfn every time.
* | src/bytecode.c (exec_byte_code): Remove unneeded assert.Vibhav Pant2017-02-091-6/+4
| |
* | bytecode.c (exec_byte_code): Use h->count instead of HASH_TABLE_SIZEVibhav Pant2017-02-091-2/+9
| |
* | bytecode.c (exec_byte_code): don't check hash code in linear search.Vibhav Pant2017-02-091-2/+4
| | | | | | | | | | | | | | | | * src/bytecode.c (exec_byte_code): Don't check that the hash code is not nil when linear scanning the jump table. Hash tables for are declared with :size as the exact number of cases, so each entry i should have a hash code. When BYTE_CODE_SAFE, do it as a sanity check.
* | Improve byte-switch execution.Vibhav Pant2017-02-091-8/+27
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-opt.el, lisp/emacs-lisp/bytecomp.el (byte-decompile-bytecode-1), (byte-compile-lapcode): Calculate the actual jump address while compiling, store it in the jump table. * src/bytecode.c: Jump to the looked up value directly, do a linear search when the number of elements is <= 5.
* | Merge remote-tracking branch 'origin/master' into feature/byte-switchVibhav Pant2017-02-0525-674/+510
|\ \ | |/
| * Re-port alloc.c to Solaris sparc and simplifyPaul Eggert2017-02-021-120/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 duplication. * 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.
| * Fix scrolling with partial linesNoam Postavsky2017-02-023-2/+30
| | | | | | | | | | | | | | * src/xdisp.c (partial_line_height): New function. (try_scrolling): * src/window.c (window_scroll_pixel_based): Use it for calculating the pixel scroll margin correctly in a window with partial lines.
| * Make limit on scroll-margin variableNoam Postavsky2017-02-022-5/+22
| | | | | | | | | | | | | | | | | | | | * src/xdisp.c (maximum-scroll-margin): New variable. * lisp/cus-start.el: Make it customizable. * etc/NEWS: Mention it. * doc/emacs/display.texi (Auto Scrolling): * doc/lispref/windows.texi (Textual Scrolling): Document it. * src/window.c (window_scroll_pixel_based): Use it instead of hardcoding division by 4 (Bug #5718).
| * Don't count mode line for scroll-margin limitNoam Postavsky2017-02-021-4/+2
| | | | | | | | | | * src/window.c (window_scroll_margin): Use window_box_height to avoid counting header line, scrollbars for scroll-margin limit (Bug #5718).
| * Refactor uses of scroll_margin to a functionNoam Postavsky2017-02-023-74/+39
| | | | | | | | | | | | | | | | | | | | | | Its effective range needs to be clamped between 0 and (window height / 4), so it's better to have this constraint in a single place. * src/window.c (window_scroll_margin): New function. (window_scroll_pixel_based, window_scroll_line_based): (Frecenter, Fmove_to_window_line): * src/xdisp.c (try_scrolling, try_cursor_movement): (redisplay_window, try_window, try_window_id): Use it.
| * Pacify Oracle Studio 12.5Paul Eggert2017-02-021-1/+1
| | | | | | | | * src/emacs.c (main): Do not silently convert char * to bool.
| * Fix lisp.h underparenthesizationPaul Eggert2017-02-021-3/+2
| | | | | | | | | | | | | | | | * src/lisp.h (STACK_CONS, AUTO_STRING_WITH_LEN): Parenthesize compound literals that are function call args. Although this does not fix any bugs, it is the proper style for macro parenthesization as it means this code will continue to work even if make_lisp_ptr is changed to a macro.
| * Fix quitting bug when buffers are frozenPaul Eggert2017-02-017-80/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem noted by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00721.html This patch also fixes some other issues in that report. * src/lisp.h (incr_rarely_quit): Remove. All callers changed to use rarely_quit directly. * src/search.c (freeze_buffer_relocation) (thaw_buffer_relocation): New functions. (looking_at_1, fast_looking_at, search_buffer): Use them to fix bug when quitting when buffers are frozen. * src/sysdep.c (emacs_intr_read): Rename from emacs_nointr_read. All uses changed.
| * Revamp quitting and fix infloopsPaul Eggert2017-02-0116-220/+295
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00577.html 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) (Fbackward_prefix_chars): 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.
| * Remove immediate_quit.Paul Eggert2017-02-0116-210/+28
| | | | | | | | | | | | | | | | | | The old code that sets and clears immediate_quit was ineffective except when Emacs is running in terminal mode, and has problematic race conditions anyway, so remove it. This will introduce some hangs when Emacs runs in terminal mode, and these hangs should be fixed in followup patches. * src/keyboard.c (immediate_quit): Remove. All uses removed.
| * * src/alloc.c, src/lisp.h: Fix minor glitches in recent changes.Paul Eggert2017-01-312-16/+12
| |
| * Revert two accidental commitsDima Kogan2017-01-312-54/+0
| | | | | | | | | | This reverts commit f3c77d11af65f3b319b1784b4c3cf08c51aa7997. This reverts commit 3c941b900007c9e79c00af0f21d88154f6d8af1a.
| * stashDima Kogan2017-01-302-0/+54
| |
| * Add delq list arg checkPaul Eggert2017-01-301-0/+1
| | | | | | | | | | * src/fns.c (Fdelq): Check that list is a proper list. This is more compatible with what ‘delete’ does.
| * More fixes to prevent crashes on C-gEli Zaretskii2017-01-301-3/+3
| | | | | | | | | | * src/fns.c (Fassq, Frassq, Fplist_put): Reset immediate_quit before returning, to avoid crashes in quit. (Bug#25566)
| * Avoid crashes on C-g in TTY sessionsEli Zaretskii2017-01-301-1/+1
| | | | | | | | | | | | * src/keyboard.c (handle_interrupt): Don't quit if waiting_for_input is set, as doing that is "unsafe": it will abort. (Bug#25566)
* | Merge remote-tracking branch 'origin/master' into feature/byte-switchVibhav Pant2017-01-3046-630/+652
|\ \ | |/
| * Fix hash tables not being purified correctly.Vibhav Pant2017-01-3010-16/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 CHECK_IMPURE. * 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).
| * Use access-file in EWW to check before downloading a fileMark Oteiza2017-01-281-1/+1
| | | | | | | | | | | | | | | | * lisp/net/eww.el (eww-download): Check accessibility of eww-download-directory to prevent starting a download that will fail to write. * src/fileio.c (Faccess_file): Clarify the use of string argument in the docstring.
| * Restore a test that was removed by a recent commitEli Zaretskii2017-01-271-1/+2
| | | | | | | | | | * src/fileio.c (Ffile_accessible_directory_p): Don't overwrite the errno value unless it's necessary. (Bug#25419)
| * Slightly tune file-accessible-directory-p fixPaul Eggert2017-01-271-7/+9
| | | | | | | | | | * src/fileio.c (Ffile_accessible_directory_p): Remove unnecessary test (Bug#25419).
| * Don't report zero errno for inaccessible directoryEli Zaretskii2017-01-271-1/+8
| | | | | | | | | | * src/fileio.c (Ffile_accessible_directory_p): Report EACCES when a file handler reports a failure. (Bug#25419)
| * Replace QUIT with maybe_quitPaul Eggert2017-01-2537-197/+192
| | | | | | | | | | | | | | | | 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.
| * A quicker check for quitPaul Eggert2017-01-256-68/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some microbenchmarks this lets Emacs run 60% faster on my platform (AMD Phenom II X4 910e, Fedora 25 x86-64). * src/atimer.c: Include keyboard.h, for pending_signals. * src/editfns.c (Fcompare_buffer_substrings): * src/fns.c (Fnthcdr, Fmemq, Fmemql, Fassq, Frassq, Fplist_put) (Fnconc, Fplist_member): Set and clear immediate_quit before and after loop instead of executing QUIT each time through the loop. This is OK for loops that affect only locals. * src/eval.c (process_quit_flag): Now static. (maybe_quit): New function, containing QUIT’s old body. * src/fns.c (rarely_quit): New function. (Fmember, Fassoc, Frassoc, Fdelete, Fnreverse, Freverse) (Flax_plist_get, Flax_plist_put, internal_equal, Fnconc): Use it instead of QUIT, for speed in tight loops that might modify non-locals. * src/keyboard.h (pending_signals, process_pending_signals): These belong to keyboard.c, so move them here ... * src/lisp.h: ... from here. (QUIT): Redefine in terms of the new maybe_quit function, which contains this macro’s old definiens. This works well with branch prediction on processors with return stack buffers, e.g., x86 other than the original Pentium.
| * Simplify make-list implementationPaul Eggert2017-01-251-33/+3
| | | | | | | | | | * src/alloc.c (Fmake_list): Don’t unroll loop, as the complexity is not worth it these days.
| * Build fix for older gnutls versionsLars Ingebrigtsen2017-01-251-0/+2
| | | | | | | | | | | | * src/gnutls.c (emacs_gnutls_handle_error): GNUTLS_E_PREMATURE_TERMINATION is apparently only present in gnutls-3.
| * Tweak TLS error messaging on closed connectionsLars Ingebrigtsen2017-01-251-1/+8
| | | | | | | | | | | | | | * src/gnutls.c (emacs_gnutls_handle_error): Demote the normal peer-closed-connection "The TLS connection was non-properly terminated" message to a lower level so that it isn't shown to the user by default.