From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7293 invoked by alias); 4 Feb 2013 16:44:12 -0000 Received: (qmail 7173 invoked by uid 22791); 4 Feb 2013 16:44:09 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Feb 2013 16:44:01 +0000 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.14.4/8.14.4) with ESMTP id r14Gi04C017999 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 4 Feb 2013 11:44:01 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r14GhxZx001604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 4 Feb 2013 11:44:00 -0500 From: Tom Tromey To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [2/3] RFC: merge symbol "ops" and "aclass" fields References: <8738y1hzzz.fsf@fleche.redhat.com> <20130203092001.GD16948@host2.jankratochvil.net> Date: Mon, 04 Feb 2013 16:44:00 -0000 In-Reply-To: <20130203092001.GD16948@host2.jankratochvil.net> (Jan Kratochvil's message of "Sun, 3 Feb 2013 10:20:01 +0100") Message-ID: <87sj5c112o.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00079.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> These three fields could be union. I suppose, but that complicates the accessors to save a tiny bit of memory. It may even be a net loss with the code growth. Jan> And these accessors could gdb_assert impl->ACLASS. Currently if Jan> ACLASS does not match it returns NULL, which would (correctly) Jan> crash on dereferencing a method but such coding bug would not be Jan> noticed during accesses like: if (SYMBOL_COMPUTED_OPS (sym) == Jan> &dwarf2_loclist_funcs) I know this code exists, but I find it pretty ugly. It is "anti OO" in the sense that it is checking the object class rather than just calling a method and letting the class handle itself. Probably I should have instead made the DWARF "datum" approach use another function vector... Adding an assertion in the macro would conflict with patch #3, which checks the various ops unconditionally. Tom