From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.diffs,gmane.emacs.devel Subject: Re: master 9227864: Further fix for aborts due to GC losing pseudovectors Date: Tue, 26 May 2020 08:02:27 +0000 Message-ID: References: <20200526060645.22243.34109@vcs0.savannah.gnu.org> <20200526060646.662E120A2C@vcs0.savannah.gnu.org> <26b54430-b654-3e13-8e3c-2f4482af60e1@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="86929"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-diffs@gnu.org, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-diffs-bounces+gnu-emacs-diffs=m.gmane-mx.org@gnu.org Tue May 26 10:04:35 2020 Return-path: Envelope-to: gnu-emacs-diffs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jdUZf-000MUv-FJ for gnu-emacs-diffs@m.gmane-mx.org; Tue, 26 May 2020 10:04:35 +0200 Original-Received: from localhost ([::1]:33908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdUZe-0008UR-EU for gnu-emacs-diffs@m.gmane-mx.org; Tue, 26 May 2020 04:04:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdUYF-000672-5b; Tue, 26 May 2020 04:03:07 -0400 Original-Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]:36800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jdUYD-00044e-Ts; Tue, 26 May 2020 04:03:06 -0400 Original-Received: by mail-oi1-x22b.google.com with SMTP id x23so17935783oic.3; Tue, 26 May 2020 01:03:05 -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=Ij8I1akCWrRMZWbJPEDqG1KCKaO4BhpwkAzD8RQnsII=; b=RzD8hROYwu6zPlmxy5KOPhFmS1yDbxuSrIpNZr8MWLuKEpD38eyUFvTzSLz0aNikyU uFjFRHDGzGn/csYNpHPGeWMSi7szQgAl8BZROAURNudQVp8f4XXWNDNukRpaPtSiQXSH ar07lFHLZVueKSoRwtM0QXuH/y56ctni8GCfs1dEKzVJkSxicQbk5UteHBdSgps7z4Dm 6gRGPM00Sh1fTOngiPVSWCaUmPtARNQKCKECUR7tZlNH56G//3oUJ1MtPDLyedUZ/Vsw L6KwJu58x6aF0Rg+ldm2+2Ce2f5YkwHbcoDSU5FETmo7hPh6I9sdoIzl+fSqdYJFsQeD 6YqQ== 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=Ij8I1akCWrRMZWbJPEDqG1KCKaO4BhpwkAzD8RQnsII=; b=c+evBVZe2NA4JvTNkf5CxEldoayxCJywMD0UbVnkDjAFr9ou4Wb5OaqrhwMzdwoSs4 DX/9Lpqygrkav6S6uOCo9xMgGCf6OBMR9S+9ZR1Q5mzA4KsDnvCd3SeaN4BjaCBgJqep b4EMxTPtA6b8hZQXMqRtz4DZhahLiIfmyvPWAgWJKWd5wUlAsmHQWtcZlV5idwDB3Uyn kY3j0QZHvS/ybOcdQ60vvwr7q1Jm3C4itNSRa4aBRBiiyRuPkrr+rWEWaxl5JM2X19UE 0Hhr2wrMvRdxNiqRzHf2yw3hyqhI3bNv2twTZkLyW7tGGl8YQq7nj8BY3LmidLg39ijX B53Q== X-Gm-Message-State: AOAM530WBczLGFQpE5huAhx6oZOFa2GHpMitv3K9EhrCP8nMy3D3mNRr IJFKsEMc25cn4U0G6OhegPfLCSA/NBuwzByzuEk= X-Google-Smtp-Source: ABdhPJzLgENuzL4cMk1Ln9RRUUCYjdbTN+lcDg9OTzAUEY7lh4IgAYKhRhYGfv+P0GAM02Kzne3TDK00/PD5jasWr+o= X-Received: by 2002:aca:b708:: with SMTP id h8mr11745696oif.122.1590480184093; Tue, 26 May 2020 01:03:04 -0700 (PDT) In-Reply-To: <26b54430-b654-3e13-8e3c-2f4482af60e1@cs.ucla.edu> Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=pipcet@gmail.com; helo=mail-oi1-x22b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-diffs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for Emacs changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-diffs-bounces+gnu-emacs-diffs=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-diffs" Xref: news.gmane.io gmane.emacs.diffs:156313 gmane.emacs.devel:251438 Archived-At: On Tue, May 26, 2020 at 7:40 AM Paul Eggert wrote: > On 5/26/20 12:25 AM, Pip Cet wrote: > > roundup_size still uses LISP_ALIGNMENT here, so I don't see how that's > > true. > > Oh, you're right. No harm so far since LISP_ALIGNMENT is 8 on current platforms. > But this area could use some thinking if we want more efficiency on platforms > where it's 16 (so far, I've been worried only about avoiding crashes on such > machines). Absolutely. I like the idea of an allocate_aligned_pseudovector API, though it should be stubbed out (using eassert_reachable, or _Static_assert) for now. > >>> I think a simple eassert (GCALIGNMENT % alignof (type) == 0) in an > >>> (inlined, obviously) version of allocate_pseudovector should suffice > >>> to catch this hypothetical problem. > >> > >> I assume you meant 'verify' rather than 'eassert'? That'd catch the bug at > >> compile time. > > > > I don't see how that would be possible using inline functions? > > We should use macros, as they'll catch this at compile-time. Okay. > (I don't know how to do an eassert_reachable.) Something like extern int __unreachable_function (int); #define eassert(cond) \ ({ \ if (__builtin_constant_p ((cond) && __unreachable_function((cond) != 0))) \ { \ *(int *)0 = 0; \ __unreachable_function (0); \ } \ eassert_1 (cond); \ }) This provides a compile-time warning (easily upgraded to an error with the right -Werror switch), a link-time error, and a run-time assertion. It's not pretty, but it gets the job done. FWIW, with this (invalid) version of eassert, the following correct, but weird, code generates a link-time error: case Lisp_Int: eassert ("should not be dumping int: is self-representing" && 0); abort (); But, at -O2/-O3, on x86_64-pc-linux-gnu, no other places in the build appear to be using eassert (0). > We're already using macros for ALLOCATE_PSEUDOVECTOR and the like, so this should not be a big deal. I'm finding it hard to do so, but I'm not used to working with _Static_assert and will try again.