From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: emacs-module.c, eassert, and nonnull args Date: Mon, 12 Jun 2017 14:34:50 +0000 Message-ID: References: <5a128432-e087-ad45-a15c-c2b0ebb8f28d@cs.ucla.edu> <83inkaa1pc.fsf@gnu.org> <63164307-2ba1-a827-665f-ec130c62bcaa@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113cdf4250381e0551c439cc" X-Trace: blaine.gmane.org 1497278148 32752 195.159.176.226 (12 Jun 2017 14:35:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Jun 2017 14:35:48 +0000 (UTC) Cc: phst@google.com, emacs-devel@gnu.org To: Paul Eggert , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 12 16:35:42 2017 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 1dKQRR-0008D4-SW for ged-emacs-devel@m.gmane.org; Mon, 12 Jun 2017 16:35:42 +0200 Original-Received: from localhost ([::1]:38445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKQRX-0001xu-7P for ged-emacs-devel@m.gmane.org; Mon, 12 Jun 2017 10:35:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKQQt-0001vm-Cw for emacs-devel@gnu.org; Mon, 12 Jun 2017 10:35:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKQQp-0002tH-7t for emacs-devel@gnu.org; Mon, 12 Jun 2017 10:35:07 -0400 Original-Received: from mail-oi0-x235.google.com ([2607:f8b0:4003:c06::235]:36291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dKQQn-0002rC-AA; Mon, 12 Jun 2017 10:35:01 -0400 Original-Received: by mail-oi0-x235.google.com with SMTP id k145so44655243oih.3; Mon, 12 Jun 2017 07:35:01 -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=v/t2yIfLJrtvHLSyrREjyUxNxFbiQ2TuHZEbEymN6pE=; b=PCg+w0SBI1sYBKkciatDQnRLzw20uqE+X2ohsAzEKqLea6/SZwIcB+mKOBPaqYdAJ4 HkIOVhvzWKu/gsPVKBTnXQ4uNg0kaHYt8kmZQiD9j27GqI4JDCyP+7hhD30HKbS2XvaU fcEPYKR+Nuhf36Rds7cr8F73RxlKI/gr5nqnFS9haVYD2Q5ffdQvnSNazxG1D9+42sCq AsikUnlVhQvecB+YgMC3tIc+TW1Mkvk1DnzTk98y+qhc5rp5KFsk6vk7uc6CshdkZ15R nB5sSkE0l7cQus2yvDP4LF6j4FrKZTDulJA9hBYN+TjR04vU/6OcrdybQN+FZUfjMMVx y7Wg== 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=v/t2yIfLJrtvHLSyrREjyUxNxFbiQ2TuHZEbEymN6pE=; b=lobmHB3XelYivBr2l58udCE1MfKS5QZdALrtZuhXcigszqR1lHuXtkku+S+DZuXNWI Okz+5aoe5jubcXNLiPdkoxSPPrFFeD7/+y4F0o3Q2+HdxdW/5UDoBud8QoYj+mDmqI/R Fxdwl6UNkkuVVpUBCUWlqoBHT6Bk04WDIz850X8coEmBsjF/4eMIp1LS3K0kcm8qhRfd G2u/Bi8KHt3A3uEqjwmAbhAiOB0t6g6aUAYymp38wYec6h10zbQshyLqUjXJqsaYad6A TOMQ3ofUuGkBduyqJDddZZLBxyl/fGtVPcJbc8yHShHyCwkuXJiokyEZ8+r4MkDiaxQE LQVQ== X-Gm-Message-State: AODbwcB4M9JLOoFKDL7xhitxO+P0PwISjVm/bP+4Z/kOFk6odHClHMgj YdO7P2yvcdy8B6bT6AbPnnPhOOqybVeQ X-Received: by 10.202.61.84 with SMTP id k81mr23673288oia.25.1497278100547; Mon, 12 Jun 2017 07:35:00 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::235 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:215590 Archived-At: --001a113cdf4250381e0551c439cc Content-Type: text/plain; charset="UTF-8" Philipp Stephani schrieb am So., 11. Juni 2017 um 22:34 Uhr: > Paul Eggert schrieb am So., 11. Juni 2017 um > 19:45 Uhr: > >> Philipp Stephani wrote: >> > Here's a new patch. It makes this change, and also changes the >> allocation >> > slightly so that objects have unique addresses (useful for checking). >> >> Thanks for working on this. Some comments. >> >> Have you looked into the runtime overhead of this approach, assuming >> -module-assertions is not specified? Currently lisp_to_value and >> value_to_lisp >> typically are optimized away (i.e., zero machine instructions), and that >> wouldn't be true under the proposed patch even when -module-assertions is >> not >> used. Granted, module calls need not be super-fast, but it might be nice >> to >> avoid the overhead in the typical case if that is easy. >> > > I've run a simple benchmark (5000000 iterations of mod-test-sum). Result > for the base case (module assertions not compiled) is 4.602 seconds, with > the new code it's 4.605 seconds. That's probably good enough. > > >> >> What happens if -module-assertions is enabled for Emacs, Emacs dumps >> itself, and >> -module-assertions is not enabled when the dumped Emacs is run? > > > Good question. I've now just made -module-assertions during dumping an > error. > > >> Or vice versa. >> > > That's the normal case, which should work just fine. > > >> >> Are the FOR_EACH_TAIL_SAFE macro calls needed? This macro is needed only >> for >> lists that might be circular (e.g., the lists are available to Lisp code, >> which >> can call setcdr on their components). If the calls are not needed I >> suggest just >> an ordinary for loop. >> > > Done. > > >> >> A small point: the FOR_EACH... loops should be indented like ordinary >> for-loops. >> > > Done. (Would be great if CC-Mode knew about this.) > I've now pushed this commit and also a commit that uses __attribute__((nonnull)) to master. --001a113cdf4250381e0551c439cc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Philip= p Stephani <p.stephani2@gmail.c= om> schrieb am So., 11. Juni 2017 um 22:34=C2=A0Uhr:
Paul Eggert <eggert@cs.ucla.edu> schrieb am So., 11. Juni 2017 um 19:45= =C2=A0Uhr:
Philipp Stephani wrote:<= br> > Here's a new patch. It makes this change, and also changes the all= ocation
> slightly so that objects have unique addresses (useful for checking).<= br>
Thanks for working on this. Some comments.

Have you looked into the runtime overhead of this approach, assuming
-module-assertions is not specified? Currently lisp_to_value and value_to_l= isp
typically=C2=A0 are optimized away (i.e., zero machine instructions), and t= hat
wouldn't be true under the proposed patch even when -module-assertions = is not
used. Granted, module calls need not be super-fast, but it might be nice to=
avoid the overhead in the typical case if that is easy.

I&= #39;ve run a simple benchmark (5000000 iterations of mod-test-sum). Result = for the base case (module assertions not compiled) is 4.602 seconds, with t= he new code it's 4.605 seconds. That's probably good enough.
<= /div>
=C2=A0

What happens if -module-assertions is enabled for Emacs, Emacs dumps itself= , and
-module-assertions is not enabled when the dumped Emacs is run?

Good question. I've now just made -module-assertions during dumping = an error.
=C2=A0
Or vice = versa.

That's the normal case, whic= h should work just fine.
=C2=A0

Are the FOR_EACH_TAIL_SAFE macro calls needed? This macro is needed only fo= r
lists that might be circular (e.g., the lists are available to Lisp code, w= hich
can call setcdr on their components). If the calls are not needed I suggest= just
an ordinary for loop.

Done.
=C2=A0

A small point: the FOR_EACH... loops should be indented like ordinary for-l= oops.

Done. (Would be great if CC-Mode knew about this.)= =C2=A0

I've now pushe= d this commit and also a commit that uses __attribute__((nonnull)) to maste= r.
--001a113cdf4250381e0551c439cc--