GNU bug report logs - #54698
non-recursive GC marking [PATCH]

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Sun, 3 Apr 2022 18:42:02 UTC

Severity: normal

Tags: patch

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mattias Engdegård <mattiase <at> acm.org>
Subject: bug#54698: closed (Re: bug#54698: non-recursive GC marking [PATCH])
Date: Mon, 04 Apr 2022 17:19:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#54698: non-recursive GC marking [PATCH]

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 54698 <at> debbugs.gnu.org.

-- 
54698: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54698
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 54698-done <at> debbugs.gnu.org
Subject: Re: bug#54698: non-recursive GC marking [PATCH]
Date: Mon, 4 Apr 2022 19:18:31 +0200
4 apr. 2022 kl. 14.25 skrev Eli Zaretskii <eliz <at> gnu.org>:

> I don't need to prove you wrong: if the problem is real, we will hear
> about that soon enough.

Yes, you are probably right about that.

4 apr. 2022 kl. 13.31 skrev Lars Ingebrigtsen <larsi <at> gnus.org>:

> (bug#31362 and bug#46900 should probably be closed after applying this
> patch, I guess.)

Thanks, will do.

Pushed to master (after tidying up).


[Message part 3 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: non-recursive GC marking [PATCH]
Date: Sun, 3 Apr 2022 20:40:57 +0200
[Message part 4 (text/plain, inline)]
The GC uses recursion to traverse data structures for marking which imposes a limit to how big (or deeply nested) Lisp data structures can be, and usually results in an immediate Emacs crash without warning when that limit is exceeded.

The attached patch replaces recursion with an explicit stack for most common object types: conses, vectors, records, hash tables, symbols, functions etc. Recursion remains for some less common types (buffers, frames etc) but these are typically not used in quantities to cause a problem.

A side benefit is that GC becomes quite a bit faster as a result. Actual workloads such as byte-compilation are consequently sped up by a small but measurable amount.

The patch is explicitly unfinished in some uninteresting respects to make it easier to read; `process_mark_stack` needs reindenting.

[gc-mark-stack.diff (application/octet-stream, attachment)]

This bug report was last modified 2 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.