emacs-devel
[Top][All Lists]
Advanced

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

Re: MPS codegen


From: Eli Zaretskii
Subject: Re: MPS codegen
Date: Sat, 15 Jun 2024 09:26:15 +0300

> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  acorallo@gnu.org,  emacs-devel@gnu.org
> Date: Fri, 14 Jun 2024 21:50:26 +0200
> 
> Helmut Eller <eller.helmut@gmail.com> writes:
> 
> > My hypothesis is that discard_dump is the problem.  The hot section
> > probably contains something that isn't properly copied and
> > dump_discard_mem seems to be a bit different on Windows.  Why it even
> > works on Linux is a mystery to me :-).
> 
> Pdumper can use, among other methods, mmap'd files. In that case
> munmap'ing could write changes back to disk. So pdumper rather marks the
> region as not needed. At least that's how I understand it.

But it doesn't protect the region from being accessed, AFAIU.  By
contrast, on MS-Windows we do this:

      (void) VirtualProtect (mem, size, PAGE_NOACCESS, &old_prot);

which will then cause an access violation if any address within the
region is accessed in any way (read or write).  If you do the same
with mmap and PROT_NONE, does the build still work and does the built
Emacs succeed to start?

Note that originally pdumper.c called dump_discard_mem only for
sections considered discardable:

  sections[DS_DISCARDABLE].spec = (struct dump_memory_map_spec)
    {
     .fd = dump_fd,
     .size = header->cold_start - adj_discardable_start,
     .offset = adj_discardable_start,
     .protection = DUMP_MEMORY_ACCESS_READWRITE,
    };
  [...]
  dump_mmap_discard_contents (&sections[DS_DISCARDABLE]);

Whereas the code in igc.c seems to discard all of the memory loaded
from the pdumper file, or am I missing something?



reply via email to

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