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: Some profile results: scm_sloppy_assq?


On 14 Jun 2000, Michael Livshin wrote:

> > I think scm_unprotect_object is broken:  It decrements the CAR of the
> > handle, while in scm_protect_object the CDR is incremented.
> 
> eeek!  good catch.

Thanks :-)

It is surprising that we did not stumble across that error much earlier:  
The way the wrong code 'worked' it should have led to a corrupted heap.

In any case, it is an argument to extend the set of SCM_DEBUG macros in a
way that we can make sure that calls to SCM_INUM and other similar macros 
do an exhaustive argument check.  This, at least, would have caught that
one.

While it seems that this bug was the reason for the strange behaviour that
Han-Wen and Jan encountered, it might be worth for you if you could try
out your code with a guile that checks for a couple of things, like:
* Are rest arguments always passed as a proper list?
* Do your heap references actually point into the heap?
* Are you using deprecated functions or variables?
Look into __scm.h for an explanation of the corresponding SCM_DEBUG
macros.  Enabling them (especially SCM_DEBUG_CELL_ACCESSES) will make your
code slower by a factor of 10, though :-(

I'm planning (for a future release) to add SCM_DEBUG options that will
check whether the arguments of SCM_CAR and friends are actually pairs,
whether the argument of SCM_INUM is really an inum and so on.  All this
will slow guile down, but it is only intended for developers that take up
the risc to use any of those macros.  Those should be able --- from time
to time --- to use a specially compiled guile version, while we can keep
the standard guile as fast as possible.

Good luck
Dirk


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