From: Tom Tromey Date: Mon, 20 Aug 2012 13:34:41 +0000 (-0600) Subject: Merge from trunk X-Git-Tag: emacs-26.0.90~1144^2~17^2~65 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=49bc1a9dfc6e81a370bf12157c3c573743ee200a;p=emacs.git Merge from trunk --- 49bc1a9dfc6e81a370bf12157c3c573743ee200a diff --cc src/eval.c index f5f6fe7a808,c41e3f54d4d..c7a35fc91af --- a/src/eval.c +++ b/src/eval.c @@@ -133,7 -133,21 +133,27 @@@ Lisp_Object inhibit_lisp_code static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); static int interactive_p (int); static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); - + + /* Functions to set Lisp_Object slots of struct specbinding. */ + + static inline void + set_specpdl_symbol (Lisp_Object symbol) + { + specpdl_ptr->symbol = symbol; + } + + static inline void + set_specpdl_old_value (Lisp_Object oldval) + { + specpdl_ptr->old_value = oldval; + } + ++static inline void ++set_specpdl_saved_value (Lisp_Object savedval) ++{ ++ specpdl_ptr->saved_value = savedval; ++} ++ void init_eval_once (void) { @@@ -3183,12 -3150,14 +3215,12 @@@ specbind (Lisp_Object symbol, Lisp_Obje case SYMBOL_PLAINVAL: /* The most common case is that of a non-constant symbol with a trivial value. Make that as fast as we can. */ - specpdl_ptr->symbol = symbol; - specpdl_ptr->old_value = SYMBOL_VAL (sym); + set_specpdl_symbol (symbol); + set_specpdl_old_value (SYMBOL_VAL (sym)); specpdl_ptr->func = NULL; + specpdl_ptr->saved_value = Qnil; ++specpdl_ptr; - if (!sym->constant) - SET_SYMBOL_VAL (sym, value); - else - set_internal (symbol, value, Qnil, 1); + do_specbind (sym, specpdl_ptr - 1, value); break; case SYMBOL_LOCALIZED: if (SYMBOL_BLV (sym)->frame_local) @@@ -3248,10 -3217,10 +3280,10 @@@ } } else - specpdl_ptr->symbol = symbol; + set_specpdl_symbol (symbol); specpdl_ptr++; - set_internal (symbol, value, Qnil, 1); + do_specbind (sym, specpdl_ptr - 1, value); break; } default: abort (); @@@ -3266,9 -3235,8 +3298,9 @@@ record_unwind_protect (Lisp_Object (*fu if (specpdl_ptr == specpdl + specpdl_size) grow_specpdl (); specpdl_ptr->func = function; - specpdl_ptr->symbol = Qnil; - specpdl_ptr->old_value = arg; - specpdl_ptr->saved_value = Qnil; + set_specpdl_symbol (Qnil); + set_specpdl_old_value (arg); ++ set_specpdl_saved_value (Qnil); specpdl_ptr++; } diff --cc src/process.c index ada673e3c34,7f6f6bafbea..fa138027ec1 --- a/src/process.c +++ b/src/process.c @@@ -312,23 -337,90 +315,110 @@@ static struct sockaddr_and_len /* Maximum number of bytes to send to a pty without an eof. */ static int pty_max_bytes; + /* These setters are used only in this file, so they can be private. */ + static inline void + pset_buffer (struct Lisp_Process *p, Lisp_Object val) + { + p->buffer = val; + } + static inline void + pset_command (struct Lisp_Process *p, Lisp_Object val) + { + p->command = val; + } + static inline void + pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val) + { + p->decode_coding_system = val; + } + static inline void + pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val) + { + p->decoding_buf = val; + } + static inline void + pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val) + { + p->encode_coding_system = val; + } + static inline void + pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val) + { + p->encoding_buf = val; + } + static inline void + pset_filter (struct Lisp_Process *p, Lisp_Object val) + { + p->filter = val; + } + static inline void + pset_log (struct Lisp_Process *p, Lisp_Object val) + { + p->log = val; + } + static inline void + pset_mark (struct Lisp_Process *p, Lisp_Object val) + { + p->mark = val; + } + static inline void ++pset_thread (struct Lisp_Process *p, Lisp_Object val) ++{ ++ p->thread = val; ++} ++static inline void + pset_name (struct Lisp_Process *p, Lisp_Object val) + { + p->name = val; + } + static inline void + pset_plist (struct Lisp_Process *p, Lisp_Object val) + { + p->plist = val; + } + static inline void + pset_sentinel (struct Lisp_Process *p, Lisp_Object val) + { + p->sentinel = val; + } + static inline void + pset_status (struct Lisp_Process *p, Lisp_Object val) + { + p->status = val; + } + static inline void + pset_tty_name (struct Lisp_Process *p, Lisp_Object val) + { + p->tty_name = val; + } + static inline void + pset_type (struct Lisp_Process *p, Lisp_Object val) + { + p->type = val; + } + static inline void + pset_write_queue (struct Lisp_Process *p, Lisp_Object val) + { + p->write_queue = val; + } + +enum fd_bits +{ + /* Read from file descriptor. */ + FOR_READ = 1, + /* Write to file descriptor. */ + FOR_WRITE = 2, + /* This descriptor refers to a keyboard. Only valid if FOR_READ is + set. */ + KEYBOARD_FD = 4, + /* This descriptor refers to a process. */ + PROCESS_FD = 8, + /* A non-blocking connect. Only valid if FOR_WRITE is set. */ + NON_BLOCKING_CONNECT_FD = 16 +}; + static struct fd_callback_data { fd_callback func; @@@ -760,9 -711,8 +850,9 @@@ make_process (Lisp_Object name p = allocate_process (); /* Initialize Lisp data. Note that allocate_process initializes all Lisp data to nil, so do it only for slots which should not be nil. */ - PSET (p, status, Qrun); - PSET (p, mark, Fmake_marker ()); - PSET (p, thread, Fcurrent_thread ()); + pset_status (p, Qrun); + pset_mark (p, Fmake_marker ()); ++ pset_thread (p, Fcurrent_thread ()); /* Initialize non-Lisp data. Note that allocate_process zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ @@@ -1121,12 -1053,15 +1211,12 @@@ The string argument is normally a multi else if (EQ (p->filter, Qt) /* Network or serial process not stopped: */ && !EQ (p->command, Qt)) - { - FD_SET (p->infd, &input_wait_mask); - FD_SET (p->infd, &non_keyboard_wait_mask); - } + delete_read_fd (p->infd); } - PSET (p, filter, filter); + pset_filter (p, filter); if (NETCONN1_P (p) || SERIALCONN1_P (p)) - PSET (p, childp, Fplist_put (p->childp, QCfilter, filter)); + pset_childp (p, Fplist_put (p->childp, QCfilter, filter)); setup_process_coding_systems (process); return filter; } @@@ -2148,10 -2047,13 +2235,10 @@@ create_pty (Lisp_Object process more portable (see USG_SUBTTY_WORKS above). */ XPROCESS (process)->pty_flag = pty_flag; - PSET (XPROCESS (process), status, Qrun); + pset_status (XPROCESS (process), Qrun); setup_process_coding_systems (process); - FD_SET (inchannel, &input_wait_mask); - FD_SET (inchannel, &non_keyboard_wait_mask); - if (inchannel > max_process_desc) - max_process_desc = inchannel; + add_non_keyboard_read_fd (inchannel); XPROCESS (process)->pid = -2; #ifdef HAVE_PTYS @@@ -3607,9 -3512,13 +3694,9 @@@ usage: (make-network-process &rest ARGS /* We may get here if connect did succeed immediately. However, in that case, we still need to signal this like a non-blocking connection. */ - PSET (p, status, Qconnect); + pset_status (p, Qconnect); - if (!FD_ISSET (inch, &connect_wait_mask)) - { - FD_SET (inch, &connect_wait_mask); - FD_SET (inch, &write_mask); - num_pending_connects++; - } + if ((fd_callback_info[inch].flags & NON_BLOCKING_CONNECT_FD) == 0) + add_non_blocking_write_fd (inch); } else #endif @@@ -6172,8 -6095,11 +6258,8 @@@ traffic. */ p = XPROCESS (process); if (NILP (p->command) && p->infd >= 0) - { - FD_CLR (p->infd, &input_wait_mask); - FD_CLR (p->infd, &non_keyboard_wait_mask); - } + delete_read_fd (p->infd); - PSET (p, command, Qt); + pset_command (p, Qt); return process; } #ifndef SIGTSTP diff --cc src/process.h index 1ddfe915357,55a572117c6..db000464cb5 --- a/src/process.h +++ b/src/process.h @@@ -212,4 -226,4 +229,6 @@@ extern void delete_read_fd (int fd) extern void add_write_fd (int fd, fd_callback func, void *data); extern void delete_write_fd (int fd); +extern void update_processes_for_thread_death (Lisp_Object); ++ + INLINE_HEADER_END