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: [Emacs-diffs] feature/byte-switch 086c4ea: * src/bytecode.c: (exec_byte_code) Use hash_lookup for Bswitch Date: Thu, 19 Jan 2017 17:46:16 +0530 Message-ID: References: <20170118171311.10996.72260@vcs.savannah.gnu.org> <20170118171311.A84EA220125@vcs.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1484828200 32126 195.159.176.226 (19 Jan 2017 12:16:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2017 12:16:40 +0000 (UTC) Cc: "emacs-devel@gnu.org" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 19 13:16:33 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 1cUBdi-00077h-SL for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2017 13:16:27 +0100 Original-Received: from localhost ([::1]:47401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUBdn-0002ef-IV for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2017 07:16:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUBdg-0002eL-G6 for emacs-devel@gnu.org; Thu, 19 Jan 2017 07:16:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUBdf-0004qT-JT for emacs-devel@gnu.org; Thu, 19 Jan 2017 07:16:24 -0500 Original-Received: from mail-yw0-x231.google.com ([2607:f8b0:4002:c05::231]:32790) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUBdf-0004q7-Es for emacs-devel@gnu.org; Thu, 19 Jan 2017 07:16:23 -0500 Original-Received: by mail-yw0-x231.google.com with SMTP id l75so30165082ywb.0 for ; Thu, 19 Jan 2017 04:16:23 -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=9G/Y7npwHl2uyTftefPAjTWcL+JtWNV1wmxhoUb1rUk=; b=QZVGd+Ja0D8gkEVVARZjgUo7CVN+fFXTJjAe87HGgkqIjkLvZBuibDiYqKNsUbqqig 0xQYMnS9VLWjosTGRyQ7IHoTaMf87t/LA8Byw5Pl583wYjVCs+M0/auhAFJ6MiNRydVi tGna38GUV1UVzKFtuO6ZB+8xsnLCKUXaEiZuT0gb77RLuJ9opdGjN1Fijboc1hr6VxVS X9lK3n7L7qM1pjQpsJeUUoasWZuUkHQKJzoiLypGl5CUZpNwxvrziOEQlnvWRUom8nQu S++rhTGBb3UC1Lt1roPjAFXeBuUUWBuk4lUqGcI/GfzLemtR8WqhCFri3+Qmim8mnxqu /kAQ== 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=9G/Y7npwHl2uyTftefPAjTWcL+JtWNV1wmxhoUb1rUk=; b=lKjaoom5LFnQ1vYdhgEtXP/X1Rx7IJWKxlQfWgbbLivJBCEr98zzf9gWx+otnEzapD 7tHfRVVF+QY5Oa8CCPgRPsu1RUYF2BkpXy5aB61wLpR8DO4Ixp7dDOLTkNkGr0s4eLY7 i+fEVEQal8qSrVC/F+zRZNOef53WU09CeX34I6MUjoxNkvLXuPLJ/OzUX6SDiy4+dekO HKMWW4PSe0XDQ9wRKICPJfIAHSjZouVkIPPSSVf1JWcRyqqCqwiCVB8yZqlzBmTeMWYY JRqzWdO3BByjbVpONaFWOr5IJwHxhoo/e2BcLE5dVbzU9v0KQOyDjCuvBJ8luhYxMEcD GMsQ== X-Gm-Message-State: AIkVDXLkth2qW/xzcr49EPGDtXD575F67jI6GNPVKdRc+LtciyyCWE9Uy7ys5G4Yxz+6jUPCeNeBxRMXTkL6cA== X-Received: by 10.13.243.68 with SMTP id c65mr6327787ywf.137.1484828182851; Thu, 19 Jan 2017 04:16:22 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Thu, 19 Jan 2017 04:16:16 -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::231 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:211401 Archived-At: On another thought, `byte-switch` is used while compiling certain `cond` forms. It replaces the traditional goto-if-nil bytecode by using a hash table mapping values to addresses/tags to be jumped to. Since `byte-switch` is essentially a "dynamic" goto (in the sense that the address/tag cannot be known at compile time), wouldn't doing a runtime type check in the bytecode VM for what is a hash table lookup + goto have a significant performance penalty? On Wed, Jan 18, 2017 at 11:18 PM, Stefan Monnier wrote: >> * src/bytecode.c: (exec_byte_code) Use hash_lookup for Bswitch >> Fgethash type checks the provided table object, which is unnecessary >> for compiled bytecode. > > While it's true that we can cause a core dump of Emacs if we feed it an > invalid .elc file, that's a "feature" I'd rather shrink rather > than generalize. > > > Stefan -- Vibhav Pant vibhavp@gmail.com