unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* MPS: Area scanners
@ 2024-05-06 17:12 Gerd Möllmann
  2024-05-06 18:24 ` Eli Zaretskii
  2024-05-06 18:28 ` Gerd Möllmann
  0 siblings, 2 replies; 6+ messages in thread
From: Gerd Möllmann @ 2024-05-06 17:12 UTC (permalink / raw)
  To: Eli Zaretskii, Helmut Eller; +Cc: Emacs Devel

I remember now why I thought tht scan_bc would work they way I thought,
so that I could compute a suitable scan end and so on. I read in the MPS
docs this:

  type mps_area_scan_t

  Warning: Area scanning functions are subject to the same set of
  restrictions as format scanning functions, described under Cautions.

And Cautions links to a long list containing

  7.3. Cautions

  The MPS guarantees that format methods have exclusive access to the
  object for the duration of the call. This guarantee may entail
  suspending arbitrary threads. The methods that manipulate the object
  must not perform any sort of inter-thread locking or communication.

etc.

Question is of course now, what is with the exclusive access for area
scanning functions? Is that point a member of the "set of restrictions"?

I can't answer that ATM. Maybe someone else can?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MPS: Area scanners
  2024-05-06 17:12 MPS: Area scanners Gerd Möllmann
@ 2024-05-06 18:24 ` Eli Zaretskii
  2024-05-06 18:46   ` Gerd Möllmann
  2024-05-06 18:28 ` Gerd Möllmann
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-05-06 18:24 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: eller.helmut, emacs-devel

> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Cc: Emacs Devel <emacs-devel@gnu.org>
> Date: Mon, 06 May 2024 19:12:08 +0200
> 
> I remember now why I thought tht scan_bc would work they way I thought,
> so that I could compute a suitable scan end and so on. I read in the MPS
> docs this:
> 
>   type mps_area_scan_t
> 
>   Warning: Area scanning functions are subject to the same set of
>   restrictions as format scanning functions, described under Cautions.
> 
> And Cautions links to a long list containing
> 
>   7.3. Cautions
> 
>   The MPS guarantees that format methods have exclusive access to the
>   object for the duration of the call. This guarantee may entail
>   suspending arbitrary threads. The methods that manipulate the object
>   must not perform any sort of inter-thread locking or communication.
> 
> etc.
> 
> Question is of course now, what is with the exclusive access for area
> scanning functions? Is that point a member of the "set of restrictions"?
> 
> I can't answer that ATM. Maybe someone else can?

What are those scanning function you are talking about? are they all
those fix_SOMETHING functions that run off dflt_scan etc.?  If so,
these scan Lisp objects, do they?  And so, the above restrictions on
inter-thread locking or communication are relevant for those
fix_SOMETHING functions?  If so, why is inter-thread locking relevant?
I don't see anything like that in those fix_SOMETHING functions.  Did
I miss something?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MPS: Area scanners
  2024-05-06 17:12 MPS: Area scanners Gerd Möllmann
  2024-05-06 18:24 ` Eli Zaretskii
@ 2024-05-06 18:28 ` Gerd Möllmann
  2024-05-07  5:53   ` Helmut Eller
  1 sibling, 1 reply; 6+ messages in thread
From: Gerd Möllmann @ 2024-05-06 18:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Helmut Eller, Emacs Devel

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> I remember now why I thought tht scan_bc would work they way I thought,
> so that I could compute a suitable scan end and so on. I read in the MPS
> docs this:
>
>   type mps_area_scan_t
>
>   Warning: Area scanning functions are subject to the same set of
>   restrictions as format scanning functions, described under Cautions.
>
> And Cautions links to a long list containing
>
>   7.3. Cautions
>
>   The MPS guarantees that format methods have exclusive access to the
>   object for the duration of the call. This guarantee may entail
>   suspending arbitrary threads. The methods that manipulate the object
>   must not perform any sort of inter-thread locking or communication.
>
> etc.
>
> Question is of course now, what is with the exclusive access for area
> scanning functions? Is that point a member of the "set of restrictions"?
>
> I can't answer that ATM. Maybe someone else can?

After reading the MPS Guide (Roots, Maintaining consistency, Scanning)
again, I must say I believe that the exclusive access is granted. The
docs everywhere basically equate format scanners and root scanning
functions.

(As an aside, I'm having a hard time imagining how stack scanning, area
scanning would word if that weren't true. It doesn't have to be
barriers, it could also temporarily halt threads.)

I'd be interested in others' opinions!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MPS: Area scanners
  2024-05-06 18:24 ` Eli Zaretskii
@ 2024-05-06 18:46   ` Gerd Möllmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Möllmann @ 2024-05-06 18:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: eller.helmut, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: Emacs Devel <emacs-devel@gnu.org>
>> Date: Mon, 06 May 2024 19:12:08 +0200
>> 
>> I remember now why I thought tht scan_bc would work they way I thought,
>> so that I could compute a suitable scan end and so on. I read in the MPS
>> docs this:
>> 
>>   type mps_area_scan_t
>> 
>>   Warning: Area scanning functions are subject to the same set of
>>   restrictions as format scanning functions, described under Cautions.
>> 
>> And Cautions links to a long list containing
>> 
>>   7.3. Cautions
>> 
>>   The MPS guarantees that format methods have exclusive access to the
>>   object for the duration of the call. This guarantee may entail
>>   suspending arbitrary threads. The methods that manipulate the object
>>   must not perform any sort of inter-thread locking or communication.
>> 
>> etc.
>> 
>> Question is of course now, what is with the exclusive access for area
>> scanning functions? Is that point a member of the "set of restrictions"?
>> 
>> I can't answer that ATM. Maybe someone else can?
>
> What are those scanning function you are talking about? are they all
> those fix_SOMETHING functions that run off dflt_scan etc.?  

The fix_xy functions are subroutines that can be used in scan functions.
The scan functions are

- dflt_scan, which MPS calls an object format scan function because we
  specified it in an MPS object format. The MPS object format contains a
  number of infos about our objects (see make_dflt_fmt in igc.c).

- MPS root scanning functions, which are used to scan roots. and are
  specified when creating MPS roots. Examples scan_ambig, scan_bc, ...

All the function named are in igc.c.

> If so, these scan Lisp objects, do they? 

Yes. Some objects we allocated from MPS are also not for Lisp. Doesn't
matter.

> And so, the above restrictions on inter-thread locking or
> communication are relevant for those fix_SOMETHING functions? 

Sure.

> If so, why is inter-thread locking relevant? I don't see anything like
> that in those fix_SOMETHING functions. Did I miss something?

100% certain is, and MPS says do that format scanning function are
granted exclusice access to the area of memory being scanned. So
dflt_scan and subroutines have that.

In the thread about scan_bc the question came up if root scanning
functions also have exclusive access to what they scan. I initially
believed so 100%, forgot why and then doubted the 100%, read a bit
and now believe again to 100%.

It's a bit complicated :-).



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MPS: Area scanners
  2024-05-06 18:28 ` Gerd Möllmann
@ 2024-05-07  5:53   ` Helmut Eller
  2024-05-07  6:07     ` Gerd Möllmann
  0 siblings, 1 reply; 6+ messages in thread
From: Helmut Eller @ 2024-05-07  5:53 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: Eli Zaretskii, Emacs Devel

On Mon, May 06 2024, Gerd Möllmann wrote:

> I'd be interested in others' opinions!

The way I understand the doc is this:
  a) Area scanners are called from a signal handler.
  b) MPS is a stop-the-world design, i.e. all threads are stopped before
     an area scanner is called.

Because of a) the usual restrictions for signal handlers apply and
because b) we have exclusive access.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MPS: Area scanners
  2024-05-07  5:53   ` Helmut Eller
@ 2024-05-07  6:07     ` Gerd Möllmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Möllmann @ 2024-05-07  6:07 UTC (permalink / raw)
  To: Helmut Eller; +Cc: Eli Zaretskii, Emacs Devel

Helmut Eller <eller.helmut@gmail.com> writes:

> On Mon, May 06 2024, Gerd Möllmann wrote:
>
>> I'd be interested in others' opinions!
>
> The way I understand the doc is this:
>   a) Area scanners are called from a signal handler.
>   b) MPS is a stop-the-world design, i.e. all threads are stopped before
>      an area scanner is called.
>
> Because of a) the usual restrictions for signal handlers apply and
> because b) we have exclusive access.

Thanks! 



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-07  6:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 17:12 MPS: Area scanners Gerd Möllmann
2024-05-06 18:24 ` Eli Zaretskii
2024-05-06 18:46   ` Gerd Möllmann
2024-05-06 18:28 ` Gerd Möllmann
2024-05-07  5:53   ` Helmut Eller
2024-05-07  6:07     ` Gerd Möllmann

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).