aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2015-08-26 19:24:28 -0700
committerPaul Eggert2015-08-26 19:24:58 -0700
commit60d1b18734fff144f1608da6228d60e4bda7b24c (patch)
tree9b917c91b7de84ba517dba738784e1f1600f9234 /src/process.c
parent259a643d7f7c56976ff794cbdba8f5c70c795091 (diff)
downloademacs-60d1b18734fff144f1608da6228d60e4bda7b24c.tar.gz
emacs-60d1b18734fff144f1608da6228d60e4bda7b24c.zip
Assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
This removes the need for GCPRO1 etc. Suggested by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00918.html * doc/lispref/internals.texi (Writing Emacs Primitives): * etc/NEWS: Document the change. * src/alloc.c (gcprolist, dump_zombies, MAX_ZOMBIES, zombies) (nzombies, ngcs, avg_zombies, max_live, max_zombies, avg_live) (Fgc_status, check_gcpros, relocatable_string_data_p, gc-precise): * src/bytecode.c (mark_byte_stack) [BYTE_MARK_STACK]: * src/eval.c (gcpro_level) [DEBUG_GCPRO]: * src/lisp.h (struct handler.gcpro, struct gcpro, GC_MARK_STACK) (GC_USE_GCPROS_AS_BEFORE, GC_MAKE_GCPROS_NOOPS) (GC_MARK_STACK_CHECK_GCPROS, GC_USE_GCPROS_CHECK_ZOMBIES) (BYTE_MARK_STACK, GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6) (GCPRO7, UNGCPRO, RETURN_UNGCPRO): Remove. All uses removed. The code now assumes GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS. * src/bytecode.c (relocate_byte_stack): Rename from unmark_byte_stack, since it now only relocates. All callers changed. * src/frame.c (make_frame): Add an IF_LINT to pacify GCC 5.2 with GCPROs removed. * src/systime.h: Use EMACS_LISP_H as the canary instead of GCPRO1. * test/automated/finalizer-tests.el (finalizer-basic) (finalizer-circular-reference, finalizer-cross-reference) (finalizer-error): * test/automated/generator-tests.el (cps-test-iter-close-finalizer): Remove tests, as they depend on gc-precise.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c83
1 files changed, 9 insertions, 74 deletions
diff --git a/src/process.c b/src/process.c
index 9d8fa2237f3..17e9187aa65 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1402,7 +1402,6 @@ usage: (make-process &rest ARGS) */)
1402 Lisp_Object buffer, name, command, program, proc, contact, current_dir, tem; 1402 Lisp_Object buffer, name, command, program, proc, contact, current_dir, tem;
1403 Lisp_Object xstderr, stderrproc; 1403 Lisp_Object xstderr, stderrproc;
1404 ptrdiff_t count = SPECPDL_INDEX (); 1404 ptrdiff_t count = SPECPDL_INDEX ();
1405 struct gcpro gcpro1;
1406 USE_SAFE_ALLOCA; 1405 USE_SAFE_ALLOCA;
1407 1406
1408 if (nargs == 0) 1407 if (nargs == 0)
@@ -1410,7 +1409,6 @@ usage: (make-process &rest ARGS) */)
1410 1409
1411 /* Save arguments for process-contact and clone-process. */ 1410 /* Save arguments for process-contact and clone-process. */
1412 contact = Flist (nargs, args); 1411 contact = Flist (nargs, args);
1413 GCPRO1 (contact);
1414 1412
1415 buffer = Fplist_get (contact, QCbuffer); 1413 buffer = Fplist_get (contact, QCbuffer);
1416 if (!NILP (buffer)) 1414 if (!NILP (buffer))
@@ -1419,18 +1417,8 @@ usage: (make-process &rest ARGS) */)
1419 /* Make sure that the child will be able to chdir to the current 1417 /* Make sure that the child will be able to chdir to the current
1420 buffer's current directory, or its unhandled equivalent. We 1418 buffer's current directory, or its unhandled equivalent. We
1421 can't just have the child check for an error when it does the 1419 can't just have the child check for an error when it does the
1422 chdir, since it's in a vfork. 1420 chdir, since it's in a vfork. */
1423 1421 current_dir = encode_current_directory ();
1424 We have to GCPRO around this because Fexpand_file_name and
1425 Funhandled_file_name_directory might call a file name handling
1426 function. The argument list is protected by the caller, so all
1427 we really have to worry about is buffer. */
1428 {
1429 struct gcpro gcpro1;
1430 GCPRO1 (buffer);
1431 current_dir = encode_current_directory ();
1432 UNGCPRO;
1433 }
1434 1422
1435 name = Fplist_get (contact, QCname); 1423 name = Fplist_get (contact, QCname);
1436 CHECK_STRING (name); 1424 CHECK_STRING (name);
@@ -1454,15 +1442,12 @@ usage: (make-process &rest ARGS) */)
1454 } 1442 }
1455 else if (!NILP (xstderr)) 1443 else if (!NILP (xstderr))
1456 { 1444 {
1457 struct gcpro gcpro1, gcpro2;
1458 CHECK_STRING (program); 1445 CHECK_STRING (program);
1459 GCPRO2 (buffer, current_dir);
1460 stderrproc = CALLN (Fmake_pipe_process, 1446 stderrproc = CALLN (Fmake_pipe_process,
1461 QCname, 1447 QCname,
1462 concat2 (name, build_string (" stderr")), 1448 concat2 (name, build_string (" stderr")),
1463 QCbuffer, 1449 QCbuffer,
1464 Fget_buffer_create (xstderr)); 1450 Fget_buffer_create (xstderr));
1465 UNGCPRO;
1466 } 1451 }
1467 1452
1468 proc = make_process (name); 1453 proc = make_process (name);
@@ -1526,7 +1511,6 @@ usage: (make-process &rest ARGS) */)
1526 /* Qt denotes we have not yet called Ffind_operation_coding_system. */ 1511 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
1527 Lisp_Object coding_systems = Qt; 1512 Lisp_Object coding_systems = Qt;
1528 Lisp_Object val, *args2; 1513 Lisp_Object val, *args2;
1529 struct gcpro gcpro1, gcpro2;
1530 1514
1531 tem = Fplist_get (contact, QCcoding); 1515 tem = Fplist_get (contact, QCcoding);
1532 if (!NILP (tem)) 1516 if (!NILP (tem))
@@ -1548,10 +1532,8 @@ usage: (make-process &rest ARGS) */)
1548 args2[i++] = buffer; 1532 args2[i++] = buffer;
1549 for (tem2 = command; CONSP (tem2); tem2 = XCDR (tem2)) 1533 for (tem2 = command; CONSP (tem2); tem2 = XCDR (tem2))
1550 args2[i++] = XCAR (tem2); 1534 args2[i++] = XCAR (tem2);
1551 GCPRO2 (proc, current_dir);
1552 if (!NILP (program)) 1535 if (!NILP (program))
1553 coding_systems = Ffind_operation_coding_system (nargs2, args2); 1536 coding_systems = Ffind_operation_coding_system (nargs2, args2);
1554 UNGCPRO;
1555 if (CONSP (coding_systems)) 1537 if (CONSP (coding_systems))
1556 val = XCAR (coding_systems); 1538 val = XCAR (coding_systems);
1557 else if (CONSP (Vdefault_process_coding_system)) 1539 else if (CONSP (Vdefault_process_coding_system))
@@ -1580,10 +1562,8 @@ usage: (make-process &rest ARGS) */)
1580 args2[i++] = buffer; 1562 args2[i++] = buffer;
1581 for (tem2 = command; CONSP (tem2); tem2 = XCDR (tem2)) 1563 for (tem2 = command; CONSP (tem2); tem2 = XCDR (tem2))
1582 args2[i++] = XCAR (tem2); 1564 args2[i++] = XCAR (tem2);
1583 GCPRO2 (proc, current_dir);
1584 if (!NILP (program)) 1565 if (!NILP (program))
1585 coding_systems = Ffind_operation_coding_system (nargs2, args2); 1566 coding_systems = Ffind_operation_coding_system (nargs2, args2);
1586 UNGCPRO;
1587 } 1567 }
1588 if (CONSP (coding_systems)) 1568 if (CONSP (coding_systems))
1589 val = XCDR (coding_systems); 1569 val = XCDR (coding_systems);
@@ -1616,13 +1596,9 @@ usage: (make-process &rest ARGS) */)
1616 && !(SCHARS (program) > 1 1596 && !(SCHARS (program) > 1
1617 && IS_DEVICE_SEP (SREF (program, 1)))) 1597 && IS_DEVICE_SEP (SREF (program, 1))))
1618 { 1598 {
1619 struct gcpro gcpro1, gcpro2;
1620
1621 tem = Qnil; 1599 tem = Qnil;
1622 GCPRO2 (buffer, current_dir);
1623 openp (Vexec_path, program, Vexec_suffixes, &tem, 1600 openp (Vexec_path, program, Vexec_suffixes, &tem,
1624 make_number (X_OK), false); 1601 make_number (X_OK), false);
1625 UNGCPRO;
1626 if (NILP (tem)) 1602 if (NILP (tem))
1627 report_file_error ("Searching for program", program); 1603 report_file_error ("Searching for program", program);
1628 tem = Fexpand_file_name (tem, Qnil); 1604 tem = Fexpand_file_name (tem, Qnil);
@@ -1638,8 +1614,6 @@ usage: (make-process &rest ARGS) */)
1638 tem = remove_slash_colon (tem); 1614 tem = remove_slash_colon (tem);
1639 1615
1640 Lisp_Object arg_encoding = Qnil; 1616 Lisp_Object arg_encoding = Qnil;
1641 struct gcpro gcpro1;
1642 GCPRO1 (tem);
1643 1617
1644 /* Encode the file name and put it in NEW_ARGV. 1618 /* Encode the file name and put it in NEW_ARGV.
1645 That's where the child will use it to execute the program. */ 1619 That's where the child will use it to execute the program. */
@@ -1666,8 +1640,6 @@ usage: (make-process &rest ARGS) */)
1666 new_argc++; 1640 new_argc++;
1667 } 1641 }
1668 1642
1669 UNGCPRO;
1670
1671 /* Now that everything is encoded we can collect the strings into 1643 /* Now that everything is encoded we can collect the strings into
1672 NEW_ARGV. */ 1644 NEW_ARGV. */
1673 char **new_argv; 1645 char **new_argv;
@@ -1685,7 +1657,6 @@ usage: (make-process &rest ARGS) */)
1685 else 1657 else
1686 create_pty (proc); 1658 create_pty (proc);
1687 1659
1688 UNGCPRO;
1689 SAFE_FREE (); 1660 SAFE_FREE ();
1690 return unbind_to (count, proc); 1661 return unbind_to (count, proc);
1691} 1662}
@@ -2110,7 +2081,6 @@ usage: (make-pipe-process &rest ARGS) */)
2110{ 2081{
2111 Lisp_Object proc, contact; 2082 Lisp_Object proc, contact;
2112 struct Lisp_Process *p; 2083 struct Lisp_Process *p;
2113 struct gcpro gcpro1;
2114 Lisp_Object name, buffer; 2084 Lisp_Object name, buffer;
2115 Lisp_Object tem; 2085 Lisp_Object tem;
2116 ptrdiff_t specpdl_count; 2086 ptrdiff_t specpdl_count;
@@ -2120,7 +2090,6 @@ usage: (make-pipe-process &rest ARGS) */)
2120 return Qnil; 2090 return Qnil;
2121 2091
2122 contact = Flist (nargs, args); 2092 contact = Flist (nargs, args);
2123 GCPRO1 (contact);
2124 2093
2125 name = Fplist_get (contact, QCname); 2094 name = Fplist_get (contact, QCname);
2126 CHECK_STRING (name); 2095 CHECK_STRING (name);
@@ -2244,7 +2213,6 @@ usage: (make-pipe-process &rest ARGS) */)
2244 2213
2245 specpdl_ptr = specpdl + specpdl_count; 2214 specpdl_ptr = specpdl + specpdl_count;
2246 2215
2247 UNGCPRO;
2248 return proc; 2216 return proc;
2249} 2217}
2250 2218
@@ -2727,10 +2695,8 @@ usage: (serial-process-configure &rest ARGS) */)
2727 struct Lisp_Process *p; 2695 struct Lisp_Process *p;
2728 Lisp_Object contact = Qnil; 2696 Lisp_Object contact = Qnil;
2729 Lisp_Object proc = Qnil; 2697 Lisp_Object proc = Qnil;
2730 struct gcpro gcpro1;
2731 2698
2732 contact = Flist (nargs, args); 2699 contact = Flist (nargs, args);
2733 GCPRO1 (contact);
2734 2700
2735 proc = Fplist_get (contact, QCprocess); 2701 proc = Fplist_get (contact, QCprocess);
2736 if (NILP (proc)) 2702 if (NILP (proc))
@@ -2745,14 +2711,9 @@ usage: (serial-process-configure &rest ARGS) */)
2745 error ("Not a serial process"); 2711 error ("Not a serial process");
2746 2712
2747 if (NILP (Fplist_get (p->childp, QCspeed))) 2713 if (NILP (Fplist_get (p->childp, QCspeed)))
2748 { 2714 return Qnil;
2749 UNGCPRO;
2750 return Qnil;
2751 }
2752 2715
2753 serial_configure (p, contact); 2716 serial_configure (p, contact);
2754
2755 UNGCPRO;
2756 return Qnil; 2717 return Qnil;
2757} 2718}
2758 2719
@@ -2834,7 +2795,6 @@ usage: (make-serial-process &rest ARGS) */)
2834 int fd = -1; 2795 int fd = -1;
2835 Lisp_Object proc, contact, port; 2796 Lisp_Object proc, contact, port;
2836 struct Lisp_Process *p; 2797 struct Lisp_Process *p;
2837 struct gcpro gcpro1;
2838 Lisp_Object name, buffer; 2798 Lisp_Object name, buffer;
2839 Lisp_Object tem, val; 2799 Lisp_Object tem, val;
2840 ptrdiff_t specpdl_count; 2800 ptrdiff_t specpdl_count;
@@ -2843,7 +2803,6 @@ usage: (make-serial-process &rest ARGS) */)
2843 return Qnil; 2803 return Qnil;
2844 2804
2845 contact = Flist (nargs, args); 2805 contact = Flist (nargs, args);
2846 GCPRO1 (contact);
2847 2806
2848 port = Fplist_get (contact, QCport); 2807 port = Fplist_get (contact, QCport);
2849 if (NILP (port)) 2808 if (NILP (port))
@@ -2946,7 +2905,6 @@ usage: (make-serial-process &rest ARGS) */)
2946 2905
2947 specpdl_ptr = specpdl + specpdl_count; 2906 specpdl_ptr = specpdl + specpdl_count;
2948 2907
2949 UNGCPRO;
2950 return proc; 2908 return proc;
2951} 2909}
2952 2910
@@ -3137,7 +3095,6 @@ usage: (make-network-process &rest ARGS) */)
3137 int ret = 0; 3095 int ret = 0;
3138 int xerrno = 0; 3096 int xerrno = 0;
3139 int s = -1, outch, inch; 3097 int s = -1, outch, inch;
3140 struct gcpro gcpro1;
3141 ptrdiff_t count = SPECPDL_INDEX (); 3098 ptrdiff_t count = SPECPDL_INDEX ();
3142 ptrdiff_t count1; 3099 ptrdiff_t count1;
3143 Lisp_Object colon_address; /* Either QClocal or QCremote. */ 3100 Lisp_Object colon_address; /* Either QClocal or QCremote. */
@@ -3155,7 +3112,6 @@ usage: (make-network-process &rest ARGS) */)
3155 3112
3156 /* Save arguments for process-contact and clone-process. */ 3113 /* Save arguments for process-contact and clone-process. */
3157 contact = Flist (nargs, args); 3114 contact = Flist (nargs, args);
3158 GCPRO1 (contact);
3159 3115
3160#ifdef WINDOWSNT 3116#ifdef WINDOWSNT
3161 /* Ensure socket support is loaded if available. */ 3117 /* Ensure socket support is loaded if available. */
@@ -3722,7 +3678,6 @@ usage: (make-network-process &rest ARGS) */)
3722 3678
3723 { 3679 {
3724 /* Setup coding systems for communicating with the network stream. */ 3680 /* Setup coding systems for communicating with the network stream. */
3725 struct gcpro gcpro1;
3726 /* Qt denotes we have not yet called Ffind_operation_coding_system. */ 3681 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
3727 Lisp_Object coding_systems = Qt; 3682 Lisp_Object coding_systems = Qt;
3728 Lisp_Object val; 3683 Lisp_Object val;
@@ -3747,13 +3702,9 @@ usage: (make-network-process &rest ARGS) */)
3747 if (NILP (host) || NILP (service)) 3702 if (NILP (host) || NILP (service))
3748 coding_systems = Qnil; 3703 coding_systems = Qnil;
3749 else 3704 else
3750 { 3705 coding_systems = CALLN (Ffind_operation_coding_system,
3751 GCPRO1 (proc); 3706 Qopen_network_stream, name, buffer,
3752 coding_systems = CALLN (Ffind_operation_coding_system, 3707 host, service);
3753 Qopen_network_stream, name, buffer,
3754 host, service);
3755 UNGCPRO;
3756 }
3757 if (CONSP (coding_systems)) 3708 if (CONSP (coding_systems))
3758 val = XCAR (coding_systems); 3709 val = XCAR (coding_systems);
3759 else if (CONSP (Vdefault_process_coding_system)) 3710 else if (CONSP (Vdefault_process_coding_system))
@@ -3780,13 +3731,9 @@ usage: (make-network-process &rest ARGS) */)
3780 if (NILP (host) || NILP (service)) 3731 if (NILP (host) || NILP (service))
3781 coding_systems = Qnil; 3732 coding_systems = Qnil;
3782 else 3733 else
3783 { 3734 coding_systems = CALLN (Ffind_operation_coding_system,
3784 GCPRO1 (proc); 3735 Qopen_network_stream, name, buffer,
3785 coding_systems = CALLN (Ffind_operation_coding_system, 3736 host, service);
3786 Qopen_network_stream, name, buffer,
3787 host, service);
3788 UNGCPRO;
3789 }
3790 } 3737 }
3791 if (CONSP (coding_systems)) 3738 if (CONSP (coding_systems))
3792 val = XCDR (coding_systems); 3739 val = XCDR (coding_systems);
@@ -3806,7 +3753,6 @@ usage: (make-network-process &rest ARGS) */)
3806 p->inherit_coding_system_flag 3753 p->inherit_coding_system_flag
3807 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3754 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
3808 3755
3809 UNGCPRO;
3810 return proc; 3756 return proc;
3811} 3757}
3812 3758
@@ -5422,8 +5368,6 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars,
5422 bool outer_running_asynch_code = running_asynch_code; 5368 bool outer_running_asynch_code = running_asynch_code;
5423 int waiting = waiting_for_user_input_p; 5369 int waiting = waiting_for_user_input_p;
5424 5370
5425 /* No need to gcpro these, because all we do with them later
5426 is test them for EQness, and none of them should be a string. */
5427#if 0 5371#if 0
5428 Lisp_Object obuffer, okeymap; 5372 Lisp_Object obuffer, okeymap;
5429 XSETBUFFER (obuffer, current_buffer); 5373 XSETBUFFER (obuffer, current_buffer);
@@ -6605,8 +6549,6 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6605 if (inhibit_sentinels) 6549 if (inhibit_sentinels)
6606 return; 6550 return;
6607 6551
6608 /* No need to gcpro these, because all we do with them later
6609 is test them for EQness, and none of them should be a string. */
6610 odeactivate = Vdeactivate_mark; 6552 odeactivate = Vdeactivate_mark;
6611#if 0 6553#if 0
6612 Lisp_Object obuffer, okeymap; 6554 Lisp_Object obuffer, okeymap;
@@ -6684,16 +6626,10 @@ status_notify (struct Lisp_Process *deleting_process,
6684{ 6626{
6685 Lisp_Object proc; 6627 Lisp_Object proc;
6686 Lisp_Object tail, msg; 6628 Lisp_Object tail, msg;
6687 struct gcpro gcpro1, gcpro2;
6688 int got_some_output = -1; 6629 int got_some_output = -1;
6689 6630
6690 tail = Qnil; 6631 tail = Qnil;
6691 msg = Qnil; 6632 msg = Qnil;
6692 /* We need to gcpro tail; if read_process_output calls a filter
6693 which deletes a process and removes the cons to which tail points
6694 from Vprocess_alist, and then causes a GC, tail is an unprotected
6695 reference. */
6696 GCPRO2 (tail, msg);
6697 6633
6698 /* Set this now, so that if new processes are created by sentinels 6634 /* Set this now, so that if new processes are created by sentinels
6699 that we run, we get called again to handle their status changes. */ 6635 that we run, we get called again to handle their status changes. */
@@ -6754,7 +6690,6 @@ status_notify (struct Lisp_Process *deleting_process,
6754 } /* end for */ 6690 } /* end for */
6755 6691
6756 update_mode_lines = 24; /* In case buffers use %s in mode-line-format. */ 6692 update_mode_lines = 24; /* In case buffers use %s in mode-line-format. */
6757 UNGCPRO;
6758 return got_some_output; 6693 return got_some_output;
6759} 6694}
6760 6695