From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Mikael Djurfeldt" Newsgroups: gmane.lisp.guile.devel Subject: Re: Goops & Valgrind Date: Tue, 19 Aug 2008 13:53:51 +0200 Message-ID: <66e540fe0808190453s568802b3x9dbe1808407a47fd@mail.gmail.com> References: Reply-To: mikael@djurfeldt.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1219146922 31695 80.91.229.12 (19 Aug 2008 11:55:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Aug 2008 11:55:22 +0000 (UTC) Cc: guile-devel@gnu.org To: hanwen@xs4all.nl Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Aug 19 13:56:06 2008 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.50) id 1KVPnf-0007zQ-Fa for guile-devel@m.gmane.org; Tue, 19 Aug 2008 13:54:59 +0200 Original-Received: from localhost ([127.0.0.1]:40539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVPmi-0004vC-Bn for guile-devel@m.gmane.org; Tue, 19 Aug 2008 07:54:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KVPmd-0004v7-0J for guile-devel@gnu.org; Tue, 19 Aug 2008 07:53:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVPmb-0004uv-8B for guile-devel@gnu.org; Tue, 19 Aug 2008 07:53:53 -0400 Original-Received: from [199.232.76.173] (port=56119 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVPmb-0004us-39 for guile-devel@gnu.org; Tue, 19 Aug 2008 07:53:53 -0400 Original-Received: from mail-gx0-f12.google.com ([209.85.217.12]:50376) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KVPma-00050p-UU for guile-devel@gnu.org; Tue, 19 Aug 2008 07:53:53 -0400 Original-Received: by gxk5 with SMTP id 5so4751013gxk.18 for ; Tue, 19 Aug 2008 04:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :sender:to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=x04QwfQ1liVVlrZCfYHmz3g3iLLAJ/HDdfOhwFdKsFA=; b=kdRFQgI+lpokrl1xkEgINUrq8Wx6YTWQQOQEkX6YV7immafM0fj1Aq8mSptKlMVSmY sdFsCIIVnxdkMFGw35Mmhz3G7qdY8PVbEGoEbOrsGlSks5qERQlGZexpjmhgwvG9N3gx jmfrpxfNegQ0eYjzueMv7z7PdvEuBku+J3x/M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references:x-google-sender-auth; b=CWMbJdQwZGkZpELVetA+jBPm5VgocwLWplWwGItFSrm47TVNHuDiOpyQeS9p9EgpCc 2ZdM6qsCQtHSUZ9FWGKeZfHvQWvUCckn4vob3U27aOKgORG1nn/MIbDkypFcx8InpJce x+25Dyr6zAnY1CRzYXHSq1ppX7nFuG7nXdD0k= Original-Received: by 10.150.122.13 with SMTP id u13mr11715039ybc.248.1219146831745; Tue, 19 Aug 2008 04:53:51 -0700 (PDT) Original-Received: by 10.150.54.2 with HTTP; Tue, 19 Aug 2008 04:53:51 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-Google-Sender-Auth: 9baeb8b99d9ddb66 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:7465 Archived-At: 2008/8/16 Han-Wen Nienhuys : > Running the test suite through valgrind, I get some fishy errors. > > Can someone shed a light on this? The culprit seems to be > > #define SCM_NUMBER_OF_SLOTS(x) \ > ((SCM_STRUCT_DATA (x)[scm_struct_i_n_words]) - scm_struct_n_extra_words) > > where scm_struct_i_n_words is -2 This is severely bitrotted code. There are at least three errors associated with this: 1. scm_struct_i_n_words is an offset in a vtable (a GOOPS class is a vtable), but %fast-slot-ref passes an instance 2. The value at this location apparently now is the number of slots with nonnegative index (contrary to what is said by some comment in the code), so scm_struct_n_extra_words should not be subtracted 3. It's not sensible to access slots this way (as in %fast-slot-ref/set!) since different kinds of slots have different representations of their data. However, when working with the MOP (as active-slot.scm does) some kind of more direct or raw access to the slots may be required. Unfortunately, I don't have time to fix this. I suggest that some Guile developer removes %fast-slot-ref/set! and supplies some other (more clean) way of supporting the code in active-slot.scm. Also, make sure to check that these primitives are not used anywhere else. I apologize if I'm the reason for parts or all of this mess. Best regards, Mikael D.