|
From: Marcus C. <cre...@in...> - 2006-03-22 12:36:11
|
>>>>>"JS" == Julian Seward <js...@ac...> writes: JS> Thanks for filing #124035. I can reproduce the problem using JS> your valgrind-test.c. I can also get rid of the problem by JS> giving the flag --vex-iropt-precise-memory-exns=yes to Valgrind. Works for me, too. JS> The problem is your segfault handler returns and so restarts the JS> faulting instruction, having screwed around with the page permissions. JS> By default Valgrind optimises the code it generates in such a way JS> that the simulated registers are not always up to date, so when JS> the exception happens, in effect some of the most recent changes JS> to the simulated registers are lost. JS> --vex-iropt-precise-memory-exns=yes disables this optimisation JS> at the cost of some performance overhead. Thanks for clearing this up so quickly! JS> I have to ask, is it really a good idea to add this to XEmacs? JS> Doing so violates POSIX compliance (POSIX does not allow segfault JS> handlers to return, IIRC, or says that your process state JS> is undefined after such an event, or something bad like that.) Yes, I am aware of that. But currently, it is the only way to advance the development of the garbage collector. We are not yet able to annotate each pointer update in the sources, which would be the only alternative to the virtual dirty bit write barrier. So the only way to get a working write barrier is with the assistance from the virtual memory system. Although not fully covered by POSIX, most operating systems support a generic virtual dirty bit write barrier. Actually, XEmacs with my incremental garbage collector runs on many kinds of Linux, FreeBSD, Solaris, Mac OS X, native Windows, and Cygwin. And now even under valgrind. There are some other systems around that use the same techniques. The new XEmacs collector for example uses a lot of the ideas of PLT's MzScheme[1] and the Boehm-Demers-Weiser conservative garbage collector[2]. All don't seem to have problems with it. Again, thanks very much for your help! Footnotes: [1] http://www.plt-scheme.org/software/mzscheme [2] http://www.hpl.hp.com/personal/Hans_Boehm/gc -- Marcus |