From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches Date: Wed, 22 Aug 2018 15:50:45 +0000 Message-ID: References: <20180821204437.16880.99611@vcs0.savannah.gnu.org> <20180821204439.62390209A6@vcs0.savannah.gnu.org> <53d0c06e-2383-955a-0a17-650fd842b483@cornell.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1534953076 3979 195.159.176.226 (22 Aug 2018 15:51:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 22 Aug 2018 15:51:16 +0000 (UTC) Cc: kbrown@cornell.edu, emacs-devel@gnu.org To: eggert@cs.ucla.edu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 22 17:51:12 2018 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 1fsVPb-0000qV-S2 for ged-emacs-devel@m.gmane.org; Wed, 22 Aug 2018 17:51:11 +0200 Original-Received: from localhost ([::1]:59601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsVRg-0001WH-Io for ged-emacs-devel@m.gmane.org; Wed, 22 Aug 2018 11:53:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsVRQ-0001Tk-IF for emacs-devel@gnu.org; Wed, 22 Aug 2018 11:53:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsVPp-0006qM-38 for emacs-devel@gnu.org; Wed, 22 Aug 2018 11:51:26 -0400 Original-Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:43500) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsVPo-0006pI-QL for emacs-devel@gnu.org; Wed, 22 Aug 2018 11:51:25 -0400 Original-Received: by mail-lf1-x141.google.com with SMTP id h64-v6so246551lfi.10 for ; Wed, 22 Aug 2018 08:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dPt6yTkkir131G8sDN/nSDZLb3MtG6Fqrs4pvCCy1rc=; b=Dcp6EnoISigPZwUYGd916OeKpXcTh8Skg7y13GfTo5y9F3N8G1du34A2Ejgk+tDODb sgQLOmBzZSebJaxtNWGYBevUUumb9AMcFrELtfi+LaqQjLY+T0WZV69rbE34J6aQLDXn nF/VZ5CRiLSGcvcyiocStvHil5k38RELd2vujHSPXoS5nNTFQMHjruL68w5NVIMZrozS oPpqxKhVl4qqA/IUo+2tRyqN4pj2BhUjtc2Wo1rpcrPvaP987dmSPF8s4bkqU59tmpzL 8DgiTXHmQNLb4iddOAobTUrlH4WacSjtjqgkn60PkmTauDkFbf6siFbET+Hr2dOjULyI 7AXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dPt6yTkkir131G8sDN/nSDZLb3MtG6Fqrs4pvCCy1rc=; b=AyF5RV1MAePYrfLUe2c50UlF5BLnb94WZ5kDGxxEfDBxFkqHhogtkS9WUUJ6OwOiaM gKr7E4SQmNiNiWl6V7iwCya33FngK2ug3PaAt2RcmjLqvAP38ghUgeq0f/Tf3bsZDOzU myuh90HgjL7yuiFza3or7yDsIFOLCuSc/LAESiNoeU6wjCbmOg/2JrRwkdMdA69nDBwk oAR8cHerZpkPq7WO7symNMYFdxkK6OOWVc/7ONhjA12tYv8vyHFMBXPAjLO5mvQIYkyn 2udPpx89ANy3NGH7SVTcYr33zSCAp1nk9Q71bFNmRay7OlIGre+X9+vuWO+RHHYtUc8l Jk5w== X-Gm-Message-State: APzg51C6xBuTIUqyGsPAAaeNiuOA/OIDgdxrSftkjkkUlPn8WA/97U7P oCyg77XBfOOPE40RFrsmGAF04J6ZsA9dDM8MvJc= X-Google-Smtp-Source: ANB0Vda1pjz8XER/n+vSvRx8ZE26HW5fu48WuoDVseo5gLolJGIj4TmIioK1pXgF1jkermxCKOYBTv1VI6+H5eSRi4c= X-Received: by 2002:a19:6388:: with SMTP id v8-v6mr3204685lfi.95.1534953083400; Wed, 22 Aug 2018 08:51:23 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::141 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:228817 Archived-At: On Wed, Aug 22, 2018 at 1:44 PM Paul Eggert wrote: > True, but even bignums should be faster than the slow function, so the code > really shouldn't be worrying about integer width. Fixing this, though, will be a > bit trickier than simply removing the width check, as I expect the code uses eq > on integers. Until that assumption is fixed (or until we start hashing bignums) > the integer width check still makes sense. Maybe we ought to warn (in debug builds) about eq being used to compare several integers, at least one of which is outside a narrow interval of guaranteed fixnums (and ditto for memq and hashtest_eq). I wonder whether Emacs would even build with MOST_POSITIVE_FIXNUM = 0x100000, but it might be worth it to try and run it that way... That said, vc-hg.el doesn't contain any suspicious-looking instances of `eq', `memq', or `hash'; I think all the author was worried about was reading an u32 into an Emacs integer, which now works. Again, I'm not suggesting to remove `most-positive-fixnum', just not to use it in this particular file. It's "dangerous", but so are many useful Emacs functions (the worst of which is probably kill-emacs, which can lead to a user using a different editor, but minor catastrophes such as segfaults or data loss are also possible). As for `eq' and `eql', what I thought Stefan proposed was to keep a hash value in struct Lisp_Bignum, which is calculated lazily the first time the bignum is compared to another bignum with `eq', at which point we might as well point out to the user that portable code would require `eql'. That sounds to me like it would be much cheaper than a hash table, but if there are objections to it we can still implement it without guaranteeing it for the future in the documentation.