emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MPS prstack


From: Gerd Möllmann
Subject: Re: MPS prstack
Date: Mon, 20 May 2024 20:21:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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

> In print.c, there is a global variable prstack that is not yet scanned.
> This causes a crash for comp-tests but this example triggers the same
> problem:
>
> (progn
>   (defun make-tree (i)
>     (cond ((= i 0) nil)
>         (t (list (make-string 10000 i)
>                  (make-tree (1- i)) (make-tree (1- i))))))
>   (prin1-to-string (make-tree 13)))
>
> We could create an ambiguous root for this but I thought it would be an
> interesting exercise to scan it exactly.  It's interesting because this is
> a static variable and the type is only declared in print.c.  So I added
> a new function igc_xpalloc_exact to igc.h.  That uses a callback that
> calls another callback.  I'm not sure if this allowed by the MPS rules
> but it seems to work or at least doesn't seem to crash.
>
> WDYT?

LGTM and pushed. Thanks!

AFAICT, taking the reference literally, it is permissible to pass the
mps_ss_t around. It merely says this

  type mps_ss_t
  The type of scan states.

  A scan state represents the state of the current scan. The MPS passes
  a scan state to the scan method of an object format when it needs to
  scan for references within a region of memory. The scan method must
  pass the scan state to MPS_SCAN_BEGIN and MPS_SCAN_END to delimit a
  sequence of fix operations, and to the functions MPS_FIX1(),
  MPS_FIX2() and MPS_FIX12() when fixing a reference.

And that we do...
And it doesn't crash :-)

I've BTW also protected all the user-defined hash test functions in some
commit today, which are malloc'd in fns.c. Reason is that these persist
beyond the lifetime of hash tables using them, IIUC. Strange thing,
somewhat. Whatever :-).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]