From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] feature/byte-switch 7c2d493: src/bytecode.c: Add optional sanity check for jump tables. Date: Sat, 11 Feb 2017 10:51:02 -0500 Message-ID: References: <20170211144458.18694.21302@vcs0.savannah.gnu.org> <20170211144459.A837B2319A@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486828283 5515 195.159.176.226 (11 Feb 2017 15:51:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Feb 2017 15:51:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Vibhav Pant To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 11 16:51:18 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccZxF-0000dz-Hk for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 16:51:17 +0100 Original-Received: from localhost ([::1]:48741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccZxE-0007Tb-8R for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 10:51:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccZx7-0007TK-EN for emacs-devel@gnu.org; Sat, 11 Feb 2017 10:51:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccZx2-0000IU-Ig for emacs-devel@gnu.org; Sat, 11 Feb 2017 10:51:09 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:27272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ccZx2-0000IN-B8 for emacs-devel@gnu.org; Sat, 11 Feb 2017 10:51:04 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DCBQAu3EVY//7rSC1dGwEBAQMBAQEJAQEBgzgBAQEBAR+EW6F8AZZeGYYDBAICghFDEQECAQEBAQEBAWIohGkGJy8jEAs0BwsUGA2JJqxXPYtEAQEBBwIBJIsZhRSFFQWPfIpqmxqGOpIPNSF4Ew6DWx0YgWMgiS0BAQE X-IPAS-Result: A0DCBQAu3EVY//7rSC1dGwEBAQMBAQEJAQEBgzgBAQEBAR+EW6F8AZZeGYYDBAICghFDEQECAQEBAQEBAWIohGkGJy8jEAs0BwsUGA2JJqxXPYtEAQEBBwIBJIsZhRSFFQWPfIpqmxqGOpIPNSF4Ew6DWx0YgWMgiS0BAQE X-IronPort-AV: E=Sophos;i="5.33,749,1477972800"; d="scan'208";a="292651036" Original-Received: from 45-72-235-254.cpe.teksavvy.com (HELO ceviche.home) ([45.72.235.254]) by smtp.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 11 Feb 2017 10:51:03 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 053D166206; Sat, 11 Feb 2017 10:51:03 -0500 (EST) In-Reply-To: <20170211144459.A837B2319A@vcs0.savannah.gnu.org> (Vibhav Pant's message of "Sat, 11 Feb 2017 09:44:59 -0500 (EST)") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212228 Archived-At: > + /* Hash tables for switch are declared with :size set to the > + exact number of cases. */ > + if (BYTE_CODE_SAFE) > + eassert (HASH_TABLE_SIZE (h) == h->count); Why should we force this constraint on the code that generates the hash-tables. I think this is wrong. We just need a comment that explains that we use h->count as a faster approximation of HASH_TABLE_SIZE(h) (and BTW, the comment belongs next to the relevant code which is not the `for` loop but the "if (h->count <= 5)" test) and that we hence leave it to the bytecompiler to ensure that this approximation is good enough. Stefan