From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: (unknown) Date: Wed, 30 Aug 2017 15:33:30 -0400 Message-ID: <874lsohmut.fsf@holos> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1504121628 6461 195.159.176.226 (30 Aug 2017 19:33:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2017 19:33:48 +0000 (UTC) Cc: Vibhav Pant To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 30 21:33:44 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 1dn8k8-0001H9-Dh for ged-emacs-devel@m.gmane.org; Wed, 30 Aug 2017 21:33:40 +0200 Original-Received: from localhost ([::1]:52356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8kF-00081o-7X for ged-emacs-devel@m.gmane.org; Wed, 30 Aug 2017 15:33:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8k7-00081j-Vh for emacs-devel@gnu.org; Wed, 30 Aug 2017 15:33:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn8k3-00057U-2u for emacs-devel@gnu.org; Wed, 30 Aug 2017 15:33:40 -0400 Original-Received: from mail-qt0-x22b.google.com ([2607:f8b0:400d:c0d::22b]:34613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dn8k2-00056x-Qc for emacs-devel@gnu.org; Wed, 30 Aug 2017 15:33:35 -0400 Original-Received: by mail-qt0-x22b.google.com with SMTP id u11so31601280qtu.1 for ; Wed, 30 Aug 2017 12:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version; bh=ifXy7HDbaozkhabFHp2N0TI3eq4W4F1IGBWS2ZptSx4=; b=tw6LGhj6lEf4UDKge6TEG6g1bCWtA/QDj9vyaWsc+klGU5TIDbAke6so6h7/wo0Za6 6XZi4U0twuEbp9VL0Pv6Tz6zQAzz+mNQKfxUTIWwnjbFmWcebm4iJ9OFWsvx9bAtLb7/ XqFBWPhPf874VJ1i6iS5XVeAZVHN3ane9bVmuJjDEOruCfKX4Gvye8V8UoXvpq5F9Y13 gp9RaHfBrXpNj0YMqrS9maKeltBXxyNM/F+5WeIlt4R3Tyeb6QL6Tf0o0V4QyEQYaf+V esygL/7JtNXcJJHhQS9f1OVTO0ERloVfOk7dZB0VK/Y9NvCRNmgCc1U5EVq6RVlSfkwy kT9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=ifXy7HDbaozkhabFHp2N0TI3eq4W4F1IGBWS2ZptSx4=; b=eCBmke51FXG+iYfJIJXmb9oJLuWI7rO93M1r37rPXX3yEjV3iWpreZd8hk+9escdY8 PZeXNX0+dsTzMENNQA3oudu73QW6AmKlypntZkXgh8g1wsQM9AqHLq+O22nZcry0b//b IvEQzwAw0Ka89DOdS11KXSD9s6s3i4kQYto1X/Ij4PTljBOHZx0gRnFsSXMjTeJOoIzp Z4dgn/yrS3hDASruFq9jvUcU8SkJ6+sF57+AD1YNF6O5YxZ9UF3geZG5wX1d/rBWOX+K On7Sw7tBiX8P0/5vxwp4EQjE+rFOwlhkqEyMI5NK4d5pyXF7RfaEkiYkOJ3FxJi5VrCO q1lQ== X-Gm-Message-State: AHPjjUgbFbNCqwmARptkK5pNjt9AgObaVvUvoqY926OBXkaD+FWJMwsp cRJG6VKrNGeGgO8V X-Received: by 10.200.46.68 with SMTP id s4mr3619605qta.161.1504121612140; Wed, 30 Aug 2017 12:33:32 -0700 (PDT) Original-Received: from holos.localdomain (pool-173-64-88-95.bltmmd.fios.verizon.net. [173.64.88.95]) by smtp.gmail.com with ESMTPSA id k81sm4590826qkk.39.2017.08.30.12.33.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Aug 2017 12:33:31 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id A2DC669C52; Wed, 30 Aug 2017 15:33:30 -0400 (EDT) Original-Subject: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::22b 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:217892 Archived-At: Hi, I wrote the following to get rid of the 'apply' here. The expansion is something that, according to how byte-switch is described, should compile to a switch/jumptable, but it isn't happening. Applying the following, doing M-x byte-compile-file, and inspecting the .elc/disassembly I am seeing a series of goto-if-nil. Am I doing something wrong? diff --git a/lisp/json.el b/lisp/json.el index 64486258cc..6990ddd0f5 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -683,6 +683,23 @@ json-readtable table) "Readtable for JSON reader.") +(defmacro json-readtable-dispatch (char) + "Dispatch reader function for CHAR." + (declare (debug (symbolp))) + (let ((table + '((?t json-read-keyword "true") + (?f json-read-keyword "false") + (?n json-read-keyword "null") + (?{ json-read-object) + (?\[ json-read-array) + (?\" json-read-string))) + res) + (dolist (c '(?- ?+ ?. ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)) + (push (list c 'json-read-number) table)) + (pcase-dolist (`(,c . ,rest) table) + (push `((= ,char ,c) (,@rest)) res)) + `(cond ,@res (t (signal 'json-readtable-error ,char))))) + (defun json-read () "Parse and return the JSON object following point. Advances point just past JSON object." @@ -690,10 +707,7 @@ json-read (let ((char (json-peek))) (if (zerop char) (signal 'json-end-of-file nil) - (let ((record (cdr (assq char json-readtable)))) - (if (functionp (car record)) - (apply (car record) (cdr record)) - (signal 'json-readtable-error record)))))) + (json-readtable-dispatch char)))) ;; Syntactic sugar for the reader