all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Helmut Eller <eller.helmut@gmail.com>,
	Emacs Devel <emacs-devel@gnu.org>
Subject: Re: MPS: Bytecode stack
Date: Mon, 6 May 2024 14:12:46 +0200	[thread overview]
Message-ID: <3174C6A6-28A6-492E-A268-E391A13FEA36@gmail.com> (raw)
In-Reply-To: <m2cypzdzxe.fsf@pro2.fritz.box>

6 maj 2024 kl. 11.58 skrev Gerd Möllmann <gerd.moellmann@gmail.com>:

> I think I fixed, or better said worked around, something important today
> in scan_bc which can lead to objects being "lost". Might be interesting
> to see if some errors magically disappear.

I'm not sure what you are trying to fix. Dodging a data race?

To see if I understood what your problem is, and how MPS works, consider the thread state

Lisp_Object *a;
int top;

where `a` is a heap-allocated array of some size, but only indices [0..top] are actually used so the GC doesn't need to look at the rest. The mutator thread does:

1  x = a[top];
2  top = top - 1;

What does the GC thread see? Even if it reads a (signal-atomic) snapshot of the mutator's register and stack, does this atomicity extend to `top` which isn't even a Lisp_Object? Is the mutator suspended during this scan?

Furthermore, the compiler is allowed to hoist the store in line 2 past the load in line 1. If that's the only problem, it may just be a matter of adding a compiler barrier (acquire).




  reply	other threads:[~2024-05-06 12:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06  9:58 MPS: Bytecode stack Gerd Möllmann
2024-05-06 12:12 ` Mattias Engdegård [this message]
2024-05-06 12:47   ` Gerd Möllmann
2024-05-06 13:07     ` Mattias Engdegård
2024-05-06 13:23       ` Gerd Möllmann
2024-05-06 13:35         ` Gerd Möllmann
2024-05-06 13:54           ` Mattias Engdegård
2024-05-06 14:02             ` Gerd Möllmann
2024-05-06 14:14               ` Gerd Möllmann
2024-05-06 15:59               ` Mattias Engdegård

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

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

  git send-email \
    --in-reply-to=3174C6A6-28A6-492E-A268-E391A13FEA36@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.