1. 27 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Rename C names to match Lisp symbols better · f41f573e
      Paul Eggert authored
      This was inspired by commit e65c3079,
      which fixed a bug where the C name for a symbol disagreed with the
      symbol name itself.  Fix other instances of disagreements that I found.
      Although this doesn’t fix a bug, it should make code easier to follow.
      The remaining disagreements are idiosyncratic: Qminus, Qplus,
      Qsans__serif, Qbackquote, Qcomma, Qcomma_at, Qcomma_dot.
      All uses changed.
      * src/alloc.c (QAutomatic_GC): Rename from Qautomatic_gc.
      * src/dbusbind.c (QCsystem): Rename from QCdbus_system_bus.
      (QCsession): Rename from QCdbus_session_bus.
      (QCtimeout): Rename from QCdbus_timeout.
      (QCbyte): Rename from QCdbus_type_byte.
      (QCboolean): Rename from QCdbus_type_boolean.
      (QCint16): Rename from QCdbus_type_int16.
      (QCuint16): Rename from QCdbus_type_uint16.
      (QCint32): Rename from QCdbus_type_int32.
      (QCuint32): Rename from QCdbus_type_uint32.
      (QCint64): Rename from QCdbus_type_int64.
      (QCuint64): Rename from QCdbus_type_uint64.
      (QCdouble): Rename from QCdbus_type_double.
      (QCstring): Rename from QCdbus_type_string.
      (QCobject_path): Rename from QCdbus_type_object_path.
      (QCsignature): Rename from QCdbus_type_signature.
      (QCunix_fd): Rename from QCdbus_type_unix_fd.
      (QCarray): Rename from QCdbus_type_array.
      (QCvariant): Rename from QCdbus_type_variant.
      (QCstruct): Rename from QCdbus_type_struct.
      (QCdict_entry): Rename from QCdbus_type_dict_entry.
      (QCserial): Rename from QCdbus_registered_serial.
      (QCmethod): Rename from QCdbus_registered_method.
      (QCsignal): Rename from QCdbus_registered_signal.
      * src/emacs-module.c (Qinternal__module_call):
      Rename from Qinternal_module_call.
      * src/frame.c (Qwindow__pixel_to_total):
      Rename from Qwindow_pixel_to_total.
      * src/gnutls.c (QChostname): Rename from QCgnutls_bootprop_hostname.
      (QCpriority): Rename from QCgnutls_bootprop_priority.
      (QCtrustfiles): Rename from QCgnutls_bootprop_trustfiles.
      (QCkeylist): Rename from QCgnutls_bootprop_keylist.
      (QCcrlfiles): Rename from QCgnutls_bootprop_crlfiles.
      (QCmin_prime_bits): Rename from QCgnutls_bootprop_min_prime_bits.
      (QCloglevel): Rename from QCgnutls_bootprop_loglevel.
      (QCcomplete_negotiation): Rename from QCgnutls_complete_negotiation.
      (QCverify_flags): Rename from QCgnutls_bootprop_verify_flags.
      (QCverify_error): Rename from QCgnutls_bootprop_verify_error.
      * src/w32fns.c (Qfont_parameter): Rename from Qfont_param.
      (Qgnutls): Rename from Qgnutls_dll.
      (Qlibxml2): Rename from Qlibxml2_dll.
      (Qzlib): Rename from Qzlib_dll.
      * src/w32select.c (Qutf_16le_dos): Rename from QUNICODE.
      * src/window.c (Qwindow__resize_root_window):
      Rename from Qwindow_resize_root_window.
      (Qwindow__resize_root_window_vertically):
      Rename from Qwindow_resize_root_window_vertically.
      (Qwindow__sanitize_window_sizes):
      Rename from Qwindow_sanitize_window_sizes.
      (Qwindow__pixel_to_total): Rename from Qwindow_pixel_to_total.
      * src/xdisp.c (Qredisplay_internal_xC_functionx):
      Rename from Qredisplay_internal.
      * src/xfns.c (Qfont_parameter): Rename from Qfont_param.
      * src/xselect.c (Q_EMACS_TMP_): Rename from QEMACS_TMP.
      f41f573e
  2. 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
  3. 01 Jan, 2016 1 commit
  4. 31 Jul, 2015 1 commit
    • Paul Eggert's avatar
      Fix some int overflows in profiler.c · 0f23e95b
      Paul Eggert authored
      * src/profiler.c (make_log): Make args EMACS_INT, not int,
      to avoid unwanted behavior on 'int' overflow.
      (make_log, evict_lower_half, record_backtrace):
      Use ptrdiff_t, not int, for object indexes.
      0f23e95b
  5. 22 Jun, 2015 2 commits
    • Ken Brown's avatar
      Enable CPU profiling on Cygwin · 531125e4
      Ken Brown authored
      * src/syssignal.h [CYGWIN] (PROFILER_CPU_SUPPORT): Revert previous
      change that undefined this.
      (SIGEV_SIGNAL): Ensure that this is defined as a macro.
      * src/profiler.c [CYGWIN] (timer_getoverrun): Define as a macro on
        Cygwin.
      531125e4
    • Ken Brown's avatar
      Improve diagnostics of profiler-cpu-start · dc30fb92
      Ken Brown authored
      * src/profiler.c (setup_cpu_timer): Change return type to 'int';
      return -1 if the sampling interval is invalid.
      (Fprofiler_cpu_start): Improve error message if 'setup_cpu_timer'
      fails.  (Bug#20843)
      dc30fb92
  6. 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
  7. 01 Jan, 2015 2 commits
  8. 01 May, 2014 1 commit
    • Glenn Morris's avatar
      Doc fixes · d136f184
      Glenn Morris authored
      * doc/misc/autotype.texi (Skeleton Language):
      * doc/misc/message.texi (Header Commands):
      * lisp/allout-widgets.el (allout-widgets-tally)
      (allout-decorate-item-guides):
      * lisp/menu-bar.el (menu-bar-positive-p):
      * lisp/minibuffer.el (completion-pcm-complete-word-inserts-delimiters):
      * lisp/cedet/ede.el (ede-project-directories, ede-check-project-directory):
      * lisp/cedet/semantic/ia-sb.el (semantic-ia-sb-show-doc):
      * lisp/cedet/semantic/tag.el (semantic-tag-in-buffer-p):
      * lisp/cedet/semantic/bovine/c.el (semantic-tag-abstract-p):
      * lisp/gnus/gnus-registry.el (gnus-registry-install-p): Doc fix.
      * lisp/progmodes/gdb-mi.el (gdbmi-same-start, gdbmi-is-number):
      * lisp/progmodes/js.el (js--inside-param-list-p)
      (js--inside-dojo-class-list-p, js--forward-destructuring-spec):
      * lisp/progmodes/prolog.el (region-exists-p):
      * lisp/progmodes/verilog-mode.el (verilog-scan-cache-ok-p):
      * lisp/textmodes/reftex-parse.el (reftex-using-biblatex-p):
      * lisp/url/url-parse.el (url-generic-parse-url):
      * src/floatfns.c (Fisnan):
      * src/profiler.c (Fprofiler_cpu_running_p):
      Doc fixes (replace `iff').
      
      Fixes: debbugs:17309
      d136f184
  9. 05 Apr, 2014 1 commit
    • Paul Eggert's avatar
      Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'. · faa52174
      Paul Eggert authored
      * alloc.c (memory_full):
      * charset.c (syms_of_charset):
      * doc.c (Fsnarf_documentation):
      * emacs.c (main):
      * font.c (BUILD_STYLE_TABLE):
      * keyboard.c (make_lispy_event):
      * profiler.c (setup_cpu_timer):
      * xgselect.c (xg_select):
      * xterm.c (record_event, STORE_KEYSYM_FOR_DEBUG):
      Use ARRAYELTS.
      * font.c (FONT_PROPERTY_TABLE_SIZE): Remove.
      Replace the only use with ARRAYELTS (font_property_table).
      * xfaces.c (DIM): Remove.  All uses replaced by ARRAYELTS.
      faa52174
  10. 01 Jan, 2014 1 commit
  11. 27 Aug, 2013 1 commit
    • Paul Eggert's avatar
      Simplify EMACS_TIME-related code. · 43aac990
      Paul Eggert authored
      This portability layer is no longer needed, since Emacs has been
      using struct timespec as a portability layer for some time.
      Merge from gnulib, incorporating:
      2013-08-27 timespec: new convenience constants and function
      * src/atimer.h, src/buffer.h, src/dispextern.h, src/xgselect.h:
      Include <time.h> rather than "systime.h"; that's all that's needed now.
      * src/dispnew.c: Include <timespec.h> rather than "systime.h";
      that's all that's needed now.
      * src/systime.h (EMACS_TIME): Remove.  All uses changed to struct timespec.
      (EMACS_TIME_RESOLUTION): Remove.  All uses changed to
      TIMESPEC_RESOLUTION.
      (LOG10_EMACS_TIME_RESOLUTION): Remove.  All uses changed to
      LOG10_TIMESPEC_RESOLUTION.
      (EMACS_SECS, emacs_secs_addr): Remove.  All uses changed to tv_sec.
      (EMACS_NSECS): Remove.  All uses changed to tv_nsec.
      (make_emacs_time): Remove.  All used changed to make_timespec.
      (invalid_timespec): Rename from invalid_emacs_time.  All uses changed.
      (current_timespec): Rename from current_emacs_time.  All uses changed.
      (add_emacs_time): Remove.  All uses changed to timespec_add.
      (sub_emacs_time): Remove.  All uses change dot timespec_sub.
      (EMACS_TIME_SIGN): Remove.  All uses changed to timespec_sign.
      (timespec_valid_p): Rename from EMACS_TIME_VALID_P.  All uses changed.
      (EMACS_TIME_FROM_DOUBLE): Remove.  All uses changed to dtotimespec.
      (EMACS_TIME_TO_DOUBLE): Remove.  All uses changed to timespectod.
      (current_timespec): Rename from current_emacs_time.  All uses changed.
      (EMACS_TIME_EQ, EMACS_TIME_LT, EMACS_TIME_LE): Remove.  All uses
      changed to timespec_cmp.
      * src/xgselect.c: Include <timespec.h>, since our .h files don't.
      43aac990
  12. 10 Jul, 2013 1 commit
    • Paul Eggert's avatar
      Port to C89. · 29abe551
      Paul Eggert authored
      * lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ...
      (usage_message): ... and replace it with this new static constant
      containing multiple literals.  All uses changed.
      * lib-src/emacsclient.c (print_help_and_exit):
      Rewrite to avoid string literals longer than the C89 limits.
      (start_daemon_and_retry_set_socket):
      Rewrite to avoid non-constant array initializer.
      * lib-src/make-docfile.c (enum global_type): Omit trailing comma.
      * src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
      (B__dummy__): New dummy symbol, to pacify C89.
      * src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
      they can't grok varargs macros.
      * src/dispnew.c (add_window_display_history)
      (add_frame_display_history):
      * src/print.c (print_object):
      * src/xdisp.c (debug_method_add):
      Use %p printf format only for void pointers.
      * src/emacs.c (usage_message): New constant, replacing ...
      (USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
      (main): Adjust to usage reorg.
      * src/fns.c (syms_of_fns):
      * src/profiler.c (syms_of_profiler):
      Don't use non-constant struct initializers.
      * src/gnutls.h (gnutls_initstage_t):
      * src/lisp.h (enum Lisp_Fwd_Type):
      * src/lread.c (lisp_file_lexically_bound_p):
      * src/xsettings.c (anonymous enum):
      Remove trailing comma.
      * src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
      * src/lisp.h (ENUM_BF): Use unsigned if pedantic.
      (DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
      (DEFUN): Use it.
      * src/regex.c (const_re_char): New type, to pacify strict C89.
      All uses of 'const re_char' replaced to use it.
      * src/regex.h (_Restrict_): Rename from __restrict, to avoid clash
      with glibc when strict C89.  This change is imported from gnulib.
      All uses changed.
      (_Restrict_arr_): Rename from __restrict_arr, similarly.
      * src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
      Omit GNU_LINUX implementation, since it requires long long.
      * src/xterm.c (x_draw_underwave):
      Do not assume the traditional order of struct's members.
      (x_term_init): Rewrite to avoid the need for non-constant structure
      initializers.
      29abe551
  13. 03 Jun, 2013 1 commit
    • Stefan Monnier's avatar
      Merge the specpdl and backtrace stacks. Make the structure of the · 2f592f95
      Stefan Monnier authored
      specpdl entries more obvious via a tagged union of structs.
      * src/lisp.h (BITS_PER_PTRDIFF_T): New constant.
      (enum specbind_tag): New enum.
      (struct specbinding): Make it a tagged union of structs.
      Add a case for backtrace records.
      (specpdl_symbol, specpdl_old_value, specpdl_where, specpdl_arg)
      (specpdl_func, backtrace_function, backtrace_nargs, backtrace_args)
      (backtrace_debug_on_exit): New accessors.
      (struct backtrace): Remove.
      (struct catchtag): Remove backlist field.
      * src/data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p):
      Move to eval.c.
      (Flocal_variable_p): Speed up the common case where the binding is
      already loaded.
      * src/eval.c (backtrace_list): Remove.
      (set_specpdl_symbol, set_specpdl_old_value): Remove.
      (set_backtrace_args, set_backtrace_nargs)
      (set_backtrace_debug_on_exit, backtrace_p, backtrace_top)
      (backtrace_next): New functions.
      (Fdefvaralias, Fdefvar): Adjust to new specpdl format.
      (unwind_to_catch, internal_lisp_condition_case)
      (internal_condition_case, internal_condition_case_1)
      (internal_condition_case_2, internal_condition_case_n): Don't bother
      with backtrace_list any more.
      (Fsignal): Adjust to new backtrace format.
      (grow_specpdl): Move up.
      (record_in_backtrace): New function.
      (eval_sub, Ffuncall): Use it.
      (apply_lambda): Adjust to new backtrace format.
      (let_shadows_buffer_binding_p, let_shadows_global_binding_p): Move from
      data.c.
      (specbind): Adjust to new specpdl format.  Simplify.
      (record_unwind_protect, unbind_to): Adjust to new specpdl format.
      (Fbacktrace_debug, Fbacktrace, Fbacktrace_frame): Adjust to new
      backtrace format.
      (mark_backtrace): Remove.
      (mark_specpdl, get_backtrace, backtrace_top_function): New functions.
      * src/xdisp.c (redisplay_internal): Use record_in_backtrace.
      * src/alloc.c (Fgarbage_collect): Use record_in_backtrace.
      Use mark_specpdl.
      * src/profiler.c (record_backtrace): Use get_backtrace.
      (handle_profiler_signal): Use backtrace_top_function.
      * src/.gdbinit (xbacktrace, hookpost-backtrace): Use new backtrace
      accessor functions.
      2f592f95
  14. 24 Mar, 2013 1 commit
    • Andreas Schwab's avatar
      Reorder conditions that are written backwards · 908589fd
      Andreas Schwab authored
      * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are
      written backwards.
      * blockinput.h (input_blocked_p): Likewise.
      * bytecode.c (exec_byte_code): Likewise.
      * callproc.c (call_process_kill, call_process_cleanup)
      (Fcall_process): Likewise.
      * ccl.c (ccl_driver, resolve_symbol_ccl_program)
      (Fccl_execute_on_string): Likewise.
      * character.c (string_escape_byte8): Likewise.
      * charset.c (read_hex): Likewise.
      * cm.c (calccost): Likewise.
      * data.c (cons_to_unsigned): Likewise.
      * dired.c (directory_files_internal, file_name_completion):
      Likewise.
      * dispnew.c (scrolling_window, update_frame_1, Fsleep_for)
      (sit_for): Likewise.
      * doc.c (Fsubstitute_command_keys): Likewise.
      * doprnt.c (doprnt): Likewise.
      * editfns.c (hi_time, decode_time_components, Fformat): Likewise.
      * emacsgtkfixed.c: Likewise.
      * fileio.c (file_offset, Fwrite_region): Likewise.
      * floatfns.c (Fexpt, fmod_float): Likewise.
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      Likewise.
      * font.c (font_intern_prop): Likewise.
      * frame.c (x_set_alpha): Likewise.
      * gtkutil.c (get_utf8_string): Likewise.
      * indent.c (check_display_width): Likewise.
      * intervals.c (create_root_interval, rotate_right, rotate_left)
      (split_interval_right, split_interval_left)
      (adjust_intervals_for_insertion, delete_node)
      (interval_deletion_adjustment, adjust_intervals_for_deletion)
      (merge_interval_right, merge_interval_left, copy_intervals)
      (set_intervals_multibyte_1): Likewise.
      * keyboard.c (gobble_input, append_tool_bar_item): Likewise.
      * keymap.c (Fkey_description): Likewise.
      * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise.
      * lread.c (openp, read_integer, read1, string_to_number):
      Likewise.
      * menu.c (ensure_menu_items): Likewise.
      * minibuf.c (read_minibuf_noninteractive): Likewise.
      * print.c (printchar, strout): Likewise.
      * process.c (create_process, Faccept_process_output)
      (wait_reading_process_output, read_process_output, send_process)
      (wait_reading_process_output): Likewise.
      * profiler.c (make_log, handle_profiler_signal): Likewise.
      * regex.c (re_exec): Likewise.
      * regex.h: Likewise.
      * search.c (looking_at_1, Freplace_match): Likewise.
      * sysdep.c (get_child_status, procfs_ttyname)
      (procfs_get_total_memory): Likewise.
      * systime.h (EMACS_TIME_VALID_P): Likewise.
      * term.c (dissociate_if_controlling_tty): Likewise.
      * window.c (get_phys_cursor_glyph): Likewise.
      * xdisp.c (init_iterator, redisplay_internal, redisplay_window)
      (try_window_reusing_current_matrix, try_window_id, pint2hrstr):
      Likewise.
      * xfns.c (Fx_window_property): Likewise.
      * xmenu.c (set_frame_menubar): Likewise.
      * xselect.c (x_get_window_property, x_handle_dnd_message):
      Likewise.
      * xsmfns.c (smc_save_yourself_CB): Likewise.
      * xterm.c (x_scroll_bar_set_handle): Likewise.
      908589fd
  15. 09 Feb, 2013 1 commit
    • Paul Eggert's avatar
      Minor hashing refactoring. · eff1c190
      Paul Eggert authored
      * fns.c (SXHASH_REDUCE): Move to lisp.h.
      (sxhash_float): Return EMACS_UINT, for consistency with the other
      hash functions.
      * lisp.h (INTMASK): Now a macro, since SXHASH_REDUCE is now a
      non-static inline function and therefore can't use static vars.
      (SXHASH_REDUCE): Move here from fns.c, and make it inline.
      * profiler.c (hashfn_profiler): Use SXHASH_REDUCE, to be consistent
      with the other hash functions.
      eff1c190
  16. 01 Jan, 2013 1 commit
  17. 08 Nov, 2012 3 commits
    • Stefan Monnier's avatar
      * src/lisp.h (XHASH): Redefine to be imperfect and fit in a Lisp int. · 61ddb1b9
      Stefan Monnier authored
      * src/fns.c (hashfn_eq, hashfn_eql, sxhash):
      * src/profiler.c (hashfn_profiler): Don't use XUINT on non-integers.
      * src/buffer.c (compare_overlays): Use XLI rather than XHASH.
      61ddb1b9
    • Paul Eggert's avatar
      Use same hash function for hashfn_profiler as for hash_string etc. · 04a2d0d3
      Paul Eggert authored
      * fns.c (SXHASH_COMBINE): Remove.  All uses replaced by sxhash_combine.
      * lisp.h (sxhash_combine): New inline function, with the contents
      of the old SXHASH_COMBINE.
      * profiler.c (hashfn_profiler): Use it, instead of having a
      special hash function containing a comparison that always yields 1.
      04a2d0d3
    • Stefan Monnier's avatar
      Use ad-hoc comparison function for the profiler's hash-tables. · b7432bb2
      Stefan Monnier authored
      * src/profiler.c (Qprofiler_backtrace_equal, hashtest_profiler): New vars.
      (make_log): Use them.
      (handle_profiler_signal): Don't inhibit quit any longer since we don't
      call Fequal any more.
      (Ffunction_equal): New function.
      (cmpfn_profiler, hashfn_profiler): New functions.
      (syms_of_profiler): Initialize them.
      * src/lisp.h (struct hash_table_test): New struct.
      (struct Lisp_Hash_Table): Use it.
      * src/alloc.c (mark_object): Mark hash_table_test fields of hash tables.
      * src/fns.c (make_hash_table): Take a struct to describe the test.
      (cmpfn_eql, cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql)
      (hashfn_equal, hashfn_user_defined): Adjust to new calling convention.
      (hash_lookup, hash_remove_from_table): Move assertion checking of
      hashfn result here.  Check hash-equality before calling cmpfn.
      (Fmake_hash_table): Adjust call to make_hash_table.
      (hashtest_eq, hashtest_eql, hashtest_equal): New structs.
      (syms_of_fns): Initialize them.
      * src/emacs.c (main): Move syms_of_fns earlier.
      * src/xterm.c (syms_of_xterm):
      * src/category.c (hash_get_category_set): Adjust call to make_hash_table.
      * src/print.c (print_object): Adjust to new hash-table struct.
      * src/composite.c (composition_gstring_put_cache): Adjust to new hashfn.
      b7432bb2
  18. 04 Oct, 2012 2 commits
    • Paul Eggert's avatar
      * profiler.c (handle_profiler_signal): Inhibit pending signals too, · 88d69b7d
      Paul Eggert authored
      to avoid similar races.
      * keyboard.c (pending_signals): Now bool, not int.
      88d69b7d
    • Paul Eggert's avatar
      Port timers to OpenBSD, plus check for timer failures. · 2b794d69
      Paul Eggert authored
      OpenBSD problem reported by Han Boetes.
      * profiler.c (setup_cpu_timer): Check for failure of timer_settime
      and/or setitimer.
      (Fprofiler_cpu_stop): Don't assume HAVE_SETITIMER.
      * syssignal.h (HAVE_ITIMERSPEC): New macro.  This is for platforms
      like OpenBSD, which has timer_settime but does not declare it.
      OpenBSD does not define SIGEV_SIGNAL, so use that when deciding
      whether to use itimerspec-related primitives.  All uses of
      HAVE_TIMER_SETTIME replaced with HAVE_ITIMERSPEC.
      2b794d69
  19. 02 Oct, 2012 2 commits
    • Paul Eggert's avatar
      * profiler.c (handle_profiler_signal): Fix a malloc race · a3c5c0c5
      Paul Eggert authored
      that caused Emacs to hang on Fedora 17 when profiling Lisp.
      a3c5c0c5
    • Paul Eggert's avatar
      Count overruns when profiling; change units to ns. · b3ecad33
      Paul Eggert authored
      * lisp/profiler.el (profiler-sampling-interval): Change units
      from ms to ns, multiplying the default by 1000000 so that
      it remains 1 ms.
      (profiler-report-cpu-line-format): Give enough room for
      the maximum counters on 64-bit hosts.
      (profiler-report-render-calltree-1): Call them "CPU samples",
      not "Time (ms)", since they are not milliseconds now (and
      never really were).
      * src/profiler.c (handle_profiler_signal): Count sampling intervals, not ms.
      Give extra weight to samples after overruns, to attempt to count
      the time more accurately.
      (setup_cpu_timer): Change sampling interval units from ms to ns, since
      the underlying primitives nominally do ns.
      (Fprofiler_cpu_start): Document the change.  Mention that
      the sampling intervals are only approximate.
      b3ecad33
  20. 30 Sep, 2012 4 commits
    • Tomohiro Matsuyama's avatar
      * profiler.el (profiler-sampling-interval): Rename from · c22bac2c
      Tomohiro Matsuyama authored
      profiler-sample-interval.
      (profiler-sampling-interval): Default to 10.
      (profiler-find-profile): New command (was profiler-find-log).
      (profiler-find-profile-other-window): New command.
      (profiler-find-profile-other-frame): New command.
      (profiler-profile): Introduce API-level data structure.
      c22bac2c
    • Eli Zaretskii's avatar
      Support atimers and CPU profiler via profile.c on MS-Windows. · c06c382a
      Eli Zaretskii authored
       src/w32proc.c (sig_mask, crit_sig): New static variables.
       (sys_signal): Support SIGALRM and SIGPROF.
       (sigemptyset, sigaddset, sigfillset, sigprocmask)
       (pthread_sigmask, setpgrp): Moved here from w32.c.  sigaddset,
       sigfillset, and sigprocmask are no longer no-ops.
       (sigismember): New function.
       (struct itimer_data): New definition.
       (ticks_now, real_itimer, prof_itimer, clocks_min, crit_real)
       (crit_prof): New static variables.
       (MAX_SINGLE_SLEEP): New definition.
       (timer_loop, stop_timer_thread, term_timers, init_timers)
       (start_timer_thread, getitimer, setitimer): New functions.
       (alarm): No longer a no-op, calls setitimer.
       src/w32.c (term_ntproc): Call term_timers.
       (init_ntproc): Make sure all signals are unblocked at startup, to
       erase any traces of dumping.  Call init_timers.
       src/w32fns.c (hourglass_timer, HOURGLASS_ID): Remove.
       Windows-specific code to display the hourglass mouse pointer is no
       longer used.
       (w32_wnd_proc): Remove code that handled the WM_TIMER message due
       to hourglass timer expiration.
       (start_hourglass, cancel_hourglass, DEFAULT_HOURGLASS_DELAY):
       Remove, no longer used.
       (w32_note_current_window, show_hourglass, hide_hourglass): New
       functions, in support of hourglass cursor display similar to other
       window systems.
       (syms_of_w32fns): Don't initialize hourglass_timer.
       src/xdisp.c (start_hourglass, cancel_hourglass): Now used on
       WINDOWSNT as well.
       (start_hourglass) [WINDOWSNT]: Call w32_note_current_window.
       src/w32.h (init_timers, term_timers): Add prototypes.
      
       nt/inc/sys/time.h (ITIMER_REAL, ITIMER_PROF): Define.
       (struct itimerval): Define.
       (getitimer, setitimer): Add prototypes.
       nt/inc/ms-w32.h <sigset_t> [_MSVC_VER]: Make the typedef consistent
       with MinGW.
       (SA_RESTART, SIGPROF): Define.
       nt/config.nt (HAVE_SETITIMER): Define to 1.
      c06c382a
    • Eli Zaretskii's avatar
      Fix compilation failure introduced in 2012-09-30T06:19:33Z!eggert@cs.ucla.edu. · 84f72efd
      Eli Zaretskii authored
       src/profiler.c (Fprofiler_cpu_stop): Use timer_settime only if
       HAVE_TIMER_SETTIME is defined.
      84f72efd
    • Paul Eggert's avatar
      Profiler improvements: more-accurate timers, overflow checks. · d89460ed
      Paul Eggert authored
      * profiler.c: Don't include stdio.h, limits.h, sys/time.h,
      signal.h, setjmp.h.  Include systime.h instead.
      (saturated_add): New function.
      (record_backtrace, current_sample_interval): Use EMACS_INT, not size_t.
      (record_backtrace, handle_profiler_signal): Saturate on fixnum overflow.
      (profiler_timer, profiler_timer_ok) [HAVE_TIMER_SETTIME]:
      New static vars.
      (enum profiler_cpu_running): New enumn.
      (profiler_cpu_running): Now of that enum type, not bool.
      All uses changed to store the new value.
      (handle_profiler_signal): Rename from sigprof_handler_1,
      for consistency with other handlers.  Do not check whether
      cpu_log is a hash-table if garbage collecting, since it
      doesn't matter in that case.
      (deliver_profiler_signal): Rename from sigprof_handler,
      for consistency with other handlers.
      (setup_cpu_timer): New function, with much of what used to be in
      Fprofiler_cpu_start.  Check for out-of-range argument.
      Prefer timer_settime if available, and prefer
      thread cputime clocks, then process cputime clocks, then
      monotonic clocks, to the old realtime clock.  Use make_timeval
      to round more-correctly when falling back to setitimer.
      (Fprofiler_cpu_start): Use it.
      (Fprofiler_cpu_stop): Prefer timer_settime if available.
      Don't assume that passing NULL as the 2nd argument of setitimer
      is the same as passing a pointer to all-zero storage.
      Ignore SIGPROF afterwards.
      (malloc_probe): Saturate at MOST_POSITIVE_FIXNUM.
      * sysdep.c (emacs_sigaction_init): Also mask out SIGPROF in
      non-fatal signal handlers.  Ignore SIGPROF on startup.
      * syssignal.h (PROFILER_CPU_SUPPORT): Define this macro here, not
      in profiler.c, since sysdep.c now uses it.
      d89460ed
  21. 29 Sep, 2012 1 commit
  22. 28 Sep, 2012 1 commit
  23. 26 Sep, 2012 3 commits
  24. 25 Sep, 2012 1 commit
  25. 24 Sep, 2012 2 commits
    • Stefan Monnier's avatar
      Try to let it compile on other platforms · ad942b63
      Stefan Monnier authored
      * src/profiler.c (evict_lower_half): Fix typo.
      (PROFILER_CPU_SUPPORT): Check and define if cpu-profiler is supported.
      Don't compile the cpu-profiler code, if not supported.
      (malloc_probe): Presume memory_log is non-nil.
      (syms_of_profiler): Don't defsubr functions when they aren't defined.
      * src/lisp.h (sample_profiler_running, gc_probe): Don't declare.
      ad942b63
    • Stefan Monnier's avatar
      Rewrite sampler to use Elisp hash-tables. · 3d80c99f
      Stefan Monnier authored
      * src/profiler.c: Remove filtering functionality.
      (is_in_trace, Qgc): Remove vars.
      (make_log, record_backtrace, Fsample_profiler_log):
      Rewrite, using Elisp hash-tables.
      (approximate_median, evict_lower_half): New functions.
      (cpu_log): Rename from sample_log.
      (cpu_gc_count): New var.
      (Fsample_profiler_reset, Fmemory_profiler_reset): Remove.
      (sigprof_handler): Add count to cpu_gc_count during GC, detected via
      backtrace_list.
      (block_sigprof, unblock_sigprof): Remove.
      (gc_probe, mark_profiler): Remove functions.
      (syms_of_profiler): Staticpro cpu_log and memory_log.
      
      * lisp/profiler.el (profiler-sample-interval): Move before first use.
      Change default to 1ms.
      (profiler-entry=, profiler-backtrace-reverse, profiler-log-fixup-slot)
      (profiler-calltree-elapsed<, profiler-calltree-elapsed>): Remove functions.
      (profiler-entry-format): Don't use type-of.
      (profiler-slot, profiler-log): Remove structs.
      (profiler-log-timestamp, profiler-log-type, profiler-log-diff-p):
      Redefine for new log representation.
      (profiler-log-diff, profiler-log-fixup, profiler-calltree-build-1):
      Rewrite for new log representation.
      (profiler-calltree): Remove `elapsed' fields.
      (profiler-calltree-count<, profiler-report-make-entry-part):
      Remove gc special case.
      (profiler-calltree-find): Use equal.
      (profiler-calltree-walk): Remove `args'; rely on closures instead.
      (profiler-calltree-compute-percentages-1): Remove; inlined.
      (profiler-calltree-compute-percentages): Simplify.
      (profiler-report-log, profiler-report-reversed)
      (profiler-report-order): Use defvar-local.
      (profiler-report-line-format): Remove `elapsed', do a bit of CSE.
      (profiler-report-mode-map): Remove up/down bindings.
      (profiler-report-make-buffer-name): Simplify by CSE.
      (profiler-report-mode): Remove redundant code.
      (profiler-report-expand-entry, profiler-report-collapse-entry):
      Use inhibit-read-only.
      (profiler-report-render-calltree-1): Simplify by CSE.
      (profiler-reset): Rewrite for new subroutines.
      (profiler--report-cpu): Rename from sample-profiler-report.
      (profiler--report-memory): Rename from memory-profiler-report.
      
      * src/alloc.c (Fgarbage_collect): Record itself in backtrace_list.
      Don't set is_in_trace any more.  Don't call mark_profiler.
      Only call gc_probe for the memory profiler.
      (syms_of_alloc): Define Qautomatic_gc.
      
      * src/lisp.h (SXHASH_COMBINE): Move back to...
      * src/fns.c (SXHASH_COMBINE): ...here.
      
      * src/xdisp.c (Qautomatic_redisplay): New constant.
      (redisplay_internal): Record itself in backtrace_list.
      (syms_of_xdisp): Define Qautomatic_redisplay.
      
      * .dir-locals.el (indent-tabs-mode): Remove personal preference.
      3d80c99f
  26. 23 Aug, 2012 1 commit
  27. 22 Aug, 2012 2 commits