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: Re: Collecting markers with MPS Date: Thu, 25 Apr 2024 11:44:43 +0200 Message-ID: <87a5lhhj3o.fsf@gmail.com> References: <87cyqfjk6n.fsf@gmail.com> <86sezb2oj2.fsf@gnu.org> 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="26716"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@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 Thu Apr 25 11:45:19 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 1rzvfK-0006ol-RU for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Apr 2024 11:45:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzves-0007ef-Ed; Thu, 25 Apr 2024 05:44:50 -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 1rzver-0007eW-G3 for emacs-devel@gnu.org; Thu, 25 Apr 2024 05:44:49 -0400 Original-Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzvep-0002VK-TP; Thu, 25 Apr 2024 05:44:49 -0400 Original-Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56e1bbdb362so822267a12.1; Thu, 25 Apr 2024 02:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714038285; x=1714643085; 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=FmOVURgRLlKEJ/CMDnhxStsoSn5Z/NasDkot+NqJrB0=; b=YWOHC3abblDh7snIMksbiGBMTr4/Yg8Df/HPmfiMUf1ienzBT7w8p9Td6mXxxIvB2X xDCqMa3C0DXvmYD1uDA+9xc23q6dUO+lv/VRIZTagiynTRJo85Np/H1oX9pDYxwUXaGn bqsQyElDIbZb4oQl7JNQaR7MHsYTsNSSlzPijAacAfGVbx4mEuTUTN3fNjsFpHRetlPM GX1kl75I3HbQdpfX5RTDhVAxktCjuwjIcaCIPzE7YLPCm67/2U3FbVr1HTloUSe8EPso kzC56JKXlXOS6pB+F1APXMuF8g6ceW8im4GJMuFTCDJjqQLu9TJ1tTlfJglkkVZiA0SR z7PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714038285; x=1714643085; 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=FmOVURgRLlKEJ/CMDnhxStsoSn5Z/NasDkot+NqJrB0=; b=mbvXr0Cz90vxi/MsiaS1RyfV2YzJC9BBi3K2HlXYLVsb0yNAF+goFZtpxDoUFMuwfi D5Ur0K5OLrQ2zrDRlD5CilVBLRxBZE9TmIvraUOYIt0XyQAtupRczNlhCq1dYU087WmD IoqMV6+DW3FfxbugwjSi+uRmdbsoQ6vyd9QfW1cIMchj7xNxck8nzwG9PcI+hlHc6YRe kcCdr8TJ/g2tsxQADs7WPFfxYkCw5ApUID2oLZq8GJXA9sHb8BBCKYaSqAL7kbg3AIjX buTJUlWFqjUQsvXFgHPEYINDuNTssiVM2K6sRqZqyhk4Pdffr4hexHBDw0sVaa7qBJZ+ bJ2Q== X-Forwarded-Encrypted: i=1; AJvYcCXcr8FdGXL7puURvMCBk6WMAXXdRrtHtaYE7u/k6YHFmDXous0GjVBnEQQPPcmsnZuPb8+7rxf5B2ZjGy+BulIhdTi6 X-Gm-Message-State: AOJu0Yz9+dI5xOJQu72HkvPKWXGnKxSS3txx1RoglYrdbNY0Ienum1CA iSgSjB/qPG+DC/iVvybZAaUFypkuAs9PDnAH0/jcnN+jtoePOcZBcJC/xA== X-Google-Smtp-Source: AGHT+IEJPdud4P6l6JLMszpPFqOwHVComrRzarifUs1IL1EbqYrOZhlvErXS8TkjJlc1FexNlzZ2fw== X-Received: by 2002:a50:8a9a:0:b0:570:336:c341 with SMTP id j26-20020a508a9a000000b005700336c341mr4626462edj.27.1714038284785; Thu, 25 Apr 2024 02:44:44 -0700 (PDT) Original-Received: from caladan ([89.107.106.118]) by smtp.gmail.com with ESMTPSA id et6-20020a056402378600b0057245a3fd4bsm240487edb.68.2024.04.25.02.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 02:44:44 -0700 (PDT) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llman?= =?utf-8?Q?n=22's?= message of "Wed, 24 Apr 2024 11:08:00 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=eller.helmut@gmail.com; helo=mail-ed1-x530.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:318068 Archived-At: On Wed, Apr 24 2024, Gerd M=C3=B6llmann wrote: > Yes, it makes sense. One could of course use a timer. Or maybe, don't > know, run something when we handle an MPS message. That just occurred to > me a second ago, so it might be nonsense. A variation could be this: we split the marker type up into three parts. One part is only handled by the C code (malloc-ed, non-moving, reference-counted), the second part is handed out to Lisp, and the third part is specifically for the undo-list. The Lisp part is basically a pointer to the C part, but it has a finalizer that decrements the reference count in the C part. The third part is also a pointer to the C part, but the C part also keeps a (traced) reference to this part. When the reference count drops to zero, we can set the pointer from the undo-list to the C part so 0. Ie. this is basically weak reference, implemented manually. An advantage of this scheme is that the GC only needs to support finalization. Also, the involved changes would likely work for both the old GC and the new GC. Which might be an issue if the new GC remains a purely optional feature. Helmut