emacs-devel
[Top][All Lists]
Advanced

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

Re: advice needed for multi-threading patch


From: Ken Raeburn
Subject: Re: advice needed for multi-threading patch
Date: Wed, 26 Aug 2009 14:50:36 -0400

On Aug 26, 2009, at 10:52, Stefan Monnier wrote:
(One change I'm looking at in my Guile work is changing indirect_variable to accept and return Lisp_Objects instead of struct Lisp_Symbol pointers, for
better GC safety.

I've done the exact opposite change fairly recently, so it would be
going backwards.

Oh, right... I meant to ask you at some point if there was a reason for that other than streamlining performance a little.

In the guile-emacs code, lots of things can trigger GC that wouldn't in Emacs, and it can happen in any thread; with some changes in the works on the Guile side, it may not even require a thread to reach a special synchronization point. The Guile model for random application- defined object types involves a SCM value that points to an cell or double-cell object, holding an integer indicating the type and 1-3 additional words that can be pointers or SCM values or whatever. So if you've got a big structure like a buffer, one of those words points to it. But if the SCM value isn't seen during GC, the cell doesn't get marked and gets released, and the big structure gets freed up, and much badness ensues.

Now, with the GC work in progress, it's possible that during conservative stack scanning, the pointer to the big structure might be enough to cause it to not get freed up; I'm not that familiar with the new code. But the conservative approach seems to be to keep the SCM (Lisp_Object) values live as long as the pointed-to data is needed.

It may also be that all of the callers will keep references to the symbol object until the indirect_variable work is done, even with uninterned symbols. If that's the case, maybe I don't need to be concerned on this score.

However, there's also the little matter that eventually I want to make Emacs use Guile symbols for its own symbols, for better interaction between the languages. That means that "struct Lisp_Symbol" would go away. If it's part of the internal function interfaces, that means the Guile work has to have greater divergence from the upstream code.

Ken




reply via email to

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