From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: Concurrency Date: Mon, 29 Mar 2010 12:18:08 -0600 Message-ID: References: <27349166.post@talk.nabble.com> <27560255.post@talk.nabble.com> <4B754E74.8060705@swipnet.se> <27563610.post@talk.nabble.com> <4B7564C7.1010309@swipnet.se> <27564728.post@talk.nabble.com> <4B756FB7.3050202@swipnet.se> <87k4ui4gik.fsf@lola.goethe.zz> <27566385.post@talk.nabble.com> <87wryi2sjd.fsf@lola.goethe.zz> <27585994.post@talk.nabble.com> <87k4ucdmwh.fsf@stupidchicken.com> <87d3zweq4e.fsf@master.homenet> <87y6hg1h4a.fsf@thor.thematica.it> <87tys3j9fa.fsf@lifelogs.com> <87eij6tqmu.fsf@lifelogs.com> Reply-To: Tom Tromey NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1269887732 30724 80.91.229.12 (29 Mar 2010 18:35:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 29 Mar 2010 18:35:32 +0000 (UTC) Cc: Ted Zlatanov , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 29 20:35:28 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NwJo7-0006A0-Hs for ged-emacs-devel@m.gmane.org; Mon, 29 Mar 2010 20:35:27 +0200 Original-Received: from localhost ([127.0.0.1]:33715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwJo7-0006Vl-0q for ged-emacs-devel@m.gmane.org; Mon, 29 Mar 2010 14:35:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NwJjZ-0003gu-5g for emacs-devel@gnu.org; Mon, 29 Mar 2010 14:30:45 -0400 Original-Received: from [140.186.70.92] (port=40902 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwJjX-0003Yw-S1 for emacs-devel@gnu.org; Mon, 29 Mar 2010 14:30:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NwJXV-0001eL-MI for emacs-devel@gnu.org; Mon, 29 Mar 2010 14:18:19 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:2216) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NwJXV-0001e7-F1 for emacs-devel@gnu.org; Mon, 29 Mar 2010 14:18:17 -0400 Original-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2TIIDkI009155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 29 Mar 2010 14:18:13 -0400 Original-Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2TII9DB031437; Mon, 29 Mar 2010 14:18:10 -0400 Original-Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o2TII8xe009591; Mon, 29 Mar 2010 14:18:09 -0400 Original-Received: by opsy.redhat.com (Postfix, from userid 500) id 87BEF378185; Mon, 29 Mar 2010 12:18:08 -0600 (MDT) X-Attribution: Tom In-Reply-To: (Stefan Monnier's message of "Sat, 27 Mar 2010 09:33:46 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:122863 Archived-At: Stefan> Actually, we need both: we need to document the changes, as seen Stefan> by an Elisp programmer (fits in etc/NEWS), and we need to Stefan> document the way it works internally, the invariants upon which Stefan> it relies and things like that. I can supply some of the raw data here, if not the commits. We added a few new lisp objects: * thread_state. This represents a single thread. Before dumping, only one thread may exist. Some C variables which were formerly global were moved into this struct, and replaced with a redirecting #define. E.g.: /* Pointer to beginning of specpdl. */ struct specbinding *m_specpdl; #define specpdl (current_thread->m_specpdl) Exactly which things needed to be in this structure was determined in an ad hoc way; mostly by looking at `nm' to see what globals were interesting. * Lisp_Mutex. A mutex, should be obvious. * Lisp_ThreadLocal. This is used to represent a thread-local binding. It has a slot for the global value, and an alist mapping threads to a thread-local slot. If a thread is not in the alist, the global binding is used. A Lisp_ThreadLocal can appear in a number of places, e.g. in a variable binding, in a Lisp_Object global variable, etc. We rewrote a lot of the C code to automatically indirect through a Lisp_ThreadLocal, when found. There is a new header, globals.h, which has many lines of the form: #define Vafter_change_functions *find_variable_location (&impl_Vafter_change_functions) A couple things about this line: * The expansion is chosen so that both rvalue and lvalue uses work. * The underlying global is renamed to catch any errors. There are other changes (in the GC, in the binding code) but I think those are relatively self-explanatory in the code... at least, hopefully as much as the code was before. Tom