This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gc suggestions


> > It seems that scm_block_gc could be used to do the job, but even if it is
> > set the after-gc-hook is run, which is also not initialized until
> > scm_init_gx is performed.  However, as I said in a previous mail, this may
> > be a bug.
> 
> it definitely seems so (um...), yes.  fill free to fix, etc. ;)

So what is the fix then?  Currently we have:

* scm_before_gc_c_hook is run _before_ scm_block_gc is tested.  Thus, it
  seems that it was intented to allow scm_before_gc_c_hook to set
  scm_block_gc to inhibit gc.  However, scm_after_gc_c_hook is _not_ run
  if scm_block_gc is set.  This is asymmetrical.
* after-gc-hook is always run, even if scm_block_gc is set.

The problem is, that I think it is a good idea to have a pair of C
level hooks that are called as wrappers, even if there is no gc in
between.  This could be the role of the current scm_before_gc_c_hook and
scm_after_gc_c_hook.  In any case these should be called symmetrically.
But probably these should be renamed to something else in order to avoid
confusion with the scheme level after-gc-hook.

I am not sure what to think about after-gc-hook at all:  In which
situations shall this hook be run?  Shall it be run with every call to
scm_igc (the current solution) even if no gc is performed?  (Then this
would be the same as with scm_before_gc_c_hook and scm_after_gc_c_hook.)
Or shall after-gc-hook only be run after an actual gc?  (In this case the
names of scm_before_gc_c_hook and scm_after_gc_c_hook should be changed in
order to represent the different concepts.)  A final idea would be to get
rid of after-gc-hook completely.  As I have mentioned, in the context of
cell access debugging when triggering intermediate gc's, it is problematic
if the gc causes code to be performed outside of the scope of the gc
itself.  This is the case with after-gc-hook, since it is performed as an
async as soon as the gc has finished.

So, what do you think?

Dirk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]