From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Vibhav Pant Newsgroups: gmane.emacs.devel Subject: Re: [PATCH]: Add new bytecode op `switch' for implementing branch tables. Date: Sat, 11 Feb 2017 20:37:15 +0530 Message-ID: References: <1b07c68a-873e-83c8-246d-423bc83a3881@gmail.com> <712df469-190d-aeab-e239-1f225be3333f@gmail.com> <25a6003d-1d9b-381f-29b0-aece30af1def@gmail.com> <87379c26-6116-a45d-8205-b9d00e8b6c90@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1486825944 31299 195.159.176.226 (11 Feb 2017 15:12:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Feb 2017 15:12:24 +0000 (UTC) Cc: "emacs-devel@gnu.org" To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 11 16:12:17 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 1ccZLU-0007Zz-Hi for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 16:12:17 +0100 Original-Received: from localhost ([::1]:48647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccZLY-0004ou-IJ for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 10:12:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccZGz-0000Ay-Uh for emacs-devel@gnu.org; Sat, 11 Feb 2017 10:07:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccZGy-00073a-MN for emacs-devel@gnu.org; Sat, 11 Feb 2017 10:07:37 -0500 Original-Received: from mail-yw0-x241.google.com ([2607:f8b0:4002:c05::241]:35526) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccZGy-00073U-H0 for emacs-devel@gnu.org; Sat, 11 Feb 2017 10:07:36 -0500 Original-Received: by mail-yw0-x241.google.com with SMTP id l16so4368715ywb.2 for ; Sat, 11 Feb 2017 07:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kOVozaPtx4jiBCo/2RhiHFM7eoApeoEg/5JSpA/AIDU=; b=bankg6sRKkS2cu/oMIWWs+ULeRz3ekg/4u2VMnUTKjPmhhiO2Rr8AYB9UyjBSlFE8o 7of2Pn2kHfoOjN+OafxW5s7FQ9y/FYhdLBwQuWc6qce8E/jcGrA/QK4uVrPfT/ggAE67 z2XiBZBs0e9+1IiV8JC3QyzIDz0KiJGdxnWN8FUvpolJJq7dAN9mT8jpZJyXq2I6iRdM vL5IOlH2UzmSN4O4Z1wqO1XEIn+jzp3MKjV61nur2b1BqqwpwHpmBc1eDIt3fKUNwB/j EkFqgmsZG3g4eWtKyYgRvW/WJuvKEHYSQnBluaOGUx0Wb6na881dXdFdxwwESTrZp+om oJsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kOVozaPtx4jiBCo/2RhiHFM7eoApeoEg/5JSpA/AIDU=; b=hpu3jC6zFk0GZ7hqjdeB2ZyUFLSsLSlVQ5z8SZTnXDcldvis9jVBkMrZ0yV5MHrOT0 Dsht5OVnLAPkSnzYcPKTJfV0tWQkUvOwVuEt431NYtuVYR/yQJzWH2eHvCQqK/jgkMYn B7fO7nDQOCevdlPCbAq6oN4Af3vkexBqhE1bhriN3eyfOHHu3oOIb93XUFyVahLdHrh+ mJWKQTay8Vnhm1TS3S6ZuI7ZmDZQXCnNt2tJ7kravtczJBjkT9zav0crzzCZscad2Dck rL/1EqlOKTtNJn8FS03YLI1DO2DcZzPX0pg8WQhc/B2GXt4/UWxJPMim/M5J6Poura9P Frsg== X-Gm-Message-State: AMke39nLQaWh5PBgy/BRURHqlrwRL18eSPsdFhtUtA8mo+gGe07tw8i1A+Nty1M6TufDvBXcZekISO1MpDl9gA== X-Received: by 10.13.224.4 with SMTP id j4mr11286002ywe.139.1486825655767; Sat, 11 Feb 2017 07:07:35 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Sat, 11 Feb 2017 07:07:15 -0800 (PST) In-Reply-To: <87379c26-6116-a45d-8205-b9d00e8b6c90@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::241 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:212226 Archived-At: On Sat, Feb 11, 2017 at 2:17 AM, Paul Eggert wrote: > On 02/10/2017 10:25 AM, Vibhav Pant wrote: >> >> Are there any other issues before I merge this into master? > > > For the C code, please use the usual style: space before paren in calls, GNU > style indenting for curly braces, "/* " at start of comments, main operator > like "||" at start of next line rather than at end of previous line. > > One of the 'if's is overparenthesized, i.e., "if ((E))" where E is an > ordinary expression and "if (E)" will do. > > Prefer "if (BYTE_CODE_SAFE)" to "#ifdef BYTE_CODE_SAFE", as these days it's > better to avoid the preprocessor when it's easy. > > This comment: > > /* Hash tables for switch are declared with :size set to > the > exact number of cases, thus > HASH_TABLE_SIZE (h) == h->count. */ > > is something that could be checked, no? Perhaps replace the comment with "if > (BYTE_CODE_SAFE) eassert (HASH_TABLE_SIZE (h) == h->count);" and do the > latter even with large hash tables? Done. > > If you change the loop from "for (i = 0; i < h->count; i++)" to "for (i = > h->count; 0 <= --i; )", then you can merge the two copies of "op = XINT > (HASH_VALUE (h, i)); goto ob_branch;" into one copy that is after the > surrounding "if". > Done, thanks. -- Vibhav Pant vibhavp@gmail.com