From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Suppressing native compilation (short and long term) Date: Thu, 29 Sep 2022 12:01:45 +0300 Message-ID: <834jwqh7uu.fsf@gnu.org> References: <87ill8paw7.fsf@trouble.defaultvalue.org> <834jwrig5s.fsf@gnu.org> <83wn9ngvr6.fsf@gnu.org> <83r0zuhgfl.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17453"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rlb@defaultvalue.org, emacs-devel@gnu.org To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 29 11:05:50 2022 Return-path: Envelope-to: ged-emacs-devel@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 1odpUM-0004O1-5e for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Sep 2022 11:05:50 +0200 Original-Received: from localhost ([::1]:45588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odpUL-00020z-8i for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Sep 2022 05:05:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odpQW-0007rO-Cm for emacs-devel@gnu.org; Thu, 29 Sep 2022 05:01:56 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odpQU-0004NS-Tm; Thu, 29 Sep 2022 05:01:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=/B7baO9tG04H7jwzLiP+MrO4E/ooKZuikSsQdZboJ/Q=; b=hdeQrUIDyXyL NK2yNLpWIrZf3fMZYOZMzsuhKmKRyZqzagh1zg71OfbLSsXbUUrhi09m+EipjvLGXLF3xW4H9CaUZ NNPeLBk+OhWBPKMnlOd2mXkcvPzGVdn8M5+1VEHqsb5yyGLWwdjiALR3ebVfYozVc5nTELeAGON0N KNG90BSKp3/jCoMP+Pfxi/vfvp3uQYnu1tpsS6tJTEGkfZxf8SYGpwchlghaiWhJreWTXb5EjNG6O nMFQTAB9yphGqhTCNw7TC/h5mcH+BkBnwuZoq4Ubc7K/a5bGQOkBOtvnCwNJgjvCQUKdKI2xPcCCz PotATdMHuHlECZPt8gVeug==; Original-Received: from [87.69.77.57] (port=4128 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odpQT-000291-Mj; Thu, 29 Sep 2022 05:01:50 -0400 In-Reply-To: (message from Andrea Corallo on Thu, 29 Sep 2022 08:18:08 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296454 Archived-At: > From: Andrea Corallo > Cc: rlb@defaultvalue.org, emacs-devel@gnu.org > Date: Thu, 29 Sep 2022 08:18:08 +0000 > > >> >> Yes `native-comp-deferred-compilation' AFAIK does exactly this already, > >> >> `native-comp-available-p' is to check if the native compiler is > >> >> available (not necessarily the deferred/async mechanism). > >> > > >> > But then it should disable the trampolines as well, see startup.el. > >> > >> Not in my opinion, trampolines are not deferred async compilation. > >> > >> Also as mentioned ATM is not possible to disable trampolines and have a > >> fully working native comp Emacs (if we assume primitives can be > >> redefined). > > > > I'm confused. I alluded to this part of startup.el: > > > > (when (featurep 'native-compile) > > (unless (native-comp-available-p) > > ;; Disable deferred async compilation and trampoline synthesis > > ;; in this session. This is necessary if libgccjit is not > > ;; available on MS-Windows, but Emacs was built with > > ;; native-compilation support. > > (setq native-comp-deferred-compilation nil > > comp-enable-subr-trampolines nil)) > > > > The last part disables trampolines, AFAIU. So what am I missing here? > > Hi Eli, > > yes it does, what do you find confusing about this? > > This is how I see things, we have two compilation mechanisms: > > 1- Syncronous native compilation. This can be triggered: > 1.1- By the user (calling `native-compile'). > 1.2- By Emacs in the need of generating a trampoline. > > 2- Async/deferred/jit (or how we wanna call it), this is triggered > automatically when loafing a .elc with no corresponding .eln. > > We have two customize to control the two automatic mechanisms: > `comp-enable-subr-trampolines' gates 1.2, > `native-comp-deferred-compilation' gates 2. > > Indeed `native-comp-available-p' gates all native compilations. So I was asking whether when the user wants to disable native compilations, we should disable both 2 and 1.2. We already do that when Emacs detects at startup that it doesn't have access to libgccjit, so why not do the same when the user wants to disable native compilations for whatever reasons? You seem to be saying that 1.2 cannot be disabled in that case? But if so, how come we do disable it in startup.el? That is the root of my confusion. Thanks.