This is the mail archive of the guile@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: Calling Scheme from C and Garbage Collection






>Looks like it could be. What happens sometimes is that the compiler is
>optimizing away the SCM value, so that the gc can miss it. What you
>can do is scm_remember(&r),

Heck, I wasn't that worried before. Now I _AM_ worried. That means if
every time I get a minor compiler upgrade I have to re-test every
single thread of logic in case the compiler has got better at optimising
things. And you think explicit marking is hard work? At least what works
stays working.

Can this be solved by looking at CPU registers or something?

>Of course, the same can be said of a program that used explicit
>allocation/deallocation or registration of roots, where it was messed
>in one out of the way place that didn't show up until someone
>croaked.

I can't see the problem here. If you write a new C function then there
should be some scheme testing flag that does a full garbage collect
every time a scheme object is allocated. Any collected objects are
set to 0xffff for testing purposes. You'd find out pretty quick if there
were any bugs in a newly added function doing this. Of course the idea
is not to be writing C functions all day and integrating it into scheme.
I think you should be aiming to write everything in scheme and only adding
C functions for external libraries or when absolutely necessary.