From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: Fluids Date: Sun, 14 Feb 2010 16:50:57 +0100 Message-ID: References: <87eiknx4zl.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1266162593 29238 80.91.229.12 (14 Feb 2010 15:49:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Feb 2010 15:49:53 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Feb 14 16:49:49 2010 Return-path: Envelope-to: guile-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 1NggjE-0001VY-5f for guile-devel@m.gmane.org; Sun, 14 Feb 2010 16:49:48 +0100 Original-Received: from localhost ([127.0.0.1]:33229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NggjD-0007Rg-LH for guile-devel@m.gmane.org; Sun, 14 Feb 2010 10:49:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nggj7-0007Rb-E9 for guile-devel@gnu.org; Sun, 14 Feb 2010 10:49:41 -0500 Original-Received: from [140.186.70.92] (port=33099 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nggj6-0007R9-CA for guile-devel@gnu.org; Sun, 14 Feb 2010 10:49:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nggj5-000818-Kw for guile-devel@gnu.org; Sun, 14 Feb 2010 10:49:40 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:37511 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nggj5-000811-HO; Sun, 14 Feb 2010 10:49:39 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id EE6659A653; Sun, 14 Feb 2010 10:49:36 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=Q4sRKAwuTaAx JJE/zW8g8BAP0/Q=; b=rS550DmzEtNvDQwt+qj0ZLJTRrs+82ag5bR+6zQBCsAG GfPZBy6HQ4V0hHyq6QjlIn7e9mk0h0B0KdZQQpoFS2u6NPEV9TNywLS0VZKArIOn StjuVwVI8Zr0+IBJKMi1P51LRjS7qYSvSj9VizET/DxKgQPe3MAhiQcSHmlPw28= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=w/DR7R HHo9AXefRee4n+zdARFJju6UX3qyCUs67+38YoebbEh+to3jnq5CWLfxc/AlkoHd El++t0Nj5+9jKul7qiFS2lqiBTIud4Lv+q3IinCMbLjp5ewejrczgxKdLZumPnc+ VQNaUwzKkb0ZQYoDbv6L2RGOOmGccXwm6NUpo= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id D6A7D9A652; Sun, 14 Feb 2010 10:49:35 -0500 (EST) Original-Received: from unquote (unknown [79.151.216.235]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id F189F9A64F; Sun, 14 Feb 2010 10:49:33 -0500 (EST) In-Reply-To: <87eiknx4zl.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 14 Feb 2010 15:32:30 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 8D1DB818-1980-11DF-A60D-6AF7ED7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:9980 Archived-At: Heya, On Sun 14 Feb 2010 15:32, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Andy Wingo writes: > >> But you can't / shouldn't make a new fluid every time you enter a >> `catch', because currently fluids are never garbage collected! We really >> need to fix this. I think it's a 1.9 regression. > > Indeed. We should use a weak vector or some such instead of the current > scm_gc_malloc=E2=80=99d array. > >> To do so effectively, I think you'd need to make fluid objects store >> their values directly, so that the GC doesn't have to go through hoops >> to know that they're collectable. Ideally they would get their values >> via pthread_getspecific; but that would defeat some bits of ours about >> "dynamic states" (not a very useful concept IMO), and the GC would need >> help. Actually it would be nice if libgc supported thread-local >> allocations. (Does it?) > > I think dynamically allocating thread-local storage can only be done > with pthread_key_create=C2=A0(). Libgc knows how to scan pthread keys. = So > we could have fluids be wrappers around pthread keys and fluid-ref would > boil down to pthread_getspecific=C2=A0(). Then we wouldn=E2=80=99t even = need the > fluid number hack. > > Is it what you had in mind? Yes, this is what I had in mind; I was not aware that libgc could scan thread-specific variables. This is great news, I think. My only qualm regards the number of potential pthread_key variables. My current emacs session has about 15K functions and 7K variables. Does the pthread_key mechanism scale well to this number of thread-local variables? Also we would probably still need a weak vector of all fluids, to support dynamic states. But this is well-supported by libgc. Andy --=20 http://wingolog.org/