unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Question about mmap buffers
@ 2014-04-25 11:20 Fabrice Popineau
  2014-04-29 16:24 ` Fabrice Popineau
  0 siblings, 1 reply; 4+ messages in thread
From: Fabrice Popineau @ 2014-04-25 11:20 UTC (permalink / raw)
  To: emacs-devel


I'm in the process of revamping memory allocation for Win32 and adding 
virtual memory allocation support for buffers.

Reading the code in src/buffer.c, I wonder about the mmap_set_vars() 
function.
This function sets the beginning of text address to NULL before dumping,
and later in init_buffer() the same address is tested for being NULL, in 
which case the buffer memory is allocated.

Why can't this be written as the Win32 code below:

void
init_buffer (void)
{
  char *pwd;
  Lisp_Object temp;
  ptrdiff_t len;

#ifdef USE_MMAP_FOR_BUFFERS
 {
   /* When using the ralloc implementation based on mmap(2), buffer
      text pointers will have been set to null in the dumped Emacs.
      Map new memory.  */
   struct buffer *b;

#ifdef WINDOWSNT
   /* Who cares: no buffer can be dumped with a meaningful address.
      We can as well force their values at NULL here. */
   FOR_EACH_BUFFER (b)
   {
     b->text->beg = NULL;
     enlarge_buffer_text (b, 0);
   }
#else
   FOR_EACH_BUFFER (b)
     if (b->text->beg == NULL)
       enlarge_buffer_text (b, 0);
#endif
 }
#endif /* USE_MMAP_FOR_BUFFERS */


and forget about the mmap_set_vars() function?

If this is correct and a change along these lines could be applied, that 
would slightly simplify my patch to come.

Thanks for any comments,

Fabrice




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

* Re: Question about mmap buffers
  2014-04-25 11:20 Question about mmap buffers Fabrice Popineau
@ 2014-04-29 16:24 ` Fabrice Popineau
  2014-05-14 18:06   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Fabrice Popineau @ 2014-04-29 16:24 UTC (permalink / raw)
  To: emacs-devel


Nobody picked up my question.

So more formally, can we apply a patch like the one below? 
I'm not sure if the mmap_set_vars() function is of any use
at all under Unix. I don't see the point with it. Maybe
it could be entirely removed.

Thanks in advance for your comments.


Fabrice

=== modified file 'src/buffer.c'
--- src/buffer.c	2014-04-24 03:59:19 +0000
+++ src/buffer.c	2014-04-29 15:15:34 +0000

@@ -5336,14 +5341,15 @@
 
 #ifdef USE_MMAP_FOR_BUFFERS
  {
-   /* When using the ralloc implementation based on mmap(2), buffer
-      text pointers will have been set to null in the dumped Emacs.
-      Map new memory.  */
    struct buffer *b;
 
+   /* No buffer can be dumped with a meaningful address.
+      We reallocate them here. */
    FOR_EACH_BUFFER (b)
-     if (b->text->beg == NULL)
-       enlarge_buffer_text (b, 0);
+   {
+     b->text->beg = NULL;
+     enlarge_buffer_text (b, 0);
+   }
  }
 #endif /* USE_MMAP_FOR_BUFFERS */




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

* Re: Question about mmap buffers
  2014-04-29 16:24 ` Fabrice Popineau
@ 2014-05-14 18:06   ` Eli Zaretskii
  2014-05-17  7:16     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2014-05-14 18:06 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-devel

> From: Fabrice Popineau <fabrice.popineau@gmail.com>
> Date: Tue, 29 Apr 2014 16:24:09 +0000 (UTC)
> 
> Nobody picked up my question.
> 
> So more formally, can we apply a patch like the one below? 
> I'm not sure if the mmap_set_vars() function is of any use
> at all under Unix. I don't see the point with it. Maybe
> it could be entirely removed.
> 
> Thanks in advance for your comments.

2 weeks with no comments is more than enough.  I will give you-all 2
more days, and then commit this.  Speak now or forever hold your
peace.



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

* Re: Question about mmap buffers
  2014-05-14 18:06   ` Eli Zaretskii
@ 2014-05-17  7:16     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2014-05-17  7:16 UTC (permalink / raw)
  To: fabrice.popineau; +Cc: emacs-devel

> Date: Wed, 14 May 2014 21:06:36 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > From: Fabrice Popineau <fabrice.popineau@gmail.com>
> > Date: Tue, 29 Apr 2014 16:24:09 +0000 (UTC)
> > 
> > Nobody picked up my question.
> > 
> > So more formally, can we apply a patch like the one below? 
> > I'm not sure if the mmap_set_vars() function is of any use
> > at all under Unix. I don't see the point with it. Maybe
> > it could be entirely removed.
> > 
> > Thanks in advance for your comments.
> 
> 2 weeks with no comments is more than enough.  I will give you-all 2
> more days, and then commit this.  Speak now or forever hold your
> peace.

No comments, so I committed this as trunk revision 117118.



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

end of thread, other threads:[~2014-05-17  7:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-25 11:20 Question about mmap buffers Fabrice Popineau
2014-04-29 16:24 ` Fabrice Popineau
2014-05-14 18:06   ` Eli Zaretskii
2014-05-17  7:16     ` Eli Zaretskii

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