🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98579

Emacs crashing in GC

#98579
From: Jim Blandy
Date: Mon, 29 Apr 1991 04:56
144 lines
6059 bytes
One should not staticpro variables twice.  

The garbage collecter wants to be able to compact the strings to
reduce fragmentation in the string blocks.  After moving the strings,
it must adjust all references to the string to use the string's new
address.  It builds this list while marking, by replacing each
reference to the string with a pointer to the previous reference
encountered, and storing a pointer to the first of the chain of
references in the string's size field.  The size is used to terminate
the list of references, so it is recovered after all the references
have been adjusted.  Gag me with a tag bit.

If a variable is staticpro'd twice and it holds a string, the second
time the mark pass comes around it will find the variable holds a
reference pointer, not a genuine lisp object.  On most systems the
reference pointer happens to look like a Lisp_Int, and everything is
fine.  On the RT, it looks like a vector, and the garbage collecter
dies a gruesome death trying to mark it.


Sat Apr 27 21:56:59 1991  Jim Blandy  (jimb at pogo.gnu.ai.mit.edu)

	* keyboard.c (syms_of_keyboard): Qtop_level is initialized and
	staticpro'd in syms_of_data too.  Don't staticpro (or initialize)
	it again here.

	* macros.c (syms_of_macros): Since executing-macro and
	executing-kbd-macro are actually the same variable, use
	DEFVAR_LISP_NOPRO for the second one so it doesn't get staticpro'd
	twice.

	* process.c (syms_of_process): Don't staticpro or initialize Qexit
	here, since syms_of_eval already does this and it's bad to
	staticpro something twice.
	(Qexit): Remove declaration here, so there will be a compilation
	error if someone rearranges eval.c without fixing the Qexit stuff.
	* eval.c (syms_of_eval): Add comment here to say that
	syms_of_process cares about Qexit too.

	* lread.c (init_obarray): Don't staticpro Vobarray, since the
	DEFVAR_LISP in syms_of_read takes care of that.

*** keyboard.c.~2~	Thu Mar 21 20:23:31 1991
--- keyboard.c	Sat Apr 27 22:22:00 1991
*************** syms_of_keyboard ()
*** 2146,2154 ****
    Qbackward_char = intern ("backward-char");
    staticpro (&Qbackward_char);
  
-   Qtop_level = intern ("top-level");
-   staticpro (&Qtop_level);
- 
    Qdisabled = intern ("disabled");
    staticpro (&Qdisabled);
  
--- 2146,2151 ----
*** macros.c.~1~	Tue Jan  8 12:56:33 1991
--- macros.c	Sat Apr 27 22:18:23 1991
*************** syms_of_macros ()
*** 228,234 ****
    DEFVAR_LISP ("executing-macro", &Vexecuting_macro,
      "Currently executing keyboard macro (a string); nil if none executing.");
  
!   DEFVAR_LISP ("executing-kbd-macro", &Vexecuting_macro,
      "Currently executing keyboard macro (a string); nil if none executing.");
  
    DEFVAR_LISP ("last-kbd-macro", &Vlast_kbd_macro,
--- 228,234 ----
    DEFVAR_LISP ("executing-macro", &Vexecuting_macro,
      "Currently executing keyboard macro (a string); nil if none executing.");
  
!   DEFVAR_LISP_NOPRO ("executing-kbd-macro", &Vexecuting_macro,
      "Currently executing keyboard macro (a string); nil if none executing.");
  
    DEFVAR_LISP ("last-kbd-macro", &Vlast_kbd_macro,
*** eval.c.~1~	Fri Jan 25 17:14:49 1991
--- eval.c	Sat Apr 27 22:15:05 1991
*************** before making  inhibit-quit  nil.");
*** 2063,2068 ****
--- 2063,2070 ----
    Qmacro = intern ("macro");
    staticpro (&Qmacro);
  
+   /* Note that the process handling also uses Qexit, but we don't want
+      to staticpro it twice, so we just do it here.  */
    Qexit = intern ("exit");
    staticpro (&Qexit);
  
*** process.c.~1~	Tue Jan 15 20:28:48 1991
--- process.c	Sat Apr 27 22:15:02 1991
*************** the Free Software Foundation, 675 Mass A
*** 102,108 ****
  #include "termopts.h"
  #include "commands.h"
  
! Lisp_Object Qrun, Qstop, Qsignal, Qexit, Qopen, Qclosed;
  
  /* a process object is a network connection when its childp field is neither
     Qt nor Qnil but is instead a string (name of foreign host we
--- 102,109 ----
  #include "termopts.h"
  #include "commands.h"
  
! Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed;
! /* Qexit is declared and initialized in eval.c.  */
  
  /* a process object is a network connection when its childp field is neither
     Qt nor Qnil but is instead a string (name of foreign host we
*************** syms_of_process ()
*** 2452,2459 ****
    staticpro (&Qstop);
    Qsignal = intern ("signal");
    staticpro (&Qsignal);
!   Qexit = intern ("exit");
!   staticpro (&Qexit);
    Qopen = intern ("open");
    staticpro (&Qopen);
    Qclosed = intern ("closed");
--- 2453,2465 ----
    staticpro (&Qstop);
    Qsignal = intern ("signal");
    staticpro (&Qsignal);
! 
!   /* Qexit is already staticpro'd by syms_of_eval; don't staticpro it
!      here again.
! 
!      Qexit = intern ("exit");
!      staticpro (&Qexit); */
! 
    Qopen = intern ("open");
    staticpro (&Qopen);
    Qclosed = intern ("closed");
*** lread.c.~1~	Tue Jan  8 12:52:01 1991
--- lread.c	Sat Apr 27 21:58:17 1991
*************** init_obarray ()
*** 1085,1091 ****
    Qnil = Fmake_symbol (make_pure_string ("nil", 3));
    Vobarray = Fmake_vector (oblength, make_number (0));
    initial_obarray = Vobarray;
-   staticpro (&Vobarray);
    staticpro (&initial_obarray);
    /* Intern nil in the obarray */
    /* These locals are to kludge around a pyramid compiler bug. */
--- 1085,1090 ----
Technical Details
Message-ID: <9104290456.AA26065@geech.gnu.ai.mit.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,af20c365559c4909,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-04-28 21:56:09 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage
From: jimb@GNU.AI.MIT.EDU (Jim Blandy)
Newsgroups: gnu.emacs.bug
Subject: Emacs crashing in GC
Message-ID: <9104290456.AA26065@geech.gnu.ai.mit.edu>
Date: 29 Apr 91 04:56:09 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 144
Approved: bug-gnu-emacs@prep.ai.mit.edu