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: Mon, 13 Feb 2017 12:48:46 +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 1486970386 9812 195.159.176.226 (13 Feb 2017 07:19:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Feb 2017 07:19:46 +0000 (UTC) Cc: "emacs-devel@gnu.org" To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 13 08:19:41 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 1cdAvD-00024a-0f for ged-emacs-devel@m.gmane.org; Mon, 13 Feb 2017 08:19:39 +0100 Original-Received: from localhost ([::1]:54908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdAvI-0007p0-Jh for ged-emacs-devel@m.gmane.org; Mon, 13 Feb 2017 02:19:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdAul-0007or-0S for emacs-devel@gnu.org; Mon, 13 Feb 2017 02:19:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdAuj-00021q-OF for emacs-devel@gnu.org; Mon, 13 Feb 2017 02:19:10 -0500 Original-Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:33307) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdAuj-00021f-J8 for emacs-devel@gnu.org; Mon, 13 Feb 2017 02:19:09 -0500 Original-Received: by mail-yw0-x242.google.com with SMTP id u68so6655608ywg.0 for ; Sun, 12 Feb 2017 23:19:07 -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=wDTxr/YuorRKqMei4nUmsxRuGvYS6NxJpiNztbhSCM8=; b=fYusavcYi1fjyNfe5K72SEvZchcvmV7sbd4PZ3FcFo0teW+fd/mrkcCJTGA3A3p0TY hAYYr6ftn+yKiqqKl11R5pjP2VnTrr1um5qp91twxL53QYI+8e6a9EFNlehRyDtif4gc 1GcEp9y4YSokFyYWVzH5lZrLuTPrhBXWiXnqrByfN+D30PzC5tFSPMukTxJkrtE2ZBBA sfSuBmTQwFFkvWTIwB46KGhQIqT4FGj5sIdHe4nh82U8XCjkqjV5OOIKDNUKHeUB6pGB yCzCT4D7vBe2133qK21oq+BkYplZNF4uDFnRDsMm9Q/vQll6MrrDcWlKeRYDSdsXnI8Y XdtA== 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=wDTxr/YuorRKqMei4nUmsxRuGvYS6NxJpiNztbhSCM8=; b=NZgMvCRM72lJ7ZHuwdGwkztzy4bM5aL38jj4Mva1HIpRl4MB2SygFY2H5fgNYxxric iPr6wcCsyetPxRcfxbkx9JkOiv0zayDAn7W/E9j7XBBoMAc2j9YFaHzefL+6urahHZGY V8Sw8V/AfBoRX7vcB5OaShiHwC1LPDmd46gyL2BJ+wG+QSnUYnL20c19Zz+DDe7qKjod BGQQJHWJqXoGfyz61F7gmTN2mN4C8dxF4LmolahRZxr1svo/1O7uLLFjdCfmtAK11Fwz hBjmAmXX/bQyVw9/Oick96ATZVxpKRfQ3d5R/KJElxZWagbwaTownFtU7SrFUREAp8lG VcEw== X-Gm-Message-State: AMke39mO7PLFjAyJv/LQdqtOG5I4u7gYBw4KnPGE2OmZJZ7NFgtsxIXdju5trwZ6/5gpsOt87PzMMSg25aJv/w== X-Received: by 10.129.85.211 with SMTP id j202mr15137789ywb.287.1486970347266; Sun, 12 Feb 2017 23:19:07 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Sun, 12 Feb 2017 23:18:46 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 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:212325 Archived-At: I'll push this to master after adding a few more tests for byte-switch to test/lisp/emacs-lisp/bytecode-tests.el On Sun, Feb 12, 2017 at 8:40 AM, Vibhav Pant wrote: > Is there anything else to be done? > > On Sat, Feb 11, 2017 at 8:37 PM, Vibhav Pant wrote: >> 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 > > > > -- > Vibhav Pant > vibhavp@gmail.com -- Vibhav Pant vibhavp@gmail.com