all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [dmantipov@yandex.ru: Re: Your Emacs changes]
@ 2007-08-30  7:16 Richard Stallman
  2007-08-31  3:01 ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-08-30  7:16 UTC (permalink / raw)
  To: emacs-devel

[I sent this message a week ago but did not get a response.]

Would someone please install this in the trunk, then ack?

------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
	version=3.1.0
Date:   Tue, 21 Aug 2007 18:42:20 +0400
From:   Dmitry Antipov <dmantipov@yandex.ru>
MIME-Version: 1.0
To:     rms@gnu.org
CC:     emacs-devel@gnu.org
Subject: Re: Your Emacs changes
In-Reply-To: <E1IM8Gf-0005ZW-Qc@fencepost.gnu.org>
Content-Type: multipart/mixed;
 boundary="------------040802050101020103000601"

This is a multi-part message in MIME format.
- --------------040802050101020103000601
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Richard Stallman wrote:

> Now that we have your papers, what changes should we install now?

Probably the thing described at http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00094.html.
Attached is the latest stuff on this.

Note the same optimization may be performed on sweeping floats.  But, since an amount of allocated
floats is too small in comparison with conses, an effect is expected to be very negligible.

Dmitry

- --------------040802050101020103000601
Content-Type: text/x-patch;
 name="fast_cons_sweep.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="fast_cons_sweep.patch"

Index: alloc.c
===================================================================
RCS file: /sources/emacs/emacs/src/alloc.c,v
retrieving revision 1.414
diff -u -r1.414 alloc.c
- --- alloc.c	19 Aug 2007 00:15:26 -0000	1.414
+++ alloc.c	21 Aug 2007 14:31:37 -0000
@@ -5974,23 +5974,53 @@
 
     for (cblk = cons_block; cblk; cblk = *cprev)
       {
- -	register int i;
+	register int i = 0;
 	int this_free = 0;
- -	for (i = 0; i < lim; i++)
- -	  if (!CONS_MARKED_P (&cblk->conses[i]))
- -	    {
- -	      this_free++;
- -	      cblk->conses[i].u.chain = cons_free_list;
- -	      cons_free_list = &cblk->conses[i];
+
+	while (1)
+	  {
+	    if (cblk->gcmarkbits[i] == -1)
+	      {
+		/* Fast path - everything is marked.  */
+		cblk->gcmarkbits[i++] = 0;
+		num_used += BITS_PER_INT;
+	      }
+	    else
+	      {
+		/* Slow path - scan over each bit, from the beginning
+		   of current word to 'min (word boundary, LIM)'.  */
+		int start, stop;
+
+		start = i * BITS_PER_INT;
+		stop = lim - start;
+		if (stop > BITS_PER_INT)
+		  stop = BITS_PER_INT;
+		stop += start;
+
+		while (start < stop)
+		  {
+		    if (!CONS_MARKED_P (&cblk->conses[start]))
+		      {
+			this_free++;
+			cblk->conses[start].u.chain = cons_free_list;
+			cons_free_list = &cblk->conses[start];
 #if GC_MARK_STACK
- -	      cons_free_list->car = Vdead;
+			cons_free_list->car = Vdead;
 #endif
- -	    }
- -	  else
- -	    {
- -	      num_used++;
- -	      CONS_UNMARK (&cblk->conses[i]);
- -	    }
+		      }
+		    else
+		      {
+			num_used++;
+			CONS_UNMARK (&cblk->conses[start]);
+		      }
+		    start++;
+		  }
+		if (stop < (++i) * BITS_PER_INT)
+		  /* Whole bitmap is scanned or LIM is reached.  */
+		  break;
+	      }
+	  }
+
 	lim = CONS_BLOCK_SIZE;
 	/* If this block contains only free conses and we have already
 	   seen more than two blocks worth of free conses then deallocate

- --------------040802050101020103000601--
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [dmantipov@yandex.ru: Re: Your Emacs changes]
@ 2007-08-22  3:15 Richard Stallman
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2007-08-22  3:15 UTC (permalink / raw)
  To: emacs-devel

Would someone please install this in the trunk, then ack?

------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
	version=3.1.0
Date:   Tue, 21 Aug 2007 18:42:20 +0400
From:   Dmitry Antipov <dmantipov@yandex.ru>
MIME-Version: 1.0
To:     rms@gnu.org
CC:     emacs-devel@gnu.org
Subject: Re: Your Emacs changes
In-Reply-To: <E1IM8Gf-0005ZW-Qc@fencepost.gnu.org>
Content-Type: multipart/mixed;
 boundary="------------040802050101020103000601"

This is a multi-part message in MIME format.
- --------------040802050101020103000601
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Richard Stallman wrote:

> Now that we have your papers, what changes should we install now?

Probably the thing described at http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00094.html.
Attached is the latest stuff on this.

Note the same optimization may be performed on sweeping floats.  But, since an amount of allocated
floats is too small in comparison with conses, an effect is expected to be very negligible.

Dmitry

- --------------040802050101020103000601
Content-Type: text/x-patch;
 name="fast_cons_sweep.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="fast_cons_sweep.patch"

Index: alloc.c
===================================================================
RCS file: /sources/emacs/emacs/src/alloc.c,v
retrieving revision 1.414
diff -u -r1.414 alloc.c
- --- alloc.c	19 Aug 2007 00:15:26 -0000	1.414
+++ alloc.c	21 Aug 2007 14:31:37 -0000
@@ -5974,23 +5974,53 @@
 
     for (cblk = cons_block; cblk; cblk = *cprev)
       {
- -	register int i;
+	register int i = 0;
 	int this_free = 0;
- -	for (i = 0; i < lim; i++)
- -	  if (!CONS_MARKED_P (&cblk->conses[i]))
- -	    {
- -	      this_free++;
- -	      cblk->conses[i].u.chain = cons_free_list;
- -	      cons_free_list = &cblk->conses[i];
+
+	while (1)
+	  {
+	    if (cblk->gcmarkbits[i] == -1)
+	      {
+		/* Fast path - everything is marked.  */
+		cblk->gcmarkbits[i++] = 0;
+		num_used += BITS_PER_INT;
+	      }
+	    else
+	      {
+		/* Slow path - scan over each bit, from the beginning
+		   of current word to 'min (word boundary, LIM)'.  */
+		int start, stop;
+
+		start = i * BITS_PER_INT;
+		stop = lim - start;
+		if (stop > BITS_PER_INT)
+		  stop = BITS_PER_INT;
+		stop += start;
+
+		while (start < stop)
+		  {
+		    if (!CONS_MARKED_P (&cblk->conses[start]))
+		      {
+			this_free++;
+			cblk->conses[start].u.chain = cons_free_list;
+			cons_free_list = &cblk->conses[start];
 #if GC_MARK_STACK
- -	      cons_free_list->car = Vdead;
+			cons_free_list->car = Vdead;
 #endif
- -	    }
- -	  else
- -	    {
- -	      num_used++;
- -	      CONS_UNMARK (&cblk->conses[i]);
- -	    }
+		      }
+		    else
+		      {
+			num_used++;
+			CONS_UNMARK (&cblk->conses[start]);
+		      }
+		    start++;
+		  }
+		if (stop < (++i) * BITS_PER_INT)
+		  /* Whole bitmap is scanned or LIM is reached.  */
+		  break;
+	      }
+	  }
+
 	lim = CONS_BLOCK_SIZE;
 	/* If this block contains only free conses and we have already
 	   seen more than two blocks worth of free conses then deallocate

- --------------040802050101020103000601--
------- End of forwarded message -------

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

end of thread, other threads:[~2007-09-17 15:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-30  7:16 [dmantipov@yandex.ru: Re: Your Emacs changes] Richard Stallman
2007-08-31  3:01 ` Glenn Morris
2007-09-06  5:30   ` Glenn Morris
2007-09-16  2:43     ` Glenn Morris
2007-09-17  0:20       ` Richard Stallman
2007-09-17  0:59         ` Glenn Morris
2007-09-17 15:53           ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2007-08-22  3:15 Richard Stallman

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.