diff src/alloc.c @ 69873:2d844bbbccd4

* process.h (struct Lisp_Process): Replace Lisp_Objects `pid', `raw_status_high', and `raw_status_low' with plain integers, and move them to the end of the structure. * alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the pseudovector's size field so only the Lisp_Object fields get GC'd. * process.c (update_status, make_process, Fdelete_process) (Fprocess_status, list_processes_1, start_process_unwind) (create_process, Fmake_network_process, server_accept_connection) (wait_reading_process_output, send_process, Fprocess_running_child_p) (process_send_signal, proc_encode_coding_system, Fprocess_send_eof) (sigchld_handler, status_notify): Adjust to new non-Lisp fields for `pid' and `raw_status'. (Fprocess_id, Fsignal_process): Same, and additionally use floats when representing PIDs that are larger than most-positive-fixnum.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 08 Apr 2006 15:07:35 +0000
parents a685fca1ccb6
children 272487a77b8e
line wrap: on
line diff
--- a/src/alloc.c	Sat Apr 08 14:56:21 2006 +0000
+++ b/src/alloc.c	Sat Apr 08 15:07:35 2006 +0000
@@ -3003,13 +3003,17 @@
 struct Lisp_Process *
 allocate_process ()
 {
-  EMACS_INT len = VECSIZE (struct Lisp_Process);
-  struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_PROCESS);
+  /* Memory-footprint of the object in nb of Lisp_Object fields.  */
+  EMACS_INT memlen = VECSIZE (struct Lisp_Process);
+  /* Size if we only count the actual Lisp_Object fields (which need to be
+     traced by the GC).  */
+  EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid);
+  struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_PROCESS);
   EMACS_INT i;
 
-  for (i = 0; i < len; ++i)
+  for (i = 0; i < lisplen; ++i)
     v->contents[i] = Qnil;
-  v->size = len;
+  v->size = lisplen;
 
   return (struct Lisp_Process *) v;
 }
@@ -5558,6 +5562,10 @@
 	  if (size & PSEUDOVECTOR_FLAG)
 	    size &= PSEUDOVECTOR_SIZE_MASK;
 
+	  /* Note that this size is not the memory-footprint size, but only
+	     the number of Lisp_Object fields that we should trace.
+	     The distinction is used e.g. by Lisp_Process which places extra
+	     non-Lisp_Object fields at the end of the structure.  */
 	  for (i = 0; i < size; i++) /* and then mark its elements */
 	    mark_object (ptr->contents[i]);
 	}