From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Collecting markers with MPS (was: STatus of MPS branch) Date: Wed, 24 Apr 2024 09:26:08 +0200 Message-ID: <87cyqfjk6n.fsf@gmail.com> 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="26625"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 24 09:27:06 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 1rzX22-0006lM-25 for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Apr 2024 09:27:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzX1E-0002e1-6H; Wed, 24 Apr 2024 03:26:16 -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 1rzX1C-0002dn-CU for emacs-devel@gnu.org; Wed, 24 Apr 2024 03:26:14 -0400 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzX1A-0005lq-LV for emacs-devel@gnu.org; Wed, 24 Apr 2024 03:26:14 -0400 Original-Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2da0b3f7ad2so94349961fa.2 for ; Wed, 24 Apr 2024 00:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713943570; x=1714548370; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xoL8u+Cm9K3l6NQcgKrueX+mli3b0wm3a5eEB+kYxAs=; b=BZGwDgiFZBFobFT17zm0xkr0w1VHCXmSYvR94hbhTyY6L+RaLYhpD4Pp4wTfwp0K9M z9QaL3YnfCcHoxjWeRKRnJwxCeShD3TPZPv+KmaKUfJoqu95naq1X0l0m9XHDMKxVvRZ 92cibi+Muka0Ulh7868cnXqXHpdtYko/O95z3ZFbtSXTLtB+SHXmI82ypUb6ER8eAyw/ zk5WT43j1dFRQmiJJXUkvKjTI3BD09dZ+uvWVEtwKFc5QiN3VNo5ndiz0hLNA1KoVqrd Y7wKntfjQz/GFXoCTRMt0Mm7pj+M6zIP+SiSGptJIKdIJysxuxyQWpVIXqNXBJlR9GM1 AXlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713943570; x=1714548370; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xoL8u+Cm9K3l6NQcgKrueX+mli3b0wm3a5eEB+kYxAs=; b=wjTtk+LAr8ZOyhtvli+aWTJPEFYlf/9t1Nian+jfz7cozd1j6cRH4N3gEldGDFjyOk qILW+FeKHLpLxecREvquMjbzAIoe4rzgo/2X5Uj/QZeU9iy7LcGWREqhvuElVlWQQdaq qpcoBPXtIdIlHOtTMMXlUdcMH479jSkr9WCdqKPwv7PIwaMMBBLitPnmiPH3ELylcNre J6G2j9AafsNoHdamwfFIt5yz8zVroWPQ6q3jq9nl1DH6Ks3PXuuiCk6OXGgWsd65Mcbl CYcavQ09ZCC/PuXXH5vhiSwPrh+joC8MpY2cMsxVzmaNk2LgGxK9Gy4Ez0ki0YyQWxbB OMBg== X-Gm-Message-State: AOJu0YwUxWUmtpLRxibAIUKH8gBOFjh5kji41tLqbDBKpsAFZN3SMp8g 64fHi0B2bQxMUyxq4L5cWHshfScbuqeuiinMSKGKo8f0RfarZ1A547cOGg== X-Google-Smtp-Source: AGHT+IFjGJv9v/XhDyzGNrWyxN7QffGBZJm1m9Z8xgumxmJHZs1mGj+blVEZroUZlVHXpceWwfnzdA== X-Received: by 2002:a19:8c0c:0:b0:518:dbcc:4f8b with SMTP id o12-20020a198c0c000000b00518dbcc4f8bmr1064107lfd.12.1713943570093; Wed, 24 Apr 2024 00:26:10 -0700 (PDT) Original-Received: from caladan ([89.107.106.118]) by smtp.gmail.com with ESMTPSA id le23-20020a170906ae1700b00a4e4c944e77sm7962560ejb.40.2024.04.24.00.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 00:26:09 -0700 (PDT) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llmann?= =?utf-8?Q?=22's?= message of "Sat, 20 Apr 2024 11:34:05 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=eller.helmut@gmail.com; helo=mail-lj1-x229.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:318019 Archived-At: On Sat, Apr 20 2024, Gerd M=C3=B6llmann wrote: > - Figure out what is done in the old GC in garbage_collect that is not > directly related to GC, and how to do that when GC is concurrent. > Examples are buffer undo_list, window prev_buffers/next_buffers In the igc branch, markers are currently not collected because they are referenced from the buffer's chain of markers. The old GC has special code to break this link. There is also special code to break links from the undo-list to markers. With the MPS, we could introduce explicit weak reference objects, similar to WeakRef in Javascript[*]. Buffers would then, instead of the current chain of markers, have a list of weak references to markers. (Markers would no longer have the embedded "next" field.) The same for the undo-list: instead of markers, it would contain weak references to markers. This would allow markers to be collected, but the empty weak-ref objects would still be in the undo-list and the buffer's markers-list. A timer could periodically go through those lists and remove the empty weak-refs. Does this sound like a reasonable plan? To me, it sounds like it will require relatively big changes to the buffer code. Much bigger than the 200 or so lines of special code in the old GC. Also, the undo-list is visible to Lisp code, so those weak reference objects in there must be new types of Lisp objects. On the plus side, explicit weak reference objects could make some things easier to understand and might be more widely useful to Lisp programmers. What do you think? Is there an more elegant alternative? Helmut [*] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Globa= l_Objects/WeakRef