all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: emacs-devel@gnu.org
Subject: Question about mmap buffers
Date: Fri, 25 Apr 2014 11:20:36 +0000 (UTC)	[thread overview]
Message-ID: <loom.20140425T131540-411@post.gmane.org> (raw)


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




             reply	other threads:[~2014-04-25 11:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25 11:20 Fabrice Popineau [this message]
2014-04-29 16:24 ` Question about mmap buffers Fabrice Popineau
2014-05-14 18:06   ` Eli Zaretskii
2014-05-17  7:16     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20140425T131540-411@post.gmane.org \
    --to=fabrice.popineau@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.