From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Hahnfeld via "Developers list for Guile, the GNU extensibility library" Newsgroups: gmane.lisp.guile.devel Subject: Re: GC + Java finalization Date: Fri, 19 Nov 2021 16:32:32 +0100 Message-ID: <6c1b27f3218403cf347c1b13d0c632913bd8bc6a.camel@hahnjo.de> References: <9ce77d5e08d50456eddc575179b68ac17afc9bf6.camel@hahnjo.de> <89404d642bd0225001e78d331c88849f67da5254.camel@hahnjo.de> Reply-To: Jonas Hahnfeld Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-fEhusA6zkNUeK0v5/VdT" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33757"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.42.1 To: Maxime Devos , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Nov 19 16:33:34 2021 Return-path: Envelope-to: guile-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 1mo5tN-0008Vi-9S for guile-devel@m.gmane-mx.org; Fri, 19 Nov 2021 16:33:33 +0100 Original-Received: from localhost ([::1]:57202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo5tL-0004fX-AD for guile-devel@m.gmane-mx.org; Fri, 19 Nov 2021 10:33:31 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:32914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo5se-0004fO-Um for guile-devel@gnu.org; Fri, 19 Nov 2021 10:32:49 -0500 Original-Received: from backus.hahnjo.de ([193.30.122.186]:58658 helo=mail.hahnjo.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo5sX-0001RZ-Ij for guile-devel@gnu.org; Fri, 19 Nov 2021 10:32:45 -0500 Original-Received: from [IPv6:2001:16b8:1e92:200:6657:51b0:48f8:9366] (unknown [IPv6:2001:16b8:1e92:200:6657:51b0:48f8:9366]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hahnjo.de (Postfix) with ESMTPSA id 337C75429D17; Fri, 19 Nov 2021 16:32:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hahnjo.de; s=default; t=1637335958; bh=Q6/LjZIE5NeZRGjrveTBQtS0A3WeMlyD3tuBcL9g5qw=; h=Subject:From:To:Date:In-Reply-To:References; b=UkXZIpakyAyOzcxpvB74se43W3qt2dntRuzWn7kLqABNj3WezdVhkV6mUkmH2EXGW kFDZxnlj5gQJBw2r5EuTBLVbc8tK0g8lMAbWqIdCZEx7ZAb6ACG8sDjDGismC9lBPz iHqY//1j08SXKKmTvAlsXrjDYZdR89UhTbIzslQK2Dub7px4VK91+zWVg2/ik9BTYn Wl/KkFthteHwuR0zuy/+vYAEmkbcU49fZJhUFoyhAUirMgvsjiJSlM4czrm9fQiflN uEq0cvWJyLUEMIzuksaUpy/yFrmAgh8uaVp0xOuTuowRvGuvnwYzNprNtiiryu0bNA lSZd7+cxkAxQA== In-Reply-To: Received-SPF: pass client-ip=193.30.122.186; envelope-from=hahnjo@hahnjo.de; helo=mail.hahnjo.de 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20973 Archived-At: --=-fEhusA6zkNUeK0v5/VdT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Am Freitag, dem 19.11.2021 um 14:21 +0000 schrieb Maxime Devos: > Jonas Hahnfeld schreef op vr 19-11-2021 om 14:35 [+0100]: > > Am Freitag, dem 19.11.2021 um 13:15 +0000 schrieb Maxime Devos: > > > Jonas Hahnfeld schreef op do 15-07-2021 om 20:44 [+0200]: > > > > +=C2=A0 SCM *smobs =3D scm_gc_malloc (sizeof(SCM) * SMOBS_COUNT, > > > > "smobs"); > > > > + > > > > =C2=A0=C2=A0 int i; > > > > =C2=A0=C2=A0 mark_call_count =3D 0; > > > > =C2=A0=C2=A0 for (i =3D 0; i < SMOBS_COUNT; i++) > > > > -=C2=A0=C2=A0=C2=A0 make_x (); > > > > +=C2=A0=C2=A0=C2=A0 smobs[i] =3D make_x (); > > > > =C2=A0=C2=A0 scm_gc (); > > >=20 > > > smobs doesn't need to be protected for the whole function call, > > > until after the scm_gc() should be sufficient I think.=20 > >=20 > > That's what the patch does, no? For reference, the whole function > > (after this patch) looks like: > >=20 > > SCM *smobs =3D scm_gc_malloc (sizeof(SCM) * SMOBS_COUNT, "smobs"); > >=20 > > int i; > > mark_call_count =3D 0; > > for (i =3D 0; i < SMOBS_COUNT; i++) > > =C2=A0 smobs[i] =3D make_x ();=20 > > scm_gc ();=20 > > if (mark_call_count < SMOBS_COUNT) > > =C2=A0 {=C2=A0=C2=A0=20 > > =C2=A0=C2=A0=C2=A0 fprintf (stderr, "FAIL: SMOB mark function called fo= r each > > SMOB\n"); > > =C2=A0=C2=A0=C2=A0 exit (EXIT_FAILURE); > > =C2=A0 }=C2=A0=C2=A0=20 > > scm_remember_upto_here_1 (smobs); > >=20 > > While we could move the remember_upto_here immediately after the call > > to scm_gc(), the current version ensures that the memory is still > > available when the error is checked. >=20 > The error checking code (I'm thinking of the if (mark_call_count ...) > fprintf(...) exit(...) here) isn't using 'smobs', so the error checking > code doesn't need the memory to be available AFAIK. No, but if somebody ever wants to debug the test, it will be less surprising if things are still there, or at least not risking that they are gone at a moment's notice. So, what's the gain of moving it? Jonas --=-fEhusA6zkNUeK0v5/VdT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEXw/5YGpL6H9VOgO2kcnDPSxhrNsFAmGXw5AACgkQkcnDPSxh rNvAdAf/Yktp8KzPN+ep8UUnhApbe2XsWoEr5zQ9TkENMrECKEu8UIdbildGUp8z 6GPzKcT8RGN3szWQeWRKM3e7m6KDDZzkrk2m/E930BTsrx59LkAMr+zin2ljysGW ZOW9dkGqtWabY5pkGm0I4SrVvT6+YftwTY24Y0YA/yFPbt0iINe7tQH13sVe4gPX M/YhUPnr+ZKzKUG/p1ff406/HT1fCFxzFSZsdy7i4RqkgNEozs1emAyrTkxpuCeM UAEP8iyAswFP7dZrsSwUCcLFWdkfQoZrjFmf3v8ac8VS7yahRN3BFjfblO6o9PUa 6PX9nsELq1Wg7oTnRCCFZ/bv4xTEXg== =srn/ -----END PGP SIGNATURE----- --=-fEhusA6zkNUeK0v5/VdT--