From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: smob mark functions in 2.0 Date: Wed, 23 Nov 2011 22:20:45 +0100 Message-ID: <87aa7mmt76.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1322088971 13972 80.91.229.12 (23 Nov 2011 22:56:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 23 Nov 2011 22:56:11 +0000 (UTC) To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Nov 23 23:56:06 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RTLjZ-00047f-ME for guile-user@m.gmane.org; Wed, 23 Nov 2011 23:56:05 +0100 Original-Received: from localhost ([::1]:47561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTLjU-0003Ir-1w for guile-user@m.gmane.org; Wed, 23 Nov 2011 17:56:00 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:36531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTLjQ-0003IT-8G for guile-user@gnu.org; Wed, 23 Nov 2011 17:55:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTLjP-0007Xb-3b for guile-user@gnu.org; Wed, 23 Nov 2011 17:55:56 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:60482 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTLjO-0007XX-TJ for guile-user@gnu.org; Wed, 23 Nov 2011 17:55:54 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 95DE081E8 for ; Wed, 23 Nov 2011 17:55:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:mime-version:content-type; s=sasl; bh=r LrL/lGvav0OR4L798ehoGtHXzA=; b=V/vgwKAokASZS3Sex0gahumAnBeE/V8Ig cGrbT1xLgVI57BHA5i/CpSjixI72FOJkY4lwwxrJr0dd6v13zsUXzem+SXJ0ojjK 7dh/MmfbZOUTKeQLord7oTcfTidWqZqpRw7SZsXyEKTwMKxAdLDsGPnN2/C9s5u/ HO7QQD2UXU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:mime-version:content-type; q=dns; s=sasl; b=AEQ zJzn9B9DmqLBIX7zciYmb/rRZtFand5tve3xnYaGQECyoT9jXwN0Q8dCRLXsJmoh 7CGy0b9VaNolAhrlHrZw0ojIkkFWOH4IaB7tthBsvDK+zuoT5PJyYBB9PD1+LFIh +j2zsCkn3xrUWTgYeECn8pYTPXlfFJNiI4HGdQjU= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 8B7E581E7 for ; Wed, 23 Nov 2011 17:55:54 -0500 (EST) Original-Received: from badger (unknown [95.214.56.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 6C2ED81E6 for ; Wed, 23 Nov 2011 17:55:52 -0500 (EST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: 4C0CBC44-1626-11E1-A162-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.62 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8993 Archived-At: Hello all, I don't know how you feel, but for me the BDW garbage collector used in Guile 2.0 has made my life much easier than it was. You typically don't have to write SMOB marking functions any more. However, I just fixed a bug in g-wrap that was a bit surprising to me. If you do implement a SMOB marking function, and you touch Scheme objects in that marking function, you need to be very careful. Specifically, there is a warning in gc/gc_mark.h: /* WARNING: Such a mark procedure may be invoked on an unused object */ /* residing on a free list. Such objects are cleared, except for a */ /* free list link field in the first word. Thus mark procedures may */ /* not count on the presence of a type descriptor, and must handle this */ /* case correctly somehow. */ So, your mark function might see freed objects. This is terrible, but it is the way that it is. The key is that, if you touch a Scheme object in your mark function, to first do a check on that object, to see that it is valid. You can check the TC bits of the first word, or otherwise check that other words are non-NULL. Caveat mercator! Andy -- http://wingolog.org/