unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lynn Winebarger <owinebar@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: GC mark stack
Date: Mon, 15 Aug 2022 14:17:11 -0400	[thread overview]
Message-ID: <jwvy1vp2xkv.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAM=F=bAFKWt+qtUfaQFn+yw-TLi=_ta29UoyVJh2jo-KTYFdEg@mail.gmail.com> (Lynn Winebarger's message of "Mon, 15 Aug 2022 13:52:23 -0400")

> If the loop can be expressed by a relational expression consisting of
> a concrete relation (like "references"), composition, union, and
> transitive closure, then there is a systematic way to construct an
> algorithm of the type I described.

I think the core of the problem is the following:

In a "key weak" hash table, if a reachable object points (transitively) to
an object that is a key in that table, then the value associated with
that key becomes reachable.  So conceptually we have a reference (an
edge) from the key *object* to the value, but this reference is not
actually represented in the heap.

More specifically, the code that does the marking (i.e. `mark_object`)
only knows about the key object itself: it doesn't know that this object
is a key in a weak hash table nor what is the associated value.

We could try and reify those conceptual references, e.g. in some kind of
auxiliary table, but the added cost of making `mark_object` consult this
table for every object it marks (at least while marking weak-refs)
seems prohibitive.


        Stefan




  reply	other threads:[~2022-08-15 18:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 15:31 GC mark stack Lynn Winebarger
2022-06-26 15:50 ` Lynn Winebarger
2022-08-15 14:01 ` Stefan Monnier
2022-08-15 14:51   ` Lynn Winebarger
2022-08-15 16:28     ` Stefan Monnier
2022-08-15 17:52       ` Lynn Winebarger
2022-08-15 18:17         ` Stefan Monnier [this message]
2022-08-16  1:53           ` Lynn Winebarger
2022-08-16  9:50             ` Lynn Winebarger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvy1vp2xkv.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=owinebar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).