emacs-devel
[Top][All Lists]
Advanced

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

Re: STatus of MPS branch


From: Gerd Möllmann
Subject: Re: STatus of MPS branch
Date: Sun, 21 Apr 2024 17:37:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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

> On Sat, Apr 20 2024, Gerd Möllmann wrote:
>
>> There are many things other people could help with at this point. Some
>> require no knowledge of MPS, or C. For example:
>>
>> - Make it work on anything not macOS.
>
> I'm trying to build the igc branch on Debian.  But I get a SIGSEGV when
> loaddefs-gen.el gets loaded.
>
> I configured with:
>   CFLAGS='-g -O0 -I/scratch/emacs/mps-install/include 
> -L/scratch/emacs/mps-install/lib' configure --enable-checking=yes 
> --without-all --without-x --with-mps=debug
>
> and made some changes to igc.c as seen in the diff below; but those seem
> rather innocent.
>
> GCC still emits this warning:
>
> igc.c:229:18: warning: ‘pvec_type’ is narrower than values of its type
>   229 |   enum pvec_type pvec_type : IGC_PVEC_BITS;

Hi Helmut!

Good catch, clang didn't find that. You could increase the bit field
size by 1, and the one for the hash by 1, for example.

> Is this something to worry about?

I don't think so. I'm using the pvec_type for debugging, mainly.

>
> Helmut
>
> diff --git a/src/igc.c b/src/igc.c
> @@ -81,7 +81,7 @@ igc_assert_fail (const char *file, unsigned line, const 
> char *msg)
>  # define igc_assert(expr)                         \
>     if (!(expr))                                   \
>       igc_assert_fail (__FILE__, __LINE__, #expr); \
> -   else
> +   /* else */
>  #else
>  # define igc_assert(expr) (void) 9
>  #endif
> @@ -122,7 +122,7 @@ is_aligned (const mps_addr_t addr)
>  #define IGC_CHECK_RES(res) \
>    if ((res) != MPS_RES_OK) \
>      emacs_abort ();        \
> -  else
> +  /* else */

Don't know, this looks a bit problemantic, but if it's the problem I
don't know. Removing the else means something like

  if (x)
    igc_assert (...);
  else
    do something else

expand to something one doesn't want. The else is swallowed by the if in
the macro...

>  #define IGC_WITH_PARKED(gc)                        \
>    for (int i = (mps_arena_park (gc->arena), 1); i; \
> @@ -801,6 +801,7 @@ scan_pure (mps_ss_t ss, void *start, void *end, void 
> *closure)
>    MPS_SCAN_BEGIN (ss)
>    {
>      igc_assert (start == (void *) pure);
> +    extern ptrdiff_t pure_bytes_used_lisp;
>      end = (char *) pure + pure_bytes_used_lisp;
>      if (end > start)
>        IGC_FIX_CALL (ss, scan_ambig (ss, start, end, NULL));
> @@ -954,6 +955,7 @@ fix_itree_node (mps_ss_t ss, struct itree_node *n)
>  static mps_res_t
>  fix_image (mps_ss_t ss, struct image *i)
>  {
> +#ifdef HAVE_WINDOW_SYSTEM
>    MPS_SCAN_BEGIN (ss)
>    {
>      IGC_FIX12_OBJ (ss, &i->spec);
> @@ -964,6 +966,7 @@ fix_image (mps_ss_t ss, struct image *i)
>    }
>    MPS_SCAN_END (ss);
>    return MPS_RES_OK;
> +#endif
>  }

If I'm reading this one right, the function doesn't return a value.
But maybe this doesn't get compiled?

Otherwise, I don't see something suspicious.

>   INFO     Scraping files for loaddefs...80% 
>
> Program received signal SIGSEGV, Segmentation fault.
>
> Breakpoint 1, handle_sigsegv (sig=11, 
>     siginfo=0x555555f6ed70 <sigsegv_stack+64784>, 
>     arg=0x555555f6ec40 <sigsegv_stack+64480>) at sysdep.c:1930
> 1930      bool fatal = gc_in_progress;
> (gdb) backtrace 
> #0  handle_sigsegv (sig=11, siginfo=0x555555f6ed70 <sigsegv_stack+64784>, 
>     arg=0x555555f6ec40 <sigsegv_stack+64480>) at sysdep.c:1930
> #1  <signal handler called>
> #2  string_intervals (s=XIL(0x7ffff0698edc))
>     at /scratch/emacs/emacs-igc/src/lisp.h:4063
> #3  0x0000555555767d97 in concat_to_string (nargs=3, args=0x7fffe5f035b8)
>     at fns.c:957

I think I'd start in #2 here, by looking at S. First question would be
if the string itself it ok, and what kind of string it is. I haven't
used GDB with Emacs here for a very long time (no GDB on macOS), so I'm
a bit out of my comfort zone.

# We need the pointer to the Lisp_String that's in S, let's say it's P.
# Don't know how, sorry
???

# Is P in the dump?
p pdumper_object_p (P) 

# Is P potentially under MPS control?
p is_mps (P)

# If it is, what does its header look like (assuming 64 bit words)
p *(struct igc_header *) ((char *) P - 8)

And then, in general, we would need to know where that string comes
from. It could for example be that the string has been free'd by MPS
because it didn't see a reference to it. That's admittedly not entirely
easy. It memans going up the stack, and look around, maybe infering from
the Lisp backtrace what Emacs was trying to do, and such.



reply via email to

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