🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98942

possible eval.c GC error and possible fix

#98942
From: Mike Newton
Date: Sun, 13 Jan 1991 11:46
76 lines
3424 bytes
I've not studied the emacs/epoch garbage collector much, but when hunting
for another bug, I notice that the garbage-collector-protection routines
weren't being called in places that it sure looked like they should.  If
nothing else the comment in lisp.h:
   Every function that can call Feval must protect in this fashion all
   Lisp_Object variables whose contents will be used again.
supports this belief.  Enclosed below are the places I made patches.  If
some emacs-GC guru can look at them, I'd like to know if they are necessary,
and if not, why not.  Fixing this (and possibly more importantly, another
bug) did get things working againg....

- mike (newton@gumby.cs.caltech.edu)

/* from src/eval.c */

DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
  "(defvar SYMBOL INITVALUE DOCSTRING) defines SYMBOL as an advertised variable.\n\
INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void.\n\
INITVALUE and DOCSTRING are optional.\n\
If DOCSTRING starts with *, this variable is identified as a user option.\n\
 This means that M-x set-variable and M-x edit-options recognize it.\n\
If INITVALUE is missing, SYMBOL's value is not set.")
  (args)
     Lisp_Object args;
{
  register Lisp_Object sym, tem;
  struct gcpro gcpro1;			/* -- MON */

  sym = Fcar (args);			/* i assume these will be traced */
  tem = Fcdr (args);			/* as they are part of 'args' */
  if (!NULL (tem))
    {
      tem = Fboundp (sym);
      if (NULL (tem))
	{				/* -- MON */
	  GCPRO1( args );		/* -- MON */
	  Fset (sym, Feval (Fcar (Fcdr (args))));
	  UNGCPRO;			/* -- MON */
	}				/* -- MON */
    }
  tem = Fcar (Fcdr (Fcdr (args)));
  if (!NULL (tem))
    {
      if (!NULL (Vpurify_flag))
	tem = Fpurecopy (tem);
      Fput (sym, Qvariable_documentation, tem);
    }
  return sym;
}

DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0,
  "(defconst SYMBOL INITVALUE DOCSTRING) defines SYMBOL as a constant variable.\n\
The intent is that programs do not change this value (but users may).\n\
Always sets the value of SYMBOL to the result of evalling INITVALUE.\n\
DOCSTRING is optional.\n\
If DOCSTRING starts with *, this variable is identified as a user option.\n\
 This means that M-x set-variable and M-x edit-options recognize it.")
  (args)
     Lisp_Object args;
{
  register Lisp_Object sym, tem;
  struct gcpro gcpro1;			/* -- MON */

  GCPRO1 (args);			/* -- MON */
  sym = Fcar (args);
  Fset (sym, Feval (Fcar (Fcdr (args))));
  UNGCPRO;				/* -- MON */
  tem = Fcar (Fcdr (Fcdr (args)));
  if (!NULL (tem))
    {
      if (!NULL (Vpurify_flag))
	tem = Fpurecopy (tem);
      Fput (sym, Qvariable_documentation, tem);
    }
  return sym;
}
Technical Details
Message-ID: <9101131146.AA22979@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!tut.cis.ohio-state.edu!GUMBY.CS.CALTECH.EDU!newton

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,9a165ece8853ced5,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-01-14 01:39:58 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!tut.cis.ohio-state.edu!GUMBY.CS.CALTECH.EDU!newton
From: newton@GUMBY.CS.CALTECH.EDU (Mike Newton)
Newsgroups: gnu.emacs.bug
Subject: possible eval.c GC error and possible fix
Message-ID: <9101131146.AA22979@life.ai.mit.edu>
Date: 13 Jan 91 11:46:42 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: Gnus Not Usenet
Lines: 76
Approved: bug-gnu-emacs@prep.ai.mit.edu