From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Re: [External] : Re: Question about native compilation (bug?) Date: Thu, 27 Jul 2023 14:38:07 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6148"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "emacs-devel@gnu.org" To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 27 21:12:29 2023 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 1qP6PU-0001P0-GS for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jul 2023 21:12:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP5sH-0000Zw-Th; Thu, 27 Jul 2023 14:38:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP5sG-0000Zo-II for emacs-devel@gnu.org; Thu, 27 Jul 2023 14:38:08 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP5sF-0002RS-Ri; Thu, 27 Jul 2023 14:38:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=k7u+httfrg9qKK+vumCiuZ88CyHPYzxkpkDUD1q3tp0=; b=V57dvGNZ3T+CGdLhEXaF e0uEo9SSvF1FwYfQB4eJxz/1pg26i42S+q7h/KEc/Ef3wJl01wcGzA0NekPcvMN9ZaCQL3cSuYcrh dEtj1yhn3qF+ZKQXY6W1WcPgcteYjOscTK5w2+jorbcmVFPfx8/8SbptVGKwQtVTfFW+tAAWmOtSt eLZI3iC1hT+3MOL40+j1U6JICq55wTNhyE0HlCIvaweiUy/iBOL1VOudnruhqNWDV9gFReuA2k3R5 iLAeJJ6q4wjX8weiEnEp71ykN66Z7mikXcqusq8UakRd3dVSTmSY7UAXKC4Tg2fGDlJxDcy0MxVvb EQShTJsF0IR/Qw==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1qP5sF-0005ju-IH; Thu, 27 Jul 2023 14:38:07 -0400 In-Reply-To: (Drew Adams's message of "Thu, 27 Jul 2023 18:14:15 +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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308171 Archived-At: Drew Adams writes: >> > What about my other questions, e.g. wrt fixing this? >> >> I haven't done any recent analysis, from what I remember it is not >> easily fixable. >> >> That said I think is not worth of, redefining primitives is already >> discouraged by the manual and dangerous (more on that later), doing it >> with a different signature it's just kamikaze behavior. >> >> Note also that redefining primitives in Emacs is not only disincouraged, >> but is really not guaranteed to work properly. The redefinition will >> not take effect executing bytecode if the primitive has a dedicated >> byteopcode and it will *not* take effect either for any call to the >> primiteve done form C itself. > > I don't claim to understand all of that, e.g. > primitives that do or don't have dedicated > byteopcodes etc. > > The fact is that it does work for `read-buffer', > except when native compilation is turned on. > Except, of course, for calls from C itself - > that's understandable (nothing new about that). > > The point is to have compatibility with what > happens with Lisp source code. As I said that is already broken in multiple ways. Try redefining + and you'll discover that: it works in interpreted code, it does not when executing bytecode, it does again from native code, it does not from C calls. Not only, the byte compiler assumes primitives are what they are and they are not redefined, so byte compiling code you might get spurious warnings or a miss-compiled output. You just touched the tip of an iceberg of something we don't support and we ask the user not to do. Andrea