From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: weak hash tables Date: Thu, 04 Jul 2024 18:53:57 +0200 Message-ID: References: <-plQctKgNkvp-LJ9ov2QAiXQKxd9V-hI0yz_opRGxQtbknubCjH4rH2-ymgbw_Qr1ZhB1rtlmiEW8XtuIVNr7nR_Yj20AH6WkH6kUGp68g0=@protonmail.com> <_mNcR6ailVKpYHLxgfo_tJlYGeR0AQIzQWluspYYp5_g5pIIKkHLNfFkklQQgOKNiVW8jn8NS3i2dJ7_B2Qyx9v-Dq3MQ9mP8HNL30UWsqY=@protonmail.com> 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="24083"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Helmut Eller , Eli Zaretskii , Emacs Devel To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 04 18:54:56 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 1sPPjU-00060g-7d for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jul 2024 18:54:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPPid-0003tl-KU; Thu, 04 Jul 2024 12:54:03 -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 1sPPic-0003tP-Ja for emacs-devel@gnu.org; Thu, 04 Jul 2024 12:54:02 -0400 Original-Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPPia-0006tl-Td; Thu, 04 Jul 2024 12:54:02 -0400 Original-Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-58c2e5e8649so2937833a12.1; Thu, 04 Jul 2024 09:54:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720112039; x=1720716839; 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=jsrVWByCmiRljC86hH/fkAsxNfxgZrHR6xxvNWnsPGk=; b=UtKGmoJNg+PWNwsIvN3ek0GT3ebeO3JzaOON84SIQyNUFByfG4AZoLywdH57yfY6Ow HHSs0HVDMMbiLCvSVJ5+Cu2Wp5hDsed9tS/vn7JNu3rTtCQYtU/O9EbHvHwS1cFAZtEL EEnp256AlDXSmk9zVBmWyrgSuQXb8BCsfCOj82YAz+bR2wI2uES2AEZJ1axEdFY46a/z 4ngxYQjq4HHhvubfedcMDKhlC+8W0cv3N1M/09Z0X4ILEpph7/t8tPmligG8y3l3Bf1m AXXBGfCfCTRlCX8ebOKksDWRpk865qdW4OsmWiSC9PFY8/z1U7VONu62+aH3LtAvOUf4 gf7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720112039; x=1720716839; 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=jsrVWByCmiRljC86hH/fkAsxNfxgZrHR6xxvNWnsPGk=; b=B0fXUAu8E7KHKhDYIYpJOw/JDTPOWQlMEmVnuPRVkuEUwlE2nklTAOiMDt7KvcXkXe 5ZrAQ/PCsJfvvdHB9gg0OCu5SH+suzxBCEKRW+HjnE3avUtCGQEkB1TDiNtUGyvtUJcB D4y/rQuFbuavRb4LiUw+PxNRaIzpy7GTWK+AlTXy0uDdMe0JZ9jSYiaL9Pc+prClNjZK uzvM3njub898WX9Jg8FLFoX5L1wRanni6ky1Z9oF5b6urQm7cz6eADBJzT+OBrh+BcCz eO0U2+mDhZaXVocqPB7f1MLBlaOOkUZrYD4k0+8lcXRqgjFgREuK7IlaW6IKXasRjkru PXHg== X-Forwarded-Encrypted: i=1; AJvYcCWNLWXTXGM0ZLmkXYg213yK//Rdjh+qKihPRvEYeT3h/4l6QWNNvkaSsH5jiL5xBlakn+ZGNtCHvwKefR42jAmFjNFh417RuPW8vSrY6EsfQr4= X-Gm-Message-State: AOJu0YymgOjPHhgDsnd5ZiR+S/FIhQfk7vGhiFBGpRYewtpW1MnvSWBX 8BA7lLeQ3HdbH01fpy+Jme8FS0gCOzNgbfLSTNuUeeja+O8iTs6KF8RTag== X-Google-Smtp-Source: AGHT+IHqthstg5dy2dvpLkAkIx6QxMDpf2ZEMsRZiq+4usNPFLJFHhVGCUOqWLWCyOIG+rBabxLXCA== X-Received: by 2002:a17:906:b751:b0:a72:7b17:5d68 with SMTP id a640c23a62f3a-a77bd99b260mr174866166b.3.1720112038615; Thu, 04 Jul 2024 09:53:58 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36fa8.dip0.t-ipconnect.de. [217.227.111.168]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a77b788be53sm68153366b.182.2024.07.04.09.53.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 09:53:58 -0700 (PDT) In-Reply-To: <_mNcR6ailVKpYHLxgfo_tJlYGeR0AQIzQWluspYYp5_g5pIIKkHLNfFkklQQgOKNiVW8jn8NS3i2dJ7_B2Qyx9v-Dq3MQ9mP8HNL30UWsqY=@protonmail.com> (Pip Cet's message of "Thu, 04 Jul 2024 15:24:46 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52e.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:321342 Archived-At: Pip Cet writes: > On Thursday, July 4th, 2024 at 07:17, Gerd M=C3=B6llmann wrote: >> > > Move fast and break things. Normal. >> >=20 >> > I'm afraid I've continued to do so. After the last push, >>=20 >> Did that too yesterday for --enable-checking. and had to revert now :-) > >> > my TODO list is down to: >> >=20 >> > * fix bugs that slipped through (well, obviously) >> > * user-defined hash table tests for weak tables don't work >> > * key-or-value weakness doesn't work > > I believe we can make key-or-value tables work, and gain a potentially > useful debugging aid, by allowing struct igc_header to contain a > tagged pointer to an extended "header" structure which resides in > external (non-MPS) memory (a "remote reference" in MPS speak, which is > usually forbidden in AMC pools but appears to work if it's non-MPS > memory); we'd use the extended header instead of the header word to > determine object size, hash, and object type. That extended header > could then contain a Lisp_Object which would be scanned and kept alive > while the object belonging to the header is allocated, not just while > it's still reachable. Ah, I thought what you wrote in the other mail was related to the IA-32 software emulation shit^Wrequirement, sorry. > So if we (puthash a b key-or-value-hash), we'd make `a' keep alive `b' > and vice versa, but once they're no longer strongly reachable from > other objects, they'd be collected. (I've tried this, it works). > > And we could finalize objects appearing in weak hash tables. > > This would cause some memory fragmentation (xmalloc isn't moving), but > I don't think that's much of an issue: if you're using exotic weak > hashes, you're already creating unmovable allocations in > weak_hash_pool; if you're debugging, you probably don't care. > > However, the functional gains are minimal and so far no one has > demanded key-or-value hashes... This all gets rather complicated :-/. I'm depressed.