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: staticpro everything Date: Thu, 02 May 2024 17:37:05 +0200 Message-ID: References: <87plu72y8h.fsf@gmail.com> <877cgfwe5g.fsf_-_@gmail.com> <871q6mptkj.fsf@gmail.com> <86frv2pse5.fsf@gnu.org> <87v83ynhuc.fsf@gmail.com> <86v83xof5w.fsf@gnu.org> <878r0thbfl.fsf@gmail.com> <86jzkdo9rm.fsf@gnu.org> <87jzkdfres.fsf@gmail.com> <86plu4mylj.fsf@gnu.org> <86msp8lbci.fsf@gnu.org> <86ikzwl8ih.fsf@gnu.org> <87r0ektkfo.fsf@yahoo.com> <86frv0l0ir.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4370"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: luangruo@yahoo.com, eller.helmut@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 02 17:37:53 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 1s2YVM-0000yV-L5 for ged-emacs-devel@m.gmane-mx.org; Thu, 02 May 2024 17:37:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2YUo-00038P-JI; Thu, 02 May 2024 11:37:18 -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 1s2YUj-00035r-T8 for emacs-devel@gnu.org; Thu, 02 May 2024 11:37:15 -0400 Original-Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2YUh-0007uo-MF; Thu, 02 May 2024 11:37:13 -0400 Original-Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a58fc650f8fso618986966b.1; Thu, 02 May 2024 08:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714664229; x=1715269029; darn=gnu.org; h=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=qAV9Nav07s47zPLOby3/x9OTJSmDC3wCtGYx7pWCpRI=; b=PU8Su7fvGwZP5aVlpfRrBdus9AiRmQSYVZJ2xAQwn2rIET7xE+ZqKhXZ8OfZbCJt1+ y8WX9GJOjqMWv3r/fN/WF9v1Ezof8gMXnmmL8nfwXNIqyuimzpSHhBwTTdP33KSOWGya z7Zv6K9jQNfh3X1+l46zh2BOGGIRHIZGxYe/br7t3YKqtvtqIh5ds2R7ZduXNcXob5XD jKsxo88HYQsdyU/DqPB34FFOYTrCfd6UzaCkKtCF0RBFFJqmq8iPG5Cw4rcVfVIuufYj aX+8QS9oHQ2XuFGDFXaJunrwthnIh4YnfHjvojyyqxiYbfGKrb0b4lPeFvgC3BPmLHzW aOvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714664229; x=1715269029; h=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=qAV9Nav07s47zPLOby3/x9OTJSmDC3wCtGYx7pWCpRI=; b=PuRODomcpcUXC1FY7B/IlTHqld2QMRU0cwc5eh/csLR3RAeaMyZboCQ62kdYlkj+S3 93nP3qLEqmU59Sgsctm9AnuxcCypCv6PLkJC17qWAsMKCgZf/qcG1nx0tDsn1TBxmOzD Kjyhum50Nn4ZOnvZ199iGhkxD5jKoV3v8KAeBFP3Ss3GQp1iUXnEQjq0DSMmsC03rjAl gOQaO7kIidka41ZB7+pM5O0lmlSxYY9EPsdT9pXFW2nL6PaLp9FuYOMkkbjVcwsnBjTh Ft5Y4X0BgElkgJnYCtZOOYZOfbh9BJdGl9k+1vSBYh960ut2KdOlc4FvC9FWZXLdqM/x O6gg== X-Forwarded-Encrypted: i=1; AJvYcCU/e3PheXhFhwjLilF8MHSmam4wGRYxPBtjXcFOtu507TU60XPrS88EhntXvkYx3DaedJowMECXjsivwJgiMEaqB5LI X-Gm-Message-State: AOJu0Yw0SQe7F+jMj6463ji2evhR40m/RsnEct57kI+QX3UD+PPjHnOm EjNUoQ0JtUPfRZqsnPlGQcsg7qaWWsGT6P8tVyhxuHeKDkOp0sF99YTvXA== X-Google-Smtp-Source: AGHT+IFX8I8oYtvIJgIWdfHssxH92bo0jQQbiytmUodWed9EAzCnWmlBO+vdYPCvPiQmlcRAMCZfcA== X-Received: by 2002:a17:907:7dac:b0:a59:5ade:3f7e with SMTP id oz44-20020a1709077dac00b00a595ade3f7emr3558159ejc.22.1714664227029; Thu, 02 May 2024 08:37:07 -0700 (PDT) Original-Received: from pro2.fritz.box (p4fe3adac.dip0.t-ipconnect.de. [79.227.173.172]) by smtp.gmail.com with ESMTPSA id gg24-20020a170906e29800b00a469d3df3c1sm676705ejb.96.2024.05.02.08.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:37:06 -0700 (PDT) In-Reply-To: <86frv0l0ir.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 02 May 2024 18:02:52 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x62d.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:318586 Archived-At: Eli Zaretskii writes: >> bidi_cache is a global variable pointing to a malloc'd array of bidi_it. >> So, by itself, nothing is protected. MPS doesn't know anything about >> malloc'd memory. > > That's true. But the string Po Lu is alluding to is stored in the > cache as a Lisp object, not as a 'char *' pointer to the string's > data. So as long as the string is alive (i.e. referenced from other > places), it should not be moved, right? That's not the case. MPS doesn't know anything about the malloc'd block, so it doesn't know anything about what it contains, it will never see the char *, and nothing keeps it alive or prevents moving. The situation is different if we make MPS know the block, by making it a root (igc_xzalloc_ambig). MPS then scans the block, we see the char *, and because we scan ambiguously, this keeps the string alive and it precents moving. (Other references outside of the malloc'd block can do the same of course. I'm just talking about the one malloc'd block.) >> For some reason, this works with the old GC, without the need for a >> special mark function, analogous to mark_specpdl, say. Why that is I >> have no idea. Something else apparently keeps everything in the cache >> alive. > > That string is not just an arbitrary string, it's a string that the > display iterator is iterating. So its reference is also in > it->string, which is on the C stack, and that reference keeps it alive > for as long as the string is being processed. Once we are done > iterating the string, the parts of the cache that hold the states > related to that iteration are thrown away, because they are no longer > needed. That would the "other references" I mention above that can have the same effect of making things immovable, keeping things alive.