[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: please help concerning specpdl

From: Ken Raeburn
Subject: Re: please help concerning specpdl
Date: Tue, 14 Dec 2010 19:53:20 -0500

On Dec 14, 2010, at 19:14, Davis Herring wrote:
>> I see that GCPROx macros are used to protect the variables of type Lisp
>> Object on the stack of C code (that the compiler creates), not to protect
>> the lisp objects in specpdl. The GCPRO protection is against the algorthm
>> of conservative stack. Am I right ?
> I believe the GCPRO draws the attention of the stack checker to those Lisp
> objects to make sure that they're not collected.

The Lisp engine and the garbage collection code have undergone some revision 
over the years, and support a few different configurations based on the machine 
architecture and operating system support.  See, for example, the comment 
discussing GC_MARK_STACK in lisp.h.  GCPRO macros are used to keep track of 
Lisp_Object variables on the C stack in case conservative stack scanning is not 
used.  If conservative stack scanning is used, you can make GCPRO macros be 
no-ops, or you can instrument them to compare the effectiveness of the two 

But in terms of writing C code, you should assume that the GCPRO machinery is 

(Well, that's not 100% true.  If any code path that can result in the garbage 
collector being called either doesn't care about a particular object any more, 
or can guarantee that the object will be visible to the garbage collector 
through some other path, then it needn't be recorded with GCPRO.  But it's 
probably better to be conservative if you're not completely certain.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]