From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Gramiak Newsgroups: gmane.emacs.devel Subject: Re: Using __builtin_expect (likely/unlikely macros) Date: Tue, 16 Apr 2019 15:11:58 -0600 Message-ID: <87o955bqox.fsf@gmail.com> References: <87a7gst973.fsf@gmail.com> <875zrgt12q.fsf@gmail.com> <6919a4c8-df76-ea1e-34db-1fa62a360e5a@cs.ucla.edu> <87h8aykdod.fsf@gmail.com> <4fa7885e-8c66-c7c4-ff71-a013505863af@cs.ucla.edu> <2dfb837d-989d-c736-b6e6-b20c0e940596@cs.ucla.edu> <87o956c4n4.fsf@gmail.com> <1fbd2fca-18f0-0a90-7a45-58419a9e11ee@cs.ucla.edu> <87sguhbrof.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="212426"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 16 23:12:58 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGVNx-000t5e-Vc for ged-emacs-devel@m.gmane.org; Tue, 16 Apr 2019 23:12:58 +0200 Original-Received: from localhost ([127.0.0.1]:42902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGVNw-00089m-W7 for ged-emacs-devel@m.gmane.org; Tue, 16 Apr 2019 17:12:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGVNJ-00089f-8H for emacs-devel@gnu.org; Tue, 16 Apr 2019 17:12:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGVND-0004eM-Lc for emacs-devel@gnu.org; Tue, 16 Apr 2019 17:12:15 -0400 Original-Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:40319) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hGVN7-0004ZH-2C for emacs-devel@gnu.org; Tue, 16 Apr 2019 17:12:07 -0400 Original-Received: by mail-pg1-x536.google.com with SMTP id d31so10927258pgl.7 for ; Tue, 16 Apr 2019 14:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=rliWa7gOooTES5ohyjRCwr7ZUsA50ykkqQhjqdh5GFc=; b=Y15fuY9Td7+K6bHdBwcnEta0ifLuwlDDweQw68J2sxk7KfFRScfcz7KICriRslf1Xv 6VIdjbEr5LPCrsL4zY0OUYNzMayx7q3O7dWuFE9+LsNCpxJlo9T3ZSwTs3j0j3YoCx94 VPLrVtb+vhP4kD5oPMzye8cSH5Nz8e0DC8sLrqMlKRziiZ8CkPhrG1t4r45GF7k+miAg eXK/FXNFx5ADg0585zu/wR/14W9BdzEqhHX6kgOzNOoa77ZEqOs2Bu8XWgwNoAdAvsyw iz5qCIpXL9rudGPElrKAUX2OnZHgjtq3oWBF1u9OZY/1D0Wc1tyLYJGJs3fxkmBQUB5z Tvlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=rliWa7gOooTES5ohyjRCwr7ZUsA50ykkqQhjqdh5GFc=; b=CRbXgGR5IARUJdpO1Jkt5K/Iu5AZuyafMDo+pnYpnHUhRayK/nCuO6T1nHvwbXLeem 2asmyAl+EwVXNdLfiQcD8y2N5x/06qa+VwSTXxM5iq64COx4bT6ABG56XHOoUKtsyENg dPyoYrWNXnw3c9Xt2R5XvYG8kvfv/o2TQLoEiGaZyTg1gGqW6nbwdIuw7N8jTTdPljlH NtKbuz218JuYYC+Y2CLwxVt14FROXc1jP+JYnz17l6huFwdAvY3f6nKieVszsHhOtZoi U2nvFuWU0drSA9JD2q2niduNFDr0SkP9LoCaxiUeGkke2iY71fxTIZ8l482BXP0+V7sv TaKg== X-Gm-Message-State: APjAAAUPYa1iA+Dx4bkXDdr8gqabKW00qvLrCOa/9eOgJ/15C3+F6B5g cYckdC2Skqy4xmBZKwUfAehIoRyd X-Google-Smtp-Source: APXvYqy575FP35kuEwYkjnjMiWEy0+kBCYvNUkOkSGwrrAYiS8VrTz7GeSLZCKiWJpp3s08VxBTX5g== X-Received: by 2002:a63:3dca:: with SMTP id k193mr76739337pga.146.1555449119080; Tue, 16 Apr 2019 14:11:59 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id f20sm40251655pff.176.2019.04.16.14.11.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 14:11:57 -0700 (PDT) In-Reply-To: <87sguhbrof.fsf@gmail.com> (Alex Gramiak's message of "Tue, 16 Apr 2019 14:50:40 -0600") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::536 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235553 Archived-At: --=-=-= Content-Type: text/plain Alex Gramiak writes: > Perhaps I was too overzealous with the hot tagging? I definitely was, since I removed the _Hot attributes from the *malloc/free procedures, which turned out to be in bad judgment. Removing those yielded: Performance counter stats for 'src/emacs.hot-cold -f kill-emacs' (20 runs): 751.22 msec task-clock:u # 0.841 CPUs utilized ( +- 0.14% ) 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 12,928 page-faults:u # 0.017 M/sec ( +- 0.02% ) 2,959,142,867 cycles:u # 3.939 GHz ( +- 0.05% ) 1,350,640,657 stalled-cycles-frontend:u # 45.64% frontend cycles idle ( +- 0.12% ) 972,612,724 stalled-cycles-backend:u # 32.87% backend cycles idle ( +- 0.15% ) 4,865,119,525 instructions:u # 1.64 insn per cycle # 0.28 stalled cycles per insn ( +- 0.00% ) 1,035,582,401 branches:u # 1378.539 M/sec ( +- 0.00% ) 17,794,068 branch-misses:u # 1.72% of all branches ( +- 0.14% ) 1,206,398,515 L1-dcache-loads:u # 1605.925 M/sec ( +- 0.00% ) 42,095,141 L1-dcache-load-misses:u # 3.49% of all L1-dcache hits ( +- 0.05% ) 9,057,830 LLC-loads:u # 12.058 M/sec ( +- 0.39% ) LLC-load-misses:u 0.89309 +- 0.00484 seconds time elapsed ( +- 0.54% ) I also realized that I completely forgot putting the attribute on emacs_abort. With the _Cold attribute on emacs_abort: Performance counter stats for 'src/emacs -f kill-emacs' (20 runs): 760.73 msec task-clock:u # 0.846 CPUs utilized ( +- 0.22% ) 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 12,925 page-faults:u # 0.017 M/sec ( +- 0.02% ) 2,991,729,656 cycles:u # 3.933 GHz ( +- 0.04% ) 1,388,332,047 stalled-cycles-frontend:u # 46.41% frontend cycles idle ( +- 0.13% ) 976,840,303 stalled-cycles-backend:u # 32.65% backend cycles idle ( +- 0.17% ) 4,867,077,504 instructions:u # 1.63 insn per cycle # 0.29 stalled cycles per insn ( +- 0.00% ) 1,036,158,051 branches:u # 1362.059 M/sec ( +- 0.00% ) 17,860,346 branch-misses:u # 1.72% of all branches ( +- 0.19% ) 1,207,924,887 L1-dcache-loads:u # 1587.852 M/sec ( +- 0.00% ) 42,358,754 L1-dcache-load-misses:u # 3.51% of all L1-dcache hits ( +- 0.06% ) 9,046,859 LLC-loads:u # 11.892 M/sec ( +- 0.32% ) LLC-load-misses:u 0.89896 +- 0.00200 seconds time elapsed ( +- 0.22% ) Performance counter stats for 'src/emacs.cold -f kill-emacs' (20 runs): 755.78 msec task-clock:u # 0.845 CPUs utilized ( +- 0.18% ) 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 12,929 page-faults:u # 0.017 M/sec ( +- 0.02% ) 2,978,556,838 cycles:u # 3.941 GHz ( +- 0.05% ) 1,370,387,120 stalled-cycles-frontend:u # 46.01% frontend cycles idle ( +- 0.12% ) 978,514,384 stalled-cycles-backend:u # 32.85% backend cycles idle ( +- 0.16% ) 4,866,672,758 instructions:u # 1.63 insn per cycle # 0.28 stalled cycles per insn ( +- 0.00% ) 1,035,997,172 branches:u # 1370.762 M/sec ( +- 0.00% ) 17,838,674 branch-misses:u # 1.72% of all branches ( +- 0.13% ) 1,206,937,944 L1-dcache-loads:u # 1596.939 M/sec ( +- 0.00% ) 42,110,067 L1-dcache-load-misses:u # 3.49% of all L1-dcache hits ( +- 0.05% ) 9,088,714 LLC-loads:u # 12.026 M/sec ( +- 0.28% ) LLC-load-misses:u 0.89401 +- 0.00185 seconds time elapsed ( +- 0.21% ) Performance counter stats for 'src/emacs.hot-cold -f kill-emacs' (20 runs): 752.56 msec task-clock:u # 0.846 CPUs utilized ( +- 0.18% ) 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 12,923 page-faults:u # 0.017 M/sec ( +- 0.01% ) 2,973,502,618 cycles:u # 3.951 GHz ( +- 0.05% ) 1,368,004,926 stalled-cycles-frontend:u # 46.01% frontend cycles idle ( +- 0.11% ) 974,077,949 stalled-cycles-backend:u # 32.76% backend cycles idle ( +- 0.13% ) 4,865,128,800 instructions:u # 1.64 insn per cycle # 0.28 stalled cycles per insn ( +- 0.00% ) 1,035,577,546 branches:u # 1376.070 M/sec ( +- 0.00% ) 17,721,035 branch-misses:u # 1.71% of all branches ( +- 0.17% ) 1,206,420,627 L1-dcache-loads:u # 1603.086 M/sec ( +- 0.00% ) 42,129,928 L1-dcache-load-misses:u # 3.49% of all L1-dcache hits ( +- 0.04% ) 9,033,444 LLC-loads:u # 12.004 M/sec ( +- 0.40% ) LLC-load-misses:u 0.88928 +- 0.00161 seconds time elapsed ( +- 0.18% ) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=hot-cold.diff Content-Description: hot/cold v2 diff --git a/src/alloc.c b/src/alloc.c index dd783863be..21aba9e7a9 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -633,7 +633,7 @@ display_malloc_warning (void) /* Called if we can't allocate relocatable space for a buffer. */ -void +_Cold void buffer_memory_full (ptrdiff_t nbytes) { /* If buffers use the relocating allocator, no need to free @@ -2325,7 +2325,7 @@ compact_small_strings (void) current_sblock = tb; } -void +_Cold void string_overflow (void) { error ("Maximum string size exceeded"); @@ -4085,7 +4085,7 @@ set_interval_marked (INTERVAL i) either case this counts as memory being full even though malloc did not fail. */ -void +_Cold void memory_full (size_t nbytes) { /* Do not go into hysterics merely because a large request failed. */ diff --git a/src/bytecode.c b/src/bytecode.c index 40977799bf..e2fe7153b0 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -336,7 +336,7 @@ bcall0 (Lisp_Object f) ARGS are pushed on the stack according to ARGS_TEMPLATE before executing BYTESTR. */ -Lisp_Object +_Hot Lisp_Object exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) { diff --git a/src/data.c b/src/data.c index 11cd598ed8..1291a92955 100644 --- a/src/data.c +++ b/src/data.c @@ -130,7 +130,7 @@ set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) blv->valcell = val; } -static _Noreturn void +static _Cold _Noreturn void wrong_length_argument (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) { Lisp_Object size1 = make_fixnum (bool_vector_size (a1)); @@ -142,7 +142,7 @@ wrong_length_argument (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) make_fixnum (bool_vector_size (a3))); } -_Noreturn void +_Cold _Noreturn void wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) { /* If VALUE is not even a valid Lisp object, we'd want to abort here @@ -155,25 +155,25 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) xsignal2 (Qwrong_type_argument, predicate, value); } -void +_Cold void pure_write_error (Lisp_Object obj) { xsignal2 (Qerror, build_string ("Attempt to modify read-only object"), obj); } -void +_Cold void args_out_of_range (Lisp_Object a1, Lisp_Object a2) { xsignal2 (Qargs_out_of_range, a1, a2); } -void +_Cold void args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) { xsignal3 (Qargs_out_of_range, a1, a2, a3); } -void +_Cold void circular_list (Lisp_Object list) { xsignal1 (Qcircular_list, list); @@ -1018,7 +1018,7 @@ do_symval_forwarding (lispfwd valcontents) /* Used to signal a user-friendly error when symbol WRONG is not a member of CHOICE, which should be a list of symbols. */ -void +_Cold void wrong_choice (Lisp_Object choice, Lisp_Object wrong) { ptrdiff_t i = 0, len = list_length (choice); @@ -1051,7 +1051,7 @@ wrong_choice (Lisp_Object choice, Lisp_Object wrong) /* Used to signal a user-friendly error if WRONG is not a number or integer/floating-point number outsize of inclusive MIN..MAX range. */ -static void +static _Cold void wrong_range (Lisp_Object min, Lisp_Object max, Lisp_Object wrong) { AUTO_STRING (value_should_be_from, "Value should be from "); diff --git a/src/dispnew.c b/src/dispnew.c index ccb08ec1b9..db9166cbe6 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -360,7 +360,7 @@ verify_row_hash (struct glyph_row *row) what is displayed on the screen. While this is usually fast, it leads to screen flickering. */ -static void +static _Hot void adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y, struct dim dim) { int i; @@ -2994,7 +2994,7 @@ window_to_frame_hpos (struct window *w, int hpos) /* Redraw frame F. */ -void +_Hot void redraw_frame (struct frame *f) { /* Error if F has no glyphs. */ @@ -3048,7 +3048,7 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "", Value is true if redisplay was stopped due to pending input. */ -bool +_Hot bool update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p) { /* True means display has been paused because of pending input. */ @@ -3384,7 +3384,7 @@ check_current_matrix_flags (struct window *w) /* Update display of window W. If FORCE_P, don't stop updating when input is pending. */ -static bool +static _Hot bool update_window (struct window *w, bool force_p) { struct glyph_matrix *desired_matrix = w->desired_matrix; @@ -3580,7 +3580,7 @@ update_marginal_area (struct window *w, struct glyph_row *updated_row, /* Update the display of the text area of row VPOS in window W. Value is true if display has changed. */ -static bool +static _Hot bool update_text_area (struct window *w, struct glyph_row *updated_row, int vpos) { struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos); @@ -4476,7 +4476,7 @@ scrolling_window (struct window *w, bool header_line_p) Value is true if update was stopped due to pending input. */ -static bool +static _Hot bool update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p, bool set_cursor_p, bool updating_menu_p) { @@ -4779,7 +4779,7 @@ count_match (struct glyph *str1, struct glyph *end1, struct glyph *str2, struct /* Perform a frame-based update on line VPOS in frame FRAME. */ -static void +static _Hot void update_frame_line (struct frame *f, int vpos, bool updating_menu_p) { struct glyph *obody, *nbody, *op1, *op2, *np1, *nend; diff --git a/src/eval.c b/src/eval.c index e9f118c5cb..eb3d856a8f 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1707,25 +1707,25 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ -void +_Cold void xsignal0 (Lisp_Object error_symbol) { xsignal (error_symbol, Qnil); } -void +_Cold void xsignal1 (Lisp_Object error_symbol, Lisp_Object arg) { xsignal (error_symbol, list1 (arg)); } -void +_Cold void xsignal2 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2) { xsignal (error_symbol, list2 (arg1, arg2)); } -void +_Cold void xsignal3 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) { xsignal (error_symbol, list3 (arg1, arg2, arg3)); @@ -1734,7 +1734,7 @@ xsignal3 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2, Lisp_Obj /* Signal `error' with message S, and additional arg ARG. If ARG is not a proper list, make it a one-element list. */ -void +_Cold void signal_error (const char *s, Lisp_Object arg) { if (NILP (Fproper_list_p (arg))) @@ -1745,7 +1745,7 @@ signal_error (const char *s, Lisp_Object arg) /* Use this for arithmetic overflow, e.g., when an integer result is too large even for a bignum. */ -void +_Cold void overflow_error (void) { xsignal0 (Qoverflow_error); @@ -1892,7 +1892,7 @@ vformat_string (const char *m, va_list ap) } /* Dump an error message; called like vprintf. */ -void +_Cold void verror (const char *m, va_list ap) { xsignal1 (Qerror, vformat_string (m, ap)); @@ -1902,7 +1902,7 @@ verror (const char *m, va_list ap) /* Dump an error message; called like printf. */ /* VARARGS 1 */ -void +_Cold void error (const char *m, ...) { va_list ap; @@ -2171,7 +2171,7 @@ record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) /* Eval a sub-expression of the current expression (i.e. in the same lexical scope). */ -Lisp_Object +_Hot Lisp_Object eval_sub (Lisp_Object form) { Lisp_Object fun, val, original_fun, original_args; @@ -2863,7 +2863,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) /* Apply a C subroutine SUBR to the NUMARGS evaluated arguments in ARG_VECTOR and return the result of evaluation. */ -Lisp_Object +_Hot Lisp_Object funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *args) { if (numargs < subr->min_args @@ -2942,7 +2942,7 @@ funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *args) } } -static Lisp_Object +static _Hot Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args, ptrdiff_t count) { Lisp_Object *arg_vector; @@ -2978,7 +2978,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, ptrdiff_t count) FUN must be either a lambda-expression, a compiled-code object, or a module function. */ -static Lisp_Object +static _Hot Lisp_Object funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, register Lisp_Object *arg_vector) { @@ -3322,7 +3322,7 @@ do_specbind (struct Lisp_Symbol *sym, union specbinding *bind, i.e. bindings to the default value of a variable which can be buffer-local. */ -void +_Hot void specbind (Lisp_Object symbol, Lisp_Object value) { struct Lisp_Symbol *sym; @@ -3580,7 +3580,7 @@ set_unwind_protect_ptr (ptrdiff_t count, void (*func) (void *), void *arg) /* Pop and execute entries from the unwind-protect stack until the depth COUNT is reached. Return VALUE. */ -Lisp_Object +_Hot Lisp_Object unbind_to (ptrdiff_t count, Lisp_Object value) { Lisp_Object quitf = Vquit_flag; diff --git a/src/keyboard.c b/src/keyboard.c index 8fb6db987b..5569d0db2c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1038,7 +1038,7 @@ static Lisp_Object top_level_1 (Lisp_Object); This level has the catches for exiting/returning to editor command loop. It returns nil to exit recursive edit, t to abort it. */ -Lisp_Object +_Hot Lisp_Object command_loop (void) { #ifdef HAVE_STACK_OVERFLOW_HANDLING @@ -8856,7 +8856,7 @@ void init_raw_keybuf_count (void) If FIX_CURRENT_BUFFER, we restore current_buffer from the selected window's buffer. */ -static int +static _Hot int read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, bool dont_downcase_last, bool can_return_switch_frame, bool fix_current_buffer, bool prevent_redisplay) diff --git a/src/lisp.h b/src/lisp.h index 681efc3b52..b98cad5e8e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -34,6 +34,9 @@ along with GNU Emacs. If not, see . */ #include #include +#define _Cold __attribute__((cold)) +#define _Hot __attribute__((hot)) + INLINE_HEADER_BEGIN /* Define a TYPE constant ID as an externally visible name. Use like this: @@ -621,7 +624,7 @@ extern Lisp_Object char_table_ref (Lisp_Object, int); extern void char_table_set (Lisp_Object, int, Lisp_Object); /* Defined in data.c. */ -extern _Noreturn void wrong_type_argument (Lisp_Object, Lisp_Object); +extern _Cold _Noreturn void wrong_type_argument (Lisp_Object, Lisp_Object); /* Defined in emacs.c. */ @@ -4095,18 +4098,18 @@ extern Lisp_Object run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args, Lisp_Object (*funcall) (ptrdiff_t nargs, Lisp_Object *args)); extern Lisp_Object quit (void); -INLINE _Noreturn void +INLINE _Cold _Noreturn void xsignal (Lisp_Object error_symbol, Lisp_Object data) { Fsignal (error_symbol, data); } -extern _Noreturn void xsignal0 (Lisp_Object); -extern _Noreturn void xsignal1 (Lisp_Object, Lisp_Object); -extern _Noreturn void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object); -extern _Noreturn void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, +extern _Cold _Noreturn void xsignal0 (Lisp_Object); +extern _Cold _Noreturn void xsignal1 (Lisp_Object, Lisp_Object); +extern _Cold _Noreturn void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object); +extern _Cold _Noreturn void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); -extern _Noreturn void signal_error (const char *, Lisp_Object); -extern _Noreturn void overflow_error (void); +extern _Cold _Noreturn void signal_error (const char *, Lisp_Object); +extern _Cold _Noreturn void overflow_error (void); extern bool FUNCTIONP (Lisp_Object); extern Lisp_Object funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *arg_vector); extern Lisp_Object eval_sub (Lisp_Object form); @@ -4145,8 +4148,8 @@ extern void set_unwind_protect_ptr (ptrdiff_t, void (*) (void *), void *); extern Lisp_Object unbind_to (ptrdiff_t, Lisp_Object); extern void rebind_for_thread_switch (void); extern void unbind_for_thread_switch (struct thread_state *); -extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); -extern _Noreturn void verror (const char *, va_list) +extern _Cold _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); +extern _Cold _Noreturn void verror (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); extern Lisp_Object vformat_string (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); diff --git a/src/lread.c b/src/lread.c index 5f33fcd695..16ce4afd21 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1912,7 +1912,7 @@ readevalloop_eager_expand_eval (Lisp_Object val, Lisp_Object macroexpand) START, END specify region to read in current buffer (from eval-region). If the input is not from a buffer, they must be nil. */ -static void +static _Hot void readevalloop (Lisp_Object readcharfun, struct infile *infile0, Lisp_Object sourcename, @@ -2736,7 +2736,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) FIRST_IN_LIST is true if this is the first element of a list. */ -static Lisp_Object +static _Hot Lisp_Object read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) { int c; @@ -4092,7 +4092,7 @@ check_obarray (Lisp_Object obarray) /* Intern symbol SYM in OBARRAY using bucket INDEX. */ -static Lisp_Object +static _Hot Lisp_Object intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index) { Lisp_Object *ptr; @@ -4116,7 +4116,7 @@ intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index) /* Intern a symbol with name STRING in OBARRAY using bucket INDEX. */ -Lisp_Object +_Hot Lisp_Object intern_driver (Lisp_Object string, Lisp_Object obarray, Lisp_Object index) { return intern_sym (Fmake_symbol (string), obarray, index); @@ -4125,7 +4125,7 @@ intern_driver (Lisp_Object string, Lisp_Object obarray, Lisp_Object index) /* Intern the C string STR: return a symbol with that name, interned in the current obarray. */ -Lisp_Object +_Hot Lisp_Object intern_1 (const char *str, ptrdiff_t len) { Lisp_Object obarray = check_obarray (Vobarray); diff --git a/src/sysdep.c b/src/sysdep.c index 57ea8220ca..84e118c250 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2447,7 +2447,7 @@ emacs_backtrace (int backtrace_limit) } #ifndef HAVE_NTGUI -void +_Cold void emacs_abort (void) { terminate_due_to_signal (SIGABRT, 40); diff --git a/src/term.c b/src/term.c index a492276c88..472d8d19e5 100644 --- a/src/term.c +++ b/src/term.c @@ -4393,8 +4393,7 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ return terminal; } - -static void +static _Cold void vfatal (const char *str, va_list ap) { fprintf (stderr, "emacs: "); @@ -4410,7 +4409,7 @@ vfatal (const char *str, va_list ap) Delete TERMINAL, then call error or fatal with str1 or str2, respectively, according to whether MUST_SUCCEED is true. */ -static void +static _Cold void maybe_fatal (bool must_succeed, struct terminal *terminal, const char *str1, const char *str2, ...) { @@ -4425,7 +4424,7 @@ maybe_fatal (bool must_succeed, struct terminal *terminal, verror (str1, ap); } -void +_Cold void fatal (const char *str, ...) { va_list ap; diff --git a/src/xdisp.c b/src/xdisp.c index a88fc698b8..aca6f09b05 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13906,7 +13906,7 @@ do { if (polling_stopped_here) start_polling (); \ /* Perhaps in the future avoid recentering windows if it is not necessary; currently that causes some problems. */ -static void +static _Hot void redisplay_internal (void) { struct window *w = XWINDOW (selected_window); @@ -14925,7 +14925,7 @@ buffer_flipping_blocked_p (void) /* Redisplay all leaf windows in the window tree rooted at WINDOW. */ -static void +static _Hot void redisplay_windows (Lisp_Object window) { while (!NILP (window)) @@ -16684,7 +16684,7 @@ set_horizontal_scroll_bar (struct window *w) showing point will be fully (as opposed to partially) visible on display. */ -static void +static _Hot void redisplay_window (Lisp_Object window, bool just_this_one_p) { struct window *w = XWINDOW (window); --=-=-=--