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: Some experience with the igc branch Date: Sat, 28 Dec 2024 12:39:26 +0200 Message-ID: <86cyhcum5d.fsf@gnu.org> References: <87o713wwsi.fsf@telefonica.net> <861pxx2lh7.fsf@gnu.org> <86ldw40xbo.fsf@gnu.org> <868qs329kj.fsf@gnu.org> <864j2r25hg.fsf@gnu.org> <861pxv234y.fsf@gnu.org> <86zfkjznat.fsf@gnu.org> <86ldw2zy6s.fsf@gnu.org> <867c7lw081.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24972"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefankangas@gmail.com, pipcet@protonmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, eller.helmut@gmail.com, acorallo@gnu.org To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 28 11:40:28 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 1tRUFA-0006Mi-8v for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Dec 2024 11:40:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRUEJ-00072y-R1; Sat, 28 Dec 2024 05:39:35 -0500 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 1tRUEI-00072l-15 for emacs-devel@gnu.org; Sat, 28 Dec 2024 05:39:34 -0500 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 1tRUEH-0005gz-3h; Sat, 28 Dec 2024 05:39:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=pEdfJXJBs8pyrNCjE6s+wgN5Ur7c1IfKaY322IueI4s=; b=Km4v6Jyyh9YDNRuOlQPk EpgOFBYZ63zeNs39KfTjRm9054hGab9ZUhc1nlQkcZPrD66XVOZGizx97TWUuree32+N6Hun3G8Np 8DcZY/0R7u1TLW6HAtWFTQ46sTkADfz7Oj0FSO1cqnEwPviQHh4uBrLkWtl3/f6koT8rbY31ns/I1 ynza1erzMrKkQhHTTUg1rqOxP0E0Mz4F+RoVVMEpVKBHZz7kTUUo3c9oFF34tBXis3trmnuC+3Xkm NpLidGVIa+QneuTdz1Sm+73NR6yYjqcZcLXy7/o+cb0/+63K5cGU4YRrVyHKtOB9E3umR5yGWBDj/ dFu1+ZkAVRirjA==; In-Reply-To: (message from Gerd =?utf-8?Q?M?= =?utf-8?Q?=C3=B6llmann?= on Fri, 27 Dec 2024 19:21:30 +0100) 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:327249 Archived-At: > From: Gerd Möllmann > Cc: stefankangas@gmail.com, pipcet@protonmail.com, ofv@wanadoo.es, > emacs-devel@gnu.org, eller.helmut@gmail.com, acorallo@gnu.org > Date: Fri, 27 Dec 2024 19:21:30 +0100 > > Eli Zaretskii writes: > > > - Concurrent. The GC runs in its own thread. There are no explicit > > calls to start GC, and Emacs doesn't have to wait for the GC to > > complete. > > > > Pip says this is not true? I also thought MPS GC runs concurrently in > > its own thread. > > What Pip said was very easy to misunderstand, to say the least :-). No, > MPS is concurrent, period. There are situations in which MPS can, in > addition, use the main thread. And it's still concurrent, period. How can you see which thread runs MPS? Where should I put a breakpoint to see that (IOW, what are the entry points into MPS GC code)? If I run Emacs with a breakpoint in process_one_message (after enabling garbage-collection-messages), all I ever see is GC triggered by igc_on_idle, which AFAIU is only one of the way GC can be triggered. Where are the entry points for the other GC triggers? I'm asking because I'd like to run Emacs like that and see which thread(s) run GC. > > When copying objects, a marker is left in the original object pointing > > to its copy. This marker is also called a "tombstone". A "memory > > barrier" is placed on the original object. Memory barrier means the > > memory is read and/or write protected (e.g. with mprotect). The > > barrier leads to MPS being invoked when an old object is accessed. > > The whole process is called "object forwarding". > > > > This doesn't tell how object forwarding works once triggered by access > > to protected memory. Can you say something about that? > > This: > > > > MPS makes sure that references to old objects are updated to refer to > > their new addresses. Functions defined in the object format are used > > by MPS to perform the lowest-level tasks of object forwarding, so that > > MPS doesn't have to know application-specific details of how objects > > look like. In the end, copying/forwarding is transparent to the > > application. > > > > seems to try to explain that, but AFAIU stops short of telling it. > > IOW, how are "functions defined in the object format used by MPS to > > perform the lowest-level tasks of object forwarding"? > > > > I'm afraid I can't describe that in detals because it's an > implementation details of MPS itself. AFAIK, it's not documented, and I > don't read the sources of MPS. > > Object forwarding in general is not specific to MPS. Many copying > collectors use it. I tried to explain this as far as I could without > knowing the MPS implementation. > > Whether one should describe this in detail here is a valid question. > Maybe someone knowing the MPS implementation in detail could add that. I'm only interested in this insofar as it's relevant to the functions defined in igc.c. E.g., do any of the "scan" or "fix" function have anything to do with object forwarding? If so, I thought it would be useful to describe that, to help people understand the role of those functions and what their code needs to do. > > MPS allows us to specify roots having tailor-made scan functions that > > Emacs implements. Scanning here refers to the process of finding > > references in the memory area of the root, and telling MPS about the > > references. > > > > What is the purpose of "telling MPS about the references"? > > If MPS were the old GC, it's like letting MPS do its mark_object. > > What about if it said "... telling MPS about the reference so that it > knows the references object is live", only expressed better? Sure, that's much better, because it makes this much more concrete. > > Stuff that I'd like added: > > > > . a few words about the root_create_* functions > > . same for create_*_ap functions > > . why do we need the finalize_* functions? > > . some explanation why pdumper needs special support from igc > > > > Thanks again for writing this. > > I'll try to add something for that. Please watch out for commits. Thanks.