aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdumper.c
diff options
context:
space:
mode:
authorPaul Eggert2019-07-08 17:50:39 -0700
committerPaul Eggert2019-07-08 17:50:39 -0700
commitf8ab90839fe64b2ec8b398a50e8fb4f33e8e95e1 (patch)
treec3909d7ae6d78c78cc9e293c20cd764f49931bc2 /src/pdumper.c
parent7b70efb740a04517e2764b0986c6e92305c1dd3e (diff)
downloademacs-f8ab90839fe64b2ec8b398a50e8fb4f33e8e95e1.tar.gz
emacs-f8ab90839fe64b2ec8b398a50e8fb4f33e8e95e1.zip
Use fewer locks when accessing stdio
* src/alloc.c, src/bidi.c, src/emacs-module.c, src/pdumper.c: * src/regex-emacs.c, src/unexhp9k800.c, src/unexmacosx.c: * src/widget.c, src/xdisp.c, src/xselect.c, src/xterm.c: Include sysstdio.h instead of stdio.h, to avoid locking stdio streams in many cases. * src/alloc.c (test_setjmp): * src/bidi.c (bidi_dump_cached_states): * src/cm.c (calccost): * src/dispnew.c (init_display_interactive): * src/emacs.c (main): * src/image.c (convert_mono_to_color_image): * src/minibuf.c (read_minibuf_noninteractive): * src/nsfont.m (ns_descriptor_to_entity) (ns_dump_glyphstring): * src/nsterm.h (NSTRACE_MSG_NO_DASHES): * src/nsterm.m (ns_mouse_position) (sendEvent:, keyDown:, performDragOperation:): * src/pdumper.c (dump_fingerprint, print_paths_to_root_1): * src/print.c (debug_print): * src/regex-emacs.c (debug_putchar, print_fastmap) (print_partial_compiled_pattern, print_compiled_pattern) (print_double_string, regex_compile): * src/term.c (vfatal): * src/unexhp9k800.c (read_header): * src/unexmacosx.c (unexec_error): * src/widget.c (EmacsFrameInitialize): * src/xdisp.c (message_to_stderr, vmessage, dump_glyph_row) (Fdump_glyph_matrix, Fdump_frame_glyph_matrix, dump_glyph_string): * src/xfaces.c (Fdump_colors, Fdump_face): * src/xselect.c (x_clipboard_manager_error_2): * src/xterm.c (x_initialize): * src/xwidget.c (WEBKIT_FN_INIT): Prefer unlocked calls like fputs to locked calls like fprintf. * src/charset.c (read_hex): * src/cm.c (cmputc, cmcheckmagic): * src/dispnew.c (update_frame, update_frame_with_menu) (update_frame_1, Fsend_string_to_terminal, Fding) (bitch_at_user): * src/emacs.c (main, Fdump_emacs): * src/emacs-module.c (module_abort): * src/fileio.c (Fdo_auto_save): * src/image.c (slurp_file) (png_read_from_file, png_load_body, our_stdio_fill_input_buffer): * src/keyboard.c (record_char, kbd_buffer_get_event) (handle_interrupt): * src/lread.c (readbyte_from_stdio, read1): * src/minibuf.c (read_minibuf_noninteractive): * src/print.c (printchar_to_stream, strout) (Fredirect_debugging_output): * src/sysdep.c (reset_sys_modes, close_output_streams) (procfs_ttyname, procfs_get_total_memory): * src/term.c (tty_ring_bell, tty_send_additional_strings) (tty_set_terminal_modes, tty_reset_terminal_modes) (tty_update_end, tty_clear_end_of_line, tty_write_glyphs) (tty_write_glyphs_with_face, tty_insert_glyphs) (tty_menu_activate): * src/xfaces.c (Fx_load_color_file): Simplify by using ordinary calls like putc to explicitly-unlocked calls like putc_unlocked, since the ordinary calls are now unlocked anyway. * src/emacs.c (main, Fdump_emacs): * src/pdumper.c (Fdump_emacs_portable): Coalesce adjacent printfs. * src/nsterm.h: Include sysstdio.h as this file’s macros rely on it. * src/regex-emacs.c (print_compiled_pattern): Omit redundant fflush. * src/sysstdio.h: Include unlocked-io.h. (clearerr_unlocked, feof_unlocked, ferror_unlocked) (fflush_unlocked, fgets_unlocked, fputc_unlocked) (fputs_unlocked, fread_unlocked, fwrite_unlocked) (getc_unlocked, getchar_unlocked, putc_unlocked) (putchar_unlocked): Remove these macros; now done by unlocked-io.h. * src/xwidget.c: Include sysstdio.h.
Diffstat (limited to 'src/pdumper.c')
-rw-r--r--src/pdumper.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pdumper.c b/src/pdumper.c
index c00f8a0af54..8b630d221b1 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
23#include <math.h> 23#include <math.h>
24#include <stdarg.h> 24#include <stdarg.h>
25#include <stdint.h> 25#include <stdint.h>
26#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
28#include <sys/mman.h> 27#include <sys/mman.h>
29#include <sys/param.h> 28#include <sys/param.h>
@@ -42,6 +41,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
42#include "lisp.h" 41#include "lisp.h"
43#include "pdumper.h" 42#include "pdumper.h"
44#include "window.h" 43#include "window.h"
44#include "sysstdio.h"
45#include "systime.h" 45#include "systime.h"
46#include "thread.h" 46#include "thread.h"
47#include "bignum.h" 47#include "bignum.h"
@@ -329,7 +329,7 @@ dump_fingerprint (const char *label, unsigned char const *xfingerprint)
329 fprintf (stderr, "%s: ", label); 329 fprintf (stderr, "%s: ", label);
330 for (int i = 0; i < 32; ++i) 330 for (int i = 0; i < 32; ++i)
331 fprintf (stderr, "%02x", (unsigned) xfingerprint[i]); 331 fprintf (stderr, "%02x", (unsigned) xfingerprint[i]);
332 fprintf (stderr, "\n"); 332 putc ('\n', stderr);
333} 333}
334 334
335/* Format of an Emacs portable dump file. All offsets are relative to 335/* Format of an Emacs portable dump file. All offsets are relative to
@@ -1404,9 +1404,9 @@ print_paths_to_root_1 (struct dump_context *ctx,
1404 referrers = XCDR (referrers); 1404 referrers = XCDR (referrers);
1405 Lisp_Object repr = Fprin1_to_string (referrer, Qnil); 1405 Lisp_Object repr = Fprin1_to_string (referrer, Qnil);
1406 for (int i = 0; i < level; ++i) 1406 for (int i = 0; i < level; ++i)
1407 fputc (' ', stderr); 1407 putc (' ', stderr);
1408 fwrite (SDATA (repr), 1, SBYTES (repr), stderr); 1408 fwrite (SDATA (repr), 1, SBYTES (repr), stderr);
1409 fputc ('\n', stderr); 1409 putc ('\n', stderr);
1410 print_paths_to_root_1 (ctx, referrer, level + 1); 1410 print_paths_to_root_1 (ctx, referrer, level + 1);
1411 } 1411 }
1412} 1412}
@@ -4226,14 +4226,14 @@ types. */)
4226 dump_seek (ctx, 0); 4226 dump_seek (ctx, 0);
4227 dump_write (ctx, &ctx->header, sizeof (ctx->header)); 4227 dump_write (ctx, &ctx->header, sizeof (ctx->header));
4228 4228
4229 fprintf (stderr, "Dump complete\n");
4230 fprintf (stderr, 4229 fprintf (stderr,
4231 "Byte counts: header=%lu hot=%lu discardable=%lu cold=%lu\n", 4230 ("Dump complete\n"
4231 "Byte counts: header=%lu hot=%lu discardable=%lu cold=%lu\n"
4232 "Reloc counts: hot=%u discardable=%u\n"),
4232 (unsigned long) (header_end - header_start), 4233 (unsigned long) (header_end - header_start),
4233 (unsigned long) (hot_end - hot_start), 4234 (unsigned long) (hot_end - hot_start),
4234 (unsigned long) (discardable_end - ctx->header.discardable_start), 4235 (unsigned long) (discardable_end - ctx->header.discardable_start),
4235 (unsigned long) (cold_end - ctx->header.cold_start)); 4236 (unsigned long) (cold_end - ctx->header.cold_start),
4236 fprintf (stderr, "Reloc counts: hot=%u discardable=%u\n",
4237 number_hot_relocations, 4237 number_hot_relocations,
4238 number_discardable_relocations); 4238 number_discardable_relocations);
4239 4239