From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Bug#38708: eq vs eql in byte-compiled code Date: Tue, 31 Dec 2019 15:07:11 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="212492"; mail-complaints-to="usenet@blaine.gmane.org" Cc: mattiase@acm.org, eliz@gnu.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 31 16:07:59 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1imJ7n-000t77-C4 for ged-emacs-devel@m.gmane.org; Tue, 31 Dec 2019 16:07:59 +0100 Original-Received: from localhost ([::1]:43446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imJ7l-0001QR-H6 for ged-emacs-devel@m.gmane.org; Tue, 31 Dec 2019 10:07:57 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56996) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imJ7e-0001Q9-Mx for emacs-devel@gnu.org; Tue, 31 Dec 2019 10:07:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imJ7d-000149-DS for emacs-devel@gnu.org; Tue, 31 Dec 2019 10:07:50 -0500 Original-Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]:44738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1imJ7d-0000yc-6H; Tue, 31 Dec 2019 10:07:49 -0500 Original-Received: by mail-oi1-x241.google.com with SMTP id d62so11846402oia.11; Tue, 31 Dec 2019 07:07:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=9dQz9eLcKi580lSXfAOg4V1Csdc6W+5XXwNRv4lYh3s=; b=V80cChlvTTxaBBstKvhbKJZY1v1gurOAAnXM/0i/Q8iY06NDd7AnbTpJhtQ4geqC7Y c7ADW/rHeyKs0jbAswM32EU02kfdshbvSQ1FvDBvmItW7k9ybHmuHgXFY6bNVEizRIaF zK+CaT9AZ7cI7lEW0OdDvpq5UU0Z9ImBZX6Pg/Q+OYoI9u6KnYhXVjHKRyx1oMRzNIw4 0jgWdpSZOhatxhga3pkdknbLiIM/8DsQLAy52cdIKtAND0xZ6PmPy1cynQ3/onXIBXnM a+vvBVUccp/5HcI6OWa0ick8d4eq+3uqRRI2uAACEFOszOkyPXNZY5wEWKhwy0qGY+1k 3UAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=9dQz9eLcKi580lSXfAOg4V1Csdc6W+5XXwNRv4lYh3s=; b=dTU7jBh4FtX2YI6UFK9vAfQSSpagufyk8TbBaRZO9+dotnU6RkipkHeXgPbiwSjfwe jifRR/HyLnBTpaahwpQSZCdb0P8GZNGjB9MTyzFavpmKaBlemYtGUGeqKW45RC+fSyKu /jdsS/4Kz2VkeQIbkrCgkoUl3XAx7WF4Gz8/2vIIAVxoLyZoY226uUw9QKIDVEmY2QY4 qBvu8IY+Tu3SaxX5FaL2bKnTIDaS/V0TljLoqQYCVcdUliHGFM8bYMek0iJ947zRIJgO fcNnQ98fCC/GgXvG3MXk/jEO922LkZdmQ5PrIKGLpou7je14OmBeV3/v/oHrIxaEbtjn sAbg== X-Gm-Message-State: APjAAAWUnkDFt/tc2sR4OAEExf4jFuXEXN3aVTacEEOmJWsrgM4qsG64 JMdSn4smizwNILLXD7j3+eQc0RhwPb0QkmWV6038AEDHWAQ= X-Google-Smtp-Source: APXvYqx3IdbBJCjTLld19wtJd1D6vQJD4nhXFiza0Yxi/haFkEG3Xx8b4SBj+dAU2/YCBwG5zTwbrBzonJfo4EAPrVU= X-Received: by 2002:a05:6808:208:: with SMTP id l8mr770020oie.112.1577804867836; Tue, 31 Dec 2019 07:07:47 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::241 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:243808 Archived-At: Bug#38708 (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38708) concerned a recent change to deduplicate floating point and bignum constants in the bytecode constants vector (when compiling with or without optimization). There was some discussion on the bugs list, which I'll attempt to summarize here: The previous behavior was that if (defun f () (format "%S %S" 1.0 1.0)) was compiled, the result would have a constant vector with two separate, distinguishable entries for 1.0. The new behavior is that if the same function is compiled, a single constant is generated and referenced twice. My initial objection to the patch, and the reason I would prefer not to see it installed on the Emacs 27 branch, is that the apparent behavior of eq will change in ways that seem paradoxical at first. For example, this code will produce t: (defun my-eq (a b) (eq a b)) (defun f () (xor (eq 1.0 1.0) (my-eq 1.0 1.0))) (byte-compile 'f) (f) The reason for this is that (eq 1.0 1.0) is optimized to nil before the constants are deduplicated, but other function calls use the deduplicated values. All this is related to, but not the same as, the debate over whether eq and eql should be equivalent or not. Making them equivalent would avoid such apparently paradoxical behavior once and for all, but it would probably incur a significant runtime cost. Another option might be to deduplicate constants before optimizing forms such as (eq 1.0 1.0). That would be more work, but would also avoid the problem. Any thoughts?