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: Introducing 'safety' compilation parameter Date: Fri, 10 May 2024 03:58:00 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8286"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca, mattias.engdegard@gmail.com, stefankangas@gmail.com To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 10 09:59:40 2024 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 1s5LAJ-0001xJ-Jm for ged-emacs-devel@m.gmane-mx.org; Fri, 10 May 2024 09:59:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5L9L-0002o8-78; Fri, 10 May 2024 03:58:39 -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 1s5L9D-0002Zg-BE for emacs-devel@gnu.org; Fri, 10 May 2024 03:58:32 -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 1s5L9C-0005lA-8N; Fri, 10 May 2024 03:58:30 -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=pvLkfTqmjdlE7YopSmbjtzem8dY9EbRy87AHNk7wImw=; b=GMvZdAPwWSluznF8UF03 BMKRrKo/us+BfuEW0rSEkCOk2UHzBsgexPljJTOOj/xpE7z0emKwHEQ6cLgjJxYjHYI0zP+zR4hfE Azbi4AzgEL6deGp5yQnwM62Y0+Rnj/UDl7y87NXNRzyyU1l/0AvtSClwc/KECrTXOaaKdtZR3mt7D 0TohWn0bRevMPnYnmj6VEuoVnPodXOce/FJy9I7zIrJwG3vjgTsvdg+7BPXR02qpd3HS/13YqtsLg /tJUCshyr/helOuYkdffNDRYNWtcIO8CcpPEeuRAHi7FwWm5kBwOr582VzmiZG9jporp0eBgbgpAD s09Dh0GHNemv9g==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1s5L8i-0003a4-Mu; Fri, 10 May 2024 03:58:11 -0400 In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llman?= =?utf-8?Q?n=22's?= message of "Thu, 09 May 2024 11:19:04 +0200") 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:319116 Archived-At: Gerd M=C3=B6llmann writes: > Andrea Corallo writes: > >> I've put in scratch/comp-safety a branch wich introduces 'safety' as >> compilation parameter. >> >> 'safety' can be used similarly to 'native-comp-speed' both as a global >> variable to influence compilation both as a function declaration. >> >> 'safety' justification of existence is ATM being able to control the >> undefined behaviour being created when function type declaration added >> by the user is not correct. >> >> ATM we can have two values: >> >> 1 Emitted code is generated in a safe matter even if function types are >> miss-declared. >> 0 Emitted code can misbehave or crash Emacs if function declarations are >> not correct and the function is native compiled (@pxref{Native >> Compilation}). >> >> 1 is ATM the default. >> >> I didn't want to give safety a prefix (byte- or comp-) as I believe we >> should extend safety in the future with a value to have the byte >> compiler generates runtime type checks to verify the declred types. >> OTOH this is creating a warning for a missing prefix, not sure what's >> the best way to fix this (give it a prefix or silence the compiler if >> possible). >> >> Also I added some doc for the declaration, but didn't kwnow where in the >> manual the documention for the variable should go as now it has effect >> only for the native compiler. Should I document it under >> "Native-Compilation Variables" for now? > > Hi Andrea, > > I don't know if something like this has been discussed before... CMUCL > and SBCL treat declarations differently depending on the speed settings. > If speed is below some threshold, declarations work like assertions, > with high speed settings declarations are treated as promises. I though looking at [1] only 'safety' was involved in declarations working like assertions. After your hint I see now SBCL does that when: (or (>=3Dsafety 2) (>=3D safety speed 1)) [2] That's complex/confusing =F0=9F=A4=AF! I think would be better to control = that only with 'safety' no? Thanks Andrea [1] [2]